版博士V2.0程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

311 righe
7.2 KiB

  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const SVGGraphicsElement_1 = __importDefault(require("./SVGGraphicsElement"));
  7. const SVGRect_1 = __importDefault(require("./SVGRect"));
  8. const SVGPoint_1 = __importDefault(require("./SVGPoint"));
  9. const SVGLength_1 = __importDefault(require("./SVGLength"));
  10. const SVGAngle_1 = __importDefault(require("./SVGAngle"));
  11. const SVGNumber_1 = __importDefault(require("./SVGNumber"));
  12. const SVGTransform_1 = __importDefault(require("./SVGTransform"));
  13. const SVGAnimatedRect_1 = __importDefault(require("./SVGAnimatedRect"));
  14. /**
  15. * SVGSVGElement.
  16. */
  17. class SVGSVGElement extends SVGGraphicsElement_1.default {
  18. constructor() {
  19. super(...arguments);
  20. // Events
  21. this.onafterprint = null;
  22. this.onbeforeprint = null;
  23. this.onbeforeunload = null;
  24. this.ongamepadconnected = null;
  25. this.ongamepaddisconnected = null;
  26. this.onhashchange = null;
  27. this.onlanguagechange = null;
  28. this.onmessage = null;
  29. this.onmessageerror = null;
  30. this.onoffline = null;
  31. this.ononline = null;
  32. this.onpagehide = null;
  33. this.onpageshow = null;
  34. this.onpopstate = null;
  35. this.onrejectionhandled = null;
  36. this.onstorage = null;
  37. this.onunhandledrejection = null;
  38. this.onunload = null;
  39. }
  40. /**
  41. * Returns preserveAspectRatio.
  42. *
  43. * @returns PreserveAspectRatio.
  44. */
  45. get preserveAspectRatio() {
  46. return this.getAttributeNS(null, 'preserveAspectRatio') || 'xMidYMid meet';
  47. }
  48. /**
  49. * Sets preserveAspectRatio.
  50. *
  51. * @param preserveAspectRatio PreserveAspectRatio.
  52. */
  53. set preserveAspectRatio(preserveAspectRatio) {
  54. this.setAttributeNS(null, 'preserveAspectRatio', preserveAspectRatio);
  55. }
  56. /**
  57. * Returns width.
  58. *
  59. * @returns Width.
  60. */
  61. get width() {
  62. return this.getAttributeNS(null, 'width') || '';
  63. }
  64. /**
  65. * Sets width.
  66. *
  67. * @param width Width.
  68. */
  69. set width(width) {
  70. this.setAttributeNS(null, 'width', width);
  71. }
  72. /**
  73. * Returns height.
  74. *
  75. * @returns Height.
  76. */
  77. get height() {
  78. return this.getAttributeNS(null, 'height') || '';
  79. }
  80. /**
  81. * Sets height.
  82. *
  83. * @param height Height.
  84. */
  85. set height(height) {
  86. this.setAttributeNS(null, 'height', height);
  87. }
  88. /**
  89. * Returns x.
  90. *
  91. * @returns X.
  92. */
  93. get x() {
  94. return this.getAttributeNS(null, 'x') || '';
  95. }
  96. /**
  97. * Sets x.
  98. *
  99. * @param x X.
  100. */
  101. set x(x) {
  102. this.setAttributeNS(null, 'x', x);
  103. }
  104. /**
  105. * Returns y.
  106. *
  107. * @returns Y.
  108. */
  109. get y() {
  110. return this.getAttributeNS(null, 'y') || '';
  111. }
  112. /**
  113. * Sets y.
  114. *
  115. * @param y Y.
  116. */
  117. set y(y) {
  118. this.setAttributeNS(null, 'y', y);
  119. }
  120. /**
  121. * Returns contentScriptType.
  122. *
  123. * @returns ContentScriptType.
  124. */
  125. get contentScriptType() {
  126. return this.getAttributeNS(null, 'contentScriptType') || '';
  127. }
  128. /**
  129. * Sets contentScriptType.
  130. *
  131. * @param contentScriptType ContentScriptType.
  132. */
  133. set contentScriptType(contentScriptType) {
  134. this.setAttributeNS(null, 'contentScriptType', contentScriptType);
  135. }
  136. /**
  137. * Returns currentScale.
  138. *
  139. * @returns CurrentScale.
  140. */
  141. get currentScale() {
  142. const currentScale = this.getAttributeNS(null, 'currentScale');
  143. if (currentScale !== null) {
  144. return parseFloat(currentScale);
  145. }
  146. return 1;
  147. }
  148. /**
  149. * Sets currentScale.
  150. *
  151. * @param currentScale CurrentScale.
  152. */
  153. set currentScale(currentScale) {
  154. this.setAttributeNS(null, 'currentScale', String(currentScale));
  155. }
  156. /**
  157. * Returns viewport.
  158. *
  159. * @returns SVG rect.
  160. */
  161. get viewport() {
  162. return new SVGRect_1.default();
  163. }
  164. /**
  165. * Returns current translate.
  166. *
  167. * @returns SVG point.
  168. */
  169. get currentTranslate() {
  170. return new SVGPoint_1.default();
  171. }
  172. /**
  173. * Returns view box.
  174. *
  175. * @returns Viewbox.
  176. */
  177. get viewBox() {
  178. const rect = new SVGAnimatedRect_1.default();
  179. const viewBox = this.getAttribute('viewBox');
  180. const list = viewBox.split(/\s+/);
  181. rect.baseVal.x = Number(list[0]);
  182. rect.baseVal.y = Number(list[1]);
  183. rect.baseVal.width = Number(list[2]);
  184. rect.baseVal.height = Number(list[3]);
  185. return rect;
  186. }
  187. /**
  188. * Pauses animation.
  189. */
  190. pauseAnimations() { }
  191. /**
  192. * Unpauses animation.
  193. */
  194. unpauseAnimations() { }
  195. /**
  196. * Returns "true" if animation is paused.
  197. *
  198. * @returns "true" if animation is paused.
  199. */
  200. animationsPaused() {
  201. return false;
  202. }
  203. /**
  204. * Returns the current time in seconds relative to the start time for the current SVG document fragment.
  205. *
  206. * @returns Current time.
  207. */
  208. getCurrentTime() {
  209. return 0;
  210. }
  211. /**
  212. * Sets current time.
  213. */
  214. setCurrentTime() { }
  215. /**
  216. * Returns intersection list.
  217. *
  218. * @returns Intersection list.
  219. */
  220. getIntersectionList() {
  221. return [];
  222. }
  223. /**
  224. * Returns enclousure list.
  225. *
  226. * @returns Enclousure list.
  227. */
  228. getEnclosureList() {
  229. return [];
  230. }
  231. /**
  232. * Returns true if the rendered content of the given element intersects the supplied rectangle.
  233. *
  234. * @returns Intersection state.
  235. */
  236. checkIntersection() {
  237. return false;
  238. }
  239. /**
  240. * Returns true if the rendered content of the given element is entirely contained within the supplied rectangle.
  241. *
  242. * @returns Enclousure state.
  243. */
  244. checkEnclosure() {
  245. return false;
  246. }
  247. /**
  248. * Unselects any selected objects, including any selections of text strings and type-in bars.
  249. */
  250. deselectAll() { }
  251. /**
  252. * Returns a number.
  253. *
  254. * @returns Number.
  255. */
  256. createSVGNumber() {
  257. return new SVGNumber_1.default();
  258. }
  259. /**
  260. * Returns a length.
  261. *
  262. * @returns Length.
  263. */
  264. createSVGLength() {
  265. return new SVGLength_1.default();
  266. }
  267. /**
  268. * Returns a angle.
  269. *
  270. * @returns Angle.
  271. */
  272. createSVGAngle() {
  273. return new SVGAngle_1.default();
  274. }
  275. /**
  276. * Returns a point.
  277. *
  278. * @returns Point.
  279. */
  280. createSVGPoint() {
  281. return new SVGPoint_1.default();
  282. }
  283. /**
  284. * Returns a rect.
  285. *
  286. * @returns Rect.
  287. */
  288. createSVGRect() {
  289. return new SVGRect_1.default();
  290. }
  291. /**
  292. * Returns a transform.
  293. *
  294. * @returns Transform.
  295. */
  296. createSVGTransform() {
  297. return new SVGTransform_1.default();
  298. }
  299. /**
  300. * Clones a node.
  301. *
  302. * @override
  303. * @param [deep=false] "true" to clone deep.
  304. * @returns Cloned node.
  305. */
  306. cloneNode(deep = false) {
  307. return super.cloneNode(deep);
  308. }
  309. }
  310. exports.default = SVGSVGElement;
  311. //# sourceMappingURL=SVGSVGElement.js.map