UNPKG

74.5 kBJavaScriptView Raw
1"use strict";
2(function () {
3 "use strict";
4 try {
5 if (typeof window === "undefined")
6 return;
7 if (!("SVGPathSeg" in window)) {
8 window.SVGPathSeg = function (type, typeAsLetter, owningPathSegList) {
9 this.pathSegType = type;
10 this.pathSegTypeAsLetter = typeAsLetter;
11 this._owningPathSegList = owningPathSegList;
12 };
13 window.SVGPathSeg.prototype.classname = "SVGPathSeg";
14 window.SVGPathSeg.PATHSEG_UNKNOWN = 0;
15 window.SVGPathSeg.PATHSEG_CLOSEPATH = 1;
16 window.SVGPathSeg.PATHSEG_MOVETO_ABS = 2;
17 window.SVGPathSeg.PATHSEG_MOVETO_REL = 3;
18 window.SVGPathSeg.PATHSEG_LINETO_ABS = 4;
19 window.SVGPathSeg.PATHSEG_LINETO_REL = 5;
20 window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS = 6;
21 window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL = 7;
22 window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS = 8;
23 window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL = 9;
24 window.SVGPathSeg.PATHSEG_ARC_ABS = 10;
25 window.SVGPathSeg.PATHSEG_ARC_REL = 11;
26 window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS = 12;
27 window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL = 13;
28 window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS = 14;
29 window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL = 15;
30 window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16;
31 window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17;
32 window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18;
33 window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19;
34 window.SVGPathSeg.prototype._segmentChanged = function () {
35 if (this._owningPathSegList)
36 this._owningPathSegList.segmentChanged(this);
37 };
38 window.SVGPathSegClosePath = function (owningPathSegList) {
39 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CLOSEPATH, "z", owningPathSegList);
40 };
41 window.SVGPathSegClosePath.prototype = Object.create(window.SVGPathSeg.prototype);
42 window.SVGPathSegClosePath.prototype.toString = function () {
43 return "[object SVGPathSegClosePath]";
44 };
45 window.SVGPathSegClosePath.prototype._asPathString = function () {
46 return this.pathSegTypeAsLetter;
47 };
48 window.SVGPathSegClosePath.prototype.clone = function () {
49 return new window.SVGPathSegClosePath(undefined);
50 };
51 window.SVGPathSegMovetoAbs = function (owningPathSegList, x, y) {
52 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_MOVETO_ABS, "M", owningPathSegList);
53 this._x = x;
54 this._y = y;
55 };
56 window.SVGPathSegMovetoAbs.prototype = Object.create(window.SVGPathSeg.prototype);
57 window.SVGPathSegMovetoAbs.prototype.toString = function () {
58 return "[object SVGPathSegMovetoAbs]";
59 };
60 window.SVGPathSegMovetoAbs.prototype._asPathString = function () {
61 return this.pathSegTypeAsLetter + " " + this._x + " " + this._y;
62 };
63 window.SVGPathSegMovetoAbs.prototype.clone = function () {
64 return new window.SVGPathSegMovetoAbs(undefined, this._x, this._y);
65 };
66 Object.defineProperty(window.SVGPathSegMovetoAbs.prototype, "x", {
67 get: function () {
68 return this._x;
69 },
70 set: function (x) {
71 this._x = x;
72 this._segmentChanged();
73 },
74 enumerable: true,
75 });
76 Object.defineProperty(window.SVGPathSegMovetoAbs.prototype, "y", {
77 get: function () {
78 return this._y;
79 },
80 set: function (y) {
81 this._y = y;
82 this._segmentChanged();
83 },
84 enumerable: true,
85 });
86 window.SVGPathSegMovetoRel = function (owningPathSegList, x, y) {
87 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_MOVETO_REL, "m", owningPathSegList);
88 this._x = x;
89 this._y = y;
90 };
91 window.SVGPathSegMovetoRel.prototype = Object.create(window.SVGPathSeg.prototype);
92 window.SVGPathSegMovetoRel.prototype.toString = function () {
93 return "[object SVGPathSegMovetoRel]";
94 };
95 window.SVGPathSegMovetoRel.prototype._asPathString = function () {
96 return this.pathSegTypeAsLetter + " " + this._x + " " + this._y;
97 };
98 window.SVGPathSegMovetoRel.prototype.clone = function () {
99 return new window.SVGPathSegMovetoRel(undefined, this._x, this._y);
100 };
101 Object.defineProperty(window.SVGPathSegMovetoRel.prototype, "x", {
102 get: function () {
103 return this._x;
104 },
105 set: function (x) {
106 this._x = x;
107 this._segmentChanged();
108 },
109 enumerable: true,
110 });
111 Object.defineProperty(window.SVGPathSegMovetoRel.prototype, "y", {
112 get: function () {
113 return this._y;
114 },
115 set: function (y) {
116 this._y = y;
117 this._segmentChanged();
118 },
119 enumerable: true,
120 });
121 window.SVGPathSegLinetoAbs = function (owningPathSegList, x, y) {
122 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_ABS, "L", owningPathSegList);
123 this._x = x;
124 this._y = y;
125 };
126 window.SVGPathSegLinetoAbs.prototype = Object.create(window.SVGPathSeg.prototype);
127 window.SVGPathSegLinetoAbs.prototype.toString = function () {
128 return "[object SVGPathSegLinetoAbs]";
129 };
130 window.SVGPathSegLinetoAbs.prototype._asPathString = function () {
131 return this.pathSegTypeAsLetter + " " + this._x + " " + this._y;
132 };
133 window.SVGPathSegLinetoAbs.prototype.clone = function () {
134 return new window.SVGPathSegLinetoAbs(undefined, this._x, this._y);
135 };
136 Object.defineProperty(window.SVGPathSegLinetoAbs.prototype, "x", {
137 get: function () {
138 return this._x;
139 },
140 set: function (x) {
141 this._x = x;
142 this._segmentChanged();
143 },
144 enumerable: true,
145 });
146 Object.defineProperty(window.SVGPathSegLinetoAbs.prototype, "y", {
147 get: function () {
148 return this._y;
149 },
150 set: function (y) {
151 this._y = y;
152 this._segmentChanged();
153 },
154 enumerable: true,
155 });
156 window.SVGPathSegLinetoRel = function (owningPathSegList, x, y) {
157 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_REL, "l", owningPathSegList);
158 this._x = x;
159 this._y = y;
160 };
161 window.SVGPathSegLinetoRel.prototype = Object.create(window.SVGPathSeg.prototype);
162 window.SVGPathSegLinetoRel.prototype.toString = function () {
163 return "[object SVGPathSegLinetoRel]";
164 };
165 window.SVGPathSegLinetoRel.prototype._asPathString = function () {
166 return this.pathSegTypeAsLetter + " " + this._x + " " + this._y;
167 };
168 window.SVGPathSegLinetoRel.prototype.clone = function () {
169 return new window.SVGPathSegLinetoRel(undefined, this._x, this._y);
170 };
171 Object.defineProperty(window.SVGPathSegLinetoRel.prototype, "x", {
172 get: function () {
173 return this._x;
174 },
175 set: function (x) {
176 this._x = x;
177 this._segmentChanged();
178 },
179 enumerable: true,
180 });
181 Object.defineProperty(window.SVGPathSegLinetoRel.prototype, "y", {
182 get: function () {
183 return this._y;
184 },
185 set: function (y) {
186 this._y = y;
187 this._segmentChanged();
188 },
189 enumerable: true,
190 });
191 window.SVGPathSegCurvetoCubicAbs = function (owningPathSegList, x, y, x1, y1, x2, y2) {
192 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS, "C", owningPathSegList);
193 this._x = x;
194 this._y = y;
195 this._x1 = x1;
196 this._y1 = y1;
197 this._x2 = x2;
198 this._y2 = y2;
199 };
200 window.SVGPathSegCurvetoCubicAbs.prototype = Object.create(window.SVGPathSeg.prototype);
201 window.SVGPathSegCurvetoCubicAbs.prototype.toString = function () {
202 return "[object SVGPathSegCurvetoCubicAbs]";
203 };
204 window.SVGPathSegCurvetoCubicAbs.prototype._asPathString = function () {
205 return (this.pathSegTypeAsLetter +
206 " " +
207 this._x1 +
208 " " +
209 this._y1 +
210 " " +
211 this._x2 +
212 " " +
213 this._y2 +
214 " " +
215 this._x +
216 " " +
217 this._y);
218 };
219 window.SVGPathSegCurvetoCubicAbs.prototype.clone = function () {
220 return new window.SVGPathSegCurvetoCubicAbs(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2);
221 };
222 Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "x", {
223 get: function () {
224 return this._x;
225 },
226 set: function (x) {
227 this._x = x;
228 this._segmentChanged();
229 },
230 enumerable: true,
231 });
232 Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "y", {
233 get: function () {
234 return this._y;
235 },
236 set: function (y) {
237 this._y = y;
238 this._segmentChanged();
239 },
240 enumerable: true,
241 });
242 Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "x1", {
243 get: function () {
244 return this._x1;
245 },
246 set: function (x1) {
247 this._x1 = x1;
248 this._segmentChanged();
249 },
250 enumerable: true,
251 });
252 Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "y1", {
253 get: function () {
254 return this._y1;
255 },
256 set: function (y1) {
257 this._y1 = y1;
258 this._segmentChanged();
259 },
260 enumerable: true,
261 });
262 Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "x2", {
263 get: function () {
264 return this._x2;
265 },
266 set: function (x2) {
267 this._x2 = x2;
268 this._segmentChanged();
269 },
270 enumerable: true,
271 });
272 Object.defineProperty(window.SVGPathSegCurvetoCubicAbs.prototype, "y2", {
273 get: function () {
274 return this._y2;
275 },
276 set: function (y2) {
277 this._y2 = y2;
278 this._segmentChanged();
279 },
280 enumerable: true,
281 });
282 window.SVGPathSegCurvetoCubicRel = function (owningPathSegList, x, y, x1, y1, x2, y2) {
283 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL, "c", owningPathSegList);
284 this._x = x;
285 this._y = y;
286 this._x1 = x1;
287 this._y1 = y1;
288 this._x2 = x2;
289 this._y2 = y2;
290 };
291 window.SVGPathSegCurvetoCubicRel.prototype = Object.create(window.SVGPathSeg.prototype);
292 window.SVGPathSegCurvetoCubicRel.prototype.toString = function () {
293 return "[object SVGPathSegCurvetoCubicRel]";
294 };
295 window.SVGPathSegCurvetoCubicRel.prototype._asPathString = function () {
296 return (this.pathSegTypeAsLetter +
297 " " +
298 this._x1 +
299 " " +
300 this._y1 +
301 " " +
302 this._x2 +
303 " " +
304 this._y2 +
305 " " +
306 this._x +
307 " " +
308 this._y);
309 };
310 window.SVGPathSegCurvetoCubicRel.prototype.clone = function () {
311 return new window.SVGPathSegCurvetoCubicRel(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2);
312 };
313 Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "x", {
314 get: function () {
315 return this._x;
316 },
317 set: function (x) {
318 this._x = x;
319 this._segmentChanged();
320 },
321 enumerable: true,
322 });
323 Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "y", {
324 get: function () {
325 return this._y;
326 },
327 set: function (y) {
328 this._y = y;
329 this._segmentChanged();
330 },
331 enumerable: true,
332 });
333 Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "x1", {
334 get: function () {
335 return this._x1;
336 },
337 set: function (x1) {
338 this._x1 = x1;
339 this._segmentChanged();
340 },
341 enumerable: true,
342 });
343 Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "y1", {
344 get: function () {
345 return this._y1;
346 },
347 set: function (y1) {
348 this._y1 = y1;
349 this._segmentChanged();
350 },
351 enumerable: true,
352 });
353 Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "x2", {
354 get: function () {
355 return this._x2;
356 },
357 set: function (x2) {
358 this._x2 = x2;
359 this._segmentChanged();
360 },
361 enumerable: true,
362 });
363 Object.defineProperty(window.SVGPathSegCurvetoCubicRel.prototype, "y2", {
364 get: function () {
365 return this._y2;
366 },
367 set: function (y2) {
368 this._y2 = y2;
369 this._segmentChanged();
370 },
371 enumerable: true,
372 });
373 window.SVGPathSegCurvetoQuadraticAbs = function (owningPathSegList, x, y, x1, y1) {
374 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS, "Q", owningPathSegList);
375 this._x = x;
376 this._y = y;
377 this._x1 = x1;
378 this._y1 = y1;
379 };
380 window.SVGPathSegCurvetoQuadraticAbs.prototype = Object.create(window.SVGPathSeg.prototype);
381 window.SVGPathSegCurvetoQuadraticAbs.prototype.toString = function () {
382 return "[object SVGPathSegCurvetoQuadraticAbs]";
383 };
384 window.SVGPathSegCurvetoQuadraticAbs.prototype._asPathString = function () {
385 return this.pathSegTypeAsLetter + " " + this._x1 + " " + this._y1 + " " + this._x + " " + this._y;
386 };
387 window.SVGPathSegCurvetoQuadraticAbs.prototype.clone = function () {
388 return new window.SVGPathSegCurvetoQuadraticAbs(undefined, this._x, this._y, this._x1, this._y1);
389 };
390 Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "x", {
391 get: function () {
392 return this._x;
393 },
394 set: function (x) {
395 this._x = x;
396 this._segmentChanged();
397 },
398 enumerable: true,
399 });
400 Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "y", {
401 get: function () {
402 return this._y;
403 },
404 set: function (y) {
405 this._y = y;
406 this._segmentChanged();
407 },
408 enumerable: true,
409 });
410 Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "x1", {
411 get: function () {
412 return this._x1;
413 },
414 set: function (x1) {
415 this._x1 = x1;
416 this._segmentChanged();
417 },
418 enumerable: true,
419 });
420 Object.defineProperty(window.SVGPathSegCurvetoQuadraticAbs.prototype, "y1", {
421 get: function () {
422 return this._y1;
423 },
424 set: function (y1) {
425 this._y1 = y1;
426 this._segmentChanged();
427 },
428 enumerable: true,
429 });
430 window.SVGPathSegCurvetoQuadraticRel = function (owningPathSegList, x, y, x1, y1) {
431 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL, "q", owningPathSegList);
432 this._x = x;
433 this._y = y;
434 this._x1 = x1;
435 this._y1 = y1;
436 };
437 window.SVGPathSegCurvetoQuadraticRel.prototype = Object.create(window.SVGPathSeg.prototype);
438 window.SVGPathSegCurvetoQuadraticRel.prototype.toString = function () {
439 return "[object SVGPathSegCurvetoQuadraticRel]";
440 };
441 window.SVGPathSegCurvetoQuadraticRel.prototype._asPathString = function () {
442 return this.pathSegTypeAsLetter + " " + this._x1 + " " + this._y1 + " " + this._x + " " + this._y;
443 };
444 window.SVGPathSegCurvetoQuadraticRel.prototype.clone = function () {
445 return new window.SVGPathSegCurvetoQuadraticRel(undefined, this._x, this._y, this._x1, this._y1);
446 };
447 Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "x", {
448 get: function () {
449 return this._x;
450 },
451 set: function (x) {
452 this._x = x;
453 this._segmentChanged();
454 },
455 enumerable: true,
456 });
457 Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "y", {
458 get: function () {
459 return this._y;
460 },
461 set: function (y) {
462 this._y = y;
463 this._segmentChanged();
464 },
465 enumerable: true,
466 });
467 Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "x1", {
468 get: function () {
469 return this._x1;
470 },
471 set: function (x1) {
472 this._x1 = x1;
473 this._segmentChanged();
474 },
475 enumerable: true,
476 });
477 Object.defineProperty(window.SVGPathSegCurvetoQuadraticRel.prototype, "y1", {
478 get: function () {
479 return this._y1;
480 },
481 set: function (y1) {
482 this._y1 = y1;
483 this._segmentChanged();
484 },
485 enumerable: true,
486 });
487 window.SVGPathSegArcAbs = function (owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) {
488 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_ARC_ABS, "A", owningPathSegList);
489 this._x = x;
490 this._y = y;
491 this._r1 = r1;
492 this._r2 = r2;
493 this._angle = angle;
494 this._largeArcFlag = largeArcFlag;
495 this._sweepFlag = sweepFlag;
496 };
497 window.SVGPathSegArcAbs.prototype = Object.create(window.SVGPathSeg.prototype);
498 window.SVGPathSegArcAbs.prototype.toString = function () {
499 return "[object SVGPathSegArcAbs]";
500 };
501 window.SVGPathSegArcAbs.prototype._asPathString = function () {
502 return (this.pathSegTypeAsLetter +
503 " " +
504 this._r1 +
505 " " +
506 this._r2 +
507 " " +
508 this._angle +
509 " " +
510 (this._largeArcFlag ? "1" : "0") +
511 " " +
512 (this._sweepFlag ? "1" : "0") +
513 " " +
514 this._x +
515 " " +
516 this._y);
517 };
518 window.SVGPathSegArcAbs.prototype.clone = function () {
519 return new window.SVGPathSegArcAbs(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag);
520 };
521 Object.defineProperty(window.SVGPathSegArcAbs.prototype, "x", {
522 get: function () {
523 return this._x;
524 },
525 set: function (x) {
526 this._x = x;
527 this._segmentChanged();
528 },
529 enumerable: true,
530 });
531 Object.defineProperty(window.SVGPathSegArcAbs.prototype, "y", {
532 get: function () {
533 return this._y;
534 },
535 set: function (y) {
536 this._y = y;
537 this._segmentChanged();
538 },
539 enumerable: true,
540 });
541 Object.defineProperty(window.SVGPathSegArcAbs.prototype, "r1", {
542 get: function () {
543 return this._r1;
544 },
545 set: function (r1) {
546 this._r1 = r1;
547 this._segmentChanged();
548 },
549 enumerable: true,
550 });
551 Object.defineProperty(window.SVGPathSegArcAbs.prototype, "r2", {
552 get: function () {
553 return this._r2;
554 },
555 set: function (r2) {
556 this._r2 = r2;
557 this._segmentChanged();
558 },
559 enumerable: true,
560 });
561 Object.defineProperty(window.SVGPathSegArcAbs.prototype, "angle", {
562 get: function () {
563 return this._angle;
564 },
565 set: function (angle) {
566 this._angle = angle;
567 this._segmentChanged();
568 },
569 enumerable: true,
570 });
571 Object.defineProperty(window.SVGPathSegArcAbs.prototype, "largeArcFlag", {
572 get: function () {
573 return this._largeArcFlag;
574 },
575 set: function (largeArcFlag) {
576 this._largeArcFlag = largeArcFlag;
577 this._segmentChanged();
578 },
579 enumerable: true,
580 });
581 Object.defineProperty(window.SVGPathSegArcAbs.prototype, "sweepFlag", {
582 get: function () {
583 return this._sweepFlag;
584 },
585 set: function (sweepFlag) {
586 this._sweepFlag = sweepFlag;
587 this._segmentChanged();
588 },
589 enumerable: true,
590 });
591 window.SVGPathSegArcRel = function (owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) {
592 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_ARC_REL, "a", owningPathSegList);
593 this._x = x;
594 this._y = y;
595 this._r1 = r1;
596 this._r2 = r2;
597 this._angle = angle;
598 this._largeArcFlag = largeArcFlag;
599 this._sweepFlag = sweepFlag;
600 };
601 window.SVGPathSegArcRel.prototype = Object.create(window.SVGPathSeg.prototype);
602 window.SVGPathSegArcRel.prototype.toString = function () {
603 return "[object SVGPathSegArcRel]";
604 };
605 window.SVGPathSegArcRel.prototype._asPathString = function () {
606 return (this.pathSegTypeAsLetter +
607 " " +
608 this._r1 +
609 " " +
610 this._r2 +
611 " " +
612 this._angle +
613 " " +
614 (this._largeArcFlag ? "1" : "0") +
615 " " +
616 (this._sweepFlag ? "1" : "0") +
617 " " +
618 this._x +
619 " " +
620 this._y);
621 };
622 window.SVGPathSegArcRel.prototype.clone = function () {
623 return new window.SVGPathSegArcRel(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag);
624 };
625 Object.defineProperty(window.SVGPathSegArcRel.prototype, "x", {
626 get: function () {
627 return this._x;
628 },
629 set: function (x) {
630 this._x = x;
631 this._segmentChanged();
632 },
633 enumerable: true,
634 });
635 Object.defineProperty(window.SVGPathSegArcRel.prototype, "y", {
636 get: function () {
637 return this._y;
638 },
639 set: function (y) {
640 this._y = y;
641 this._segmentChanged();
642 },
643 enumerable: true,
644 });
645 Object.defineProperty(window.SVGPathSegArcRel.prototype, "r1", {
646 get: function () {
647 return this._r1;
648 },
649 set: function (r1) {
650 this._r1 = r1;
651 this._segmentChanged();
652 },
653 enumerable: true,
654 });
655 Object.defineProperty(window.SVGPathSegArcRel.prototype, "r2", {
656 get: function () {
657 return this._r2;
658 },
659 set: function (r2) {
660 this._r2 = r2;
661 this._segmentChanged();
662 },
663 enumerable: true,
664 });
665 Object.defineProperty(window.SVGPathSegArcRel.prototype, "angle", {
666 get: function () {
667 return this._angle;
668 },
669 set: function (angle) {
670 this._angle = angle;
671 this._segmentChanged();
672 },
673 enumerable: true,
674 });
675 Object.defineProperty(window.SVGPathSegArcRel.prototype, "largeArcFlag", {
676 get: function () {
677 return this._largeArcFlag;
678 },
679 set: function (largeArcFlag) {
680 this._largeArcFlag = largeArcFlag;
681 this._segmentChanged();
682 },
683 enumerable: true,
684 });
685 Object.defineProperty(window.SVGPathSegArcRel.prototype, "sweepFlag", {
686 get: function () {
687 return this._sweepFlag;
688 },
689 set: function (sweepFlag) {
690 this._sweepFlag = sweepFlag;
691 this._segmentChanged();
692 },
693 enumerable: true,
694 });
695 window.SVGPathSegLinetoHorizontalAbs = function (owningPathSegList, x) {
696 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS, "H", owningPathSegList);
697 this._x = x;
698 };
699 window.SVGPathSegLinetoHorizontalAbs.prototype = Object.create(window.SVGPathSeg.prototype);
700 window.SVGPathSegLinetoHorizontalAbs.prototype.toString = function () {
701 return "[object SVGPathSegLinetoHorizontalAbs]";
702 };
703 window.SVGPathSegLinetoHorizontalAbs.prototype._asPathString = function () {
704 return this.pathSegTypeAsLetter + " " + this._x;
705 };
706 window.SVGPathSegLinetoHorizontalAbs.prototype.clone = function () {
707 return new window.SVGPathSegLinetoHorizontalAbs(undefined, this._x);
708 };
709 Object.defineProperty(window.SVGPathSegLinetoHorizontalAbs.prototype, "x", {
710 get: function () {
711 return this._x;
712 },
713 set: function (x) {
714 this._x = x;
715 this._segmentChanged();
716 },
717 enumerable: true,
718 });
719 window.SVGPathSegLinetoHorizontalRel = function (owningPathSegList, x) {
720 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL, "h", owningPathSegList);
721 this._x = x;
722 };
723 window.SVGPathSegLinetoHorizontalRel.prototype = Object.create(window.SVGPathSeg.prototype);
724 window.SVGPathSegLinetoHorizontalRel.prototype.toString = function () {
725 return "[object SVGPathSegLinetoHorizontalRel]";
726 };
727 window.SVGPathSegLinetoHorizontalRel.prototype._asPathString = function () {
728 return this.pathSegTypeAsLetter + " " + this._x;
729 };
730 window.SVGPathSegLinetoHorizontalRel.prototype.clone = function () {
731 return new window.SVGPathSegLinetoHorizontalRel(undefined, this._x);
732 };
733 Object.defineProperty(window.SVGPathSegLinetoHorizontalRel.prototype, "x", {
734 get: function () {
735 return this._x;
736 },
737 set: function (x) {
738 this._x = x;
739 this._segmentChanged();
740 },
741 enumerable: true,
742 });
743 window.SVGPathSegLinetoVerticalAbs = function (owningPathSegList, y) {
744 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS, "V", owningPathSegList);
745 this._y = y;
746 };
747 window.SVGPathSegLinetoVerticalAbs.prototype = Object.create(window.SVGPathSeg.prototype);
748 window.SVGPathSegLinetoVerticalAbs.prototype.toString = function () {
749 return "[object SVGPathSegLinetoVerticalAbs]";
750 };
751 window.SVGPathSegLinetoVerticalAbs.prototype._asPathString = function () {
752 return this.pathSegTypeAsLetter + " " + this._y;
753 };
754 window.SVGPathSegLinetoVerticalAbs.prototype.clone = function () {
755 return new window.SVGPathSegLinetoVerticalAbs(undefined, this._y);
756 };
757 Object.defineProperty(window.SVGPathSegLinetoVerticalAbs.prototype, "y", {
758 get: function () {
759 return this._y;
760 },
761 set: function (y) {
762 this._y = y;
763 this._segmentChanged();
764 },
765 enumerable: true,
766 });
767 window.SVGPathSegLinetoVerticalRel = function (owningPathSegList, y) {
768 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL, "v", owningPathSegList);
769 this._y = y;
770 };
771 window.SVGPathSegLinetoVerticalRel.prototype = Object.create(window.SVGPathSeg.prototype);
772 window.SVGPathSegLinetoVerticalRel.prototype.toString = function () {
773 return "[object SVGPathSegLinetoVerticalRel]";
774 };
775 window.SVGPathSegLinetoVerticalRel.prototype._asPathString = function () {
776 return this.pathSegTypeAsLetter + " " + this._y;
777 };
778 window.SVGPathSegLinetoVerticalRel.prototype.clone = function () {
779 return new window.SVGPathSegLinetoVerticalRel(undefined, this._y);
780 };
781 Object.defineProperty(window.SVGPathSegLinetoVerticalRel.prototype, "y", {
782 get: function () {
783 return this._y;
784 },
785 set: function (y) {
786 this._y = y;
787 this._segmentChanged();
788 },
789 enumerable: true,
790 });
791 window.SVGPathSegCurvetoCubicSmoothAbs = function (owningPathSegList, x, y, x2, y2) {
792 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, "S", owningPathSegList);
793 this._x = x;
794 this._y = y;
795 this._x2 = x2;
796 this._y2 = y2;
797 };
798 window.SVGPathSegCurvetoCubicSmoothAbs.prototype = Object.create(window.SVGPathSeg.prototype);
799 window.SVGPathSegCurvetoCubicSmoothAbs.prototype.toString = function () {
800 return "[object SVGPathSegCurvetoCubicSmoothAbs]";
801 };
802 window.SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString = function () {
803 return this.pathSegTypeAsLetter + " " + this._x2 + " " + this._y2 + " " + this._x + " " + this._y;
804 };
805 window.SVGPathSegCurvetoCubicSmoothAbs.prototype.clone = function () {
806 return new window.SVGPathSegCurvetoCubicSmoothAbs(undefined, this._x, this._y, this._x2, this._y2);
807 };
808 Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "x", {
809 get: function () {
810 return this._x;
811 },
812 set: function (x) {
813 this._x = x;
814 this._segmentChanged();
815 },
816 enumerable: true,
817 });
818 Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "y", {
819 get: function () {
820 return this._y;
821 },
822 set: function (y) {
823 this._y = y;
824 this._segmentChanged();
825 },
826 enumerable: true,
827 });
828 Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "x2", {
829 get: function () {
830 return this._x2;
831 },
832 set: function (x2) {
833 this._x2 = x2;
834 this._segmentChanged();
835 },
836 enumerable: true,
837 });
838 Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothAbs.prototype, "y2", {
839 get: function () {
840 return this._y2;
841 },
842 set: function (y2) {
843 this._y2 = y2;
844 this._segmentChanged();
845 },
846 enumerable: true,
847 });
848 window.SVGPathSegCurvetoCubicSmoothRel = function (owningPathSegList, x, y, x2, y2) {
849 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL, "s", owningPathSegList);
850 this._x = x;
851 this._y = y;
852 this._x2 = x2;
853 this._y2 = y2;
854 };
855 window.SVGPathSegCurvetoCubicSmoothRel.prototype = Object.create(window.SVGPathSeg.prototype);
856 window.SVGPathSegCurvetoCubicSmoothRel.prototype.toString = function () {
857 return "[object SVGPathSegCurvetoCubicSmoothRel]";
858 };
859 window.SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString = function () {
860 return this.pathSegTypeAsLetter + " " + this._x2 + " " + this._y2 + " " + this._x + " " + this._y;
861 };
862 window.SVGPathSegCurvetoCubicSmoothRel.prototype.clone = function () {
863 return new window.SVGPathSegCurvetoCubicSmoothRel(undefined, this._x, this._y, this._x2, this._y2);
864 };
865 Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "x", {
866 get: function () {
867 return this._x;
868 },
869 set: function (x) {
870 this._x = x;
871 this._segmentChanged();
872 },
873 enumerable: true,
874 });
875 Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "y", {
876 get: function () {
877 return this._y;
878 },
879 set: function (y) {
880 this._y = y;
881 this._segmentChanged();
882 },
883 enumerable: true,
884 });
885 Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "x2", {
886 get: function () {
887 return this._x2;
888 },
889 set: function (x2) {
890 this._x2 = x2;
891 this._segmentChanged();
892 },
893 enumerable: true,
894 });
895 Object.defineProperty(window.SVGPathSegCurvetoCubicSmoothRel.prototype, "y2", {
896 get: function () {
897 return this._y2;
898 },
899 set: function (y2) {
900 this._y2 = y2;
901 this._segmentChanged();
902 },
903 enumerable: true,
904 });
905 window.SVGPathSegCurvetoQuadraticSmoothAbs = function (owningPathSegList, x, y) {
906 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, "T", owningPathSegList);
907 this._x = x;
908 this._y = y;
909 };
910 window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype = Object.create(window.SVGPathSeg.prototype);
911 window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString = function () {
912 return "[object SVGPathSegCurvetoQuadraticSmoothAbs]";
913 };
914 window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString = function () {
915 return this.pathSegTypeAsLetter + " " + this._x + " " + this._y;
916 };
917 window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone = function () {
918 return new window.SVGPathSegCurvetoQuadraticSmoothAbs(undefined, this._x, this._y);
919 };
920 Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype, "x", {
921 get: function () {
922 return this._x;
923 },
924 set: function (x) {
925 this._x = x;
926 this._segmentChanged();
927 },
928 enumerable: true,
929 });
930 Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothAbs.prototype, "y", {
931 get: function () {
932 return this._y;
933 },
934 set: function (y) {
935 this._y = y;
936 this._segmentChanged();
937 },
938 enumerable: true,
939 });
940 window.SVGPathSegCurvetoQuadraticSmoothRel = function (owningPathSegList, x, y) {
941 window.SVGPathSeg.call(this, window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "t", owningPathSegList);
942 this._x = x;
943 this._y = y;
944 };
945 window.SVGPathSegCurvetoQuadraticSmoothRel.prototype = Object.create(window.SVGPathSeg.prototype);
946 window.SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString = function () {
947 return "[object SVGPathSegCurvetoQuadraticSmoothRel]";
948 };
949 window.SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString = function () {
950 return this.pathSegTypeAsLetter + " " + this._x + " " + this._y;
951 };
952 window.SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone = function () {
953 return new window.SVGPathSegCurvetoQuadraticSmoothRel(undefined, this._x, this._y);
954 };
955 Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype, "x", {
956 get: function () {
957 return this._x;
958 },
959 set: function (x) {
960 this._x = x;
961 this._segmentChanged();
962 },
963 enumerable: true,
964 });
965 Object.defineProperty(window.SVGPathSegCurvetoQuadraticSmoothRel.prototype, "y", {
966 get: function () {
967 return this._y;
968 },
969 set: function (y) {
970 this._y = y;
971 this._segmentChanged();
972 },
973 enumerable: true,
974 });
975 window.SVGPathElement.prototype.createSVGPathSegClosePath = function () {
976 return new window.SVGPathSegClosePath(undefined);
977 };
978 window.SVGPathElement.prototype.createSVGPathSegMovetoAbs = function (x, y) {
979 return new window.SVGPathSegMovetoAbs(undefined, x, y);
980 };
981 window.SVGPathElement.prototype.createSVGPathSegMovetoRel = function (x, y) {
982 return new window.SVGPathSegMovetoRel(undefined, x, y);
983 };
984 window.SVGPathElement.prototype.createSVGPathSegLinetoAbs = function (x, y) {
985 return new window.SVGPathSegLinetoAbs(undefined, x, y);
986 };
987 window.SVGPathElement.prototype.createSVGPathSegLinetoRel = function (x, y) {
988 return new window.SVGPathSegLinetoRel(undefined, x, y);
989 };
990 window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs = function (x, y, x1, y1, x2, y2) {
991 return new window.SVGPathSegCurvetoCubicAbs(undefined, x, y, x1, y1, x2, y2);
992 };
993 window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel = function (x, y, x1, y1, x2, y2) {
994 return new window.SVGPathSegCurvetoCubicRel(undefined, x, y, x1, y1, x2, y2);
995 };
996 window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs = function (x, y, x1, y1) {
997 return new window.SVGPathSegCurvetoQuadraticAbs(undefined, x, y, x1, y1);
998 };
999 window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel = function (x, y, x1, y1) {
1000 return new window.SVGPathSegCurvetoQuadraticRel(undefined, x, y, x1, y1);
1001 };
1002 window.SVGPathElement.prototype.createSVGPathSegArcAbs = function (x, y, r1, r2, angle, largeArcFlag, sweepFlag) {
1003 return new window.SVGPathSegArcAbs(undefined, x, y, r1, r2, angle, largeArcFlag, sweepFlag);
1004 };
1005 window.SVGPathElement.prototype.createSVGPathSegArcRel = function (x, y, r1, r2, angle, largeArcFlag, sweepFlag) {
1006 return new window.SVGPathSegArcRel(undefined, x, y, r1, r2, angle, largeArcFlag, sweepFlag);
1007 };
1008 window.SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs = function (x) {
1009 return new window.SVGPathSegLinetoHorizontalAbs(undefined, x);
1010 };
1011 window.SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel = function (x) {
1012 return new window.SVGPathSegLinetoHorizontalRel(undefined, x);
1013 };
1014 window.SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs = function (y) {
1015 return new window.SVGPathSegLinetoVerticalAbs(undefined, y);
1016 };
1017 window.SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel = function (y) {
1018 return new window.SVGPathSegLinetoVerticalRel(undefined, y);
1019 };
1020 window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs = function (x, y, x2, y2) {
1021 return new window.SVGPathSegCurvetoCubicSmoothAbs(undefined, x, y, x2, y2);
1022 };
1023 window.SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel = function (x, y, x2, y2) {
1024 return new window.SVGPathSegCurvetoCubicSmoothRel(undefined, x, y, x2, y2);
1025 };
1026 window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs = function (x, y) {
1027 return new window.SVGPathSegCurvetoQuadraticSmoothAbs(undefined, x, y);
1028 };
1029 window.SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel = function (x, y) {
1030 return new window.SVGPathSegCurvetoQuadraticSmoothRel(undefined, x, y);
1031 };
1032 if (!("getPathSegAtLength" in window.SVGPathElement.prototype)) {
1033 window.SVGPathElement.prototype.getPathSegAtLength = function (distance) {
1034 if (distance === undefined || !isFinite(distance))
1035 throw "Invalid arguments.";
1036 var measurementElement = document.createElementNS("http://www.w3.org/2000/svg", "path");
1037 measurementElement.setAttribute("d", this.getAttribute("d"));
1038 var lastPathSegment = measurementElement.pathSegList.numberOfItems - 1;
1039 if (lastPathSegment <= 0)
1040 return 0;
1041 do {
1042 measurementElement.pathSegList.removeItem(lastPathSegment);
1043 if (distance > measurementElement.getTotalLength())
1044 break;
1045 lastPathSegment--;
1046 } while (lastPathSegment > 0);
1047 return lastPathSegment;
1048 };
1049 }
1050 }
1051 if (!("SVGPathSegList" in window) || !("appendItem" in window.SVGPathSegList.prototype)) {
1052 window.SVGPathSegList = function (pathElement) {
1053 this._pathElement = pathElement;
1054 this._list = this._parsePath(this._pathElement.getAttribute("d"));
1055 this._mutationObserverConfig = { attributes: true, attributeFilter: ["d"] };
1056 this._pathElementMutationObserver = new MutationObserver(this._updateListFromPathMutations.bind(this));
1057 this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);
1058 };
1059 window.SVGPathSegList.prototype.classname = "SVGPathSegList";
1060 Object.defineProperty(window.SVGPathSegList.prototype, "numberOfItems", {
1061 get: function () {
1062 this._checkPathSynchronizedToList();
1063 return this._list.length;
1064 },
1065 enumerable: true,
1066 });
1067 Object.defineProperty(window.SVGPathSegList.prototype, "length", {
1068 get: function () {
1069 this._checkPathSynchronizedToList();
1070 return this._list.length;
1071 },
1072 enumerable: true,
1073 });
1074 Object.defineProperty(window.SVGPathElement.prototype, "pathSegList", {
1075 get: function () {
1076 if (!this._pathSegList)
1077 this._pathSegList = new window.SVGPathSegList(this);
1078 return this._pathSegList;
1079 },
1080 enumerable: true,
1081 });
1082 Object.defineProperty(window.SVGPathElement.prototype, "normalizedPathSegList", {
1083 get: function () {
1084 return this.pathSegList;
1085 },
1086 enumerable: true,
1087 });
1088 Object.defineProperty(window.SVGPathElement.prototype, "animatedPathSegList", {
1089 get: function () {
1090 return this.pathSegList;
1091 },
1092 enumerable: true,
1093 });
1094 Object.defineProperty(window.SVGPathElement.prototype, "animatedNormalizedPathSegList", {
1095 get: function () {
1096 return this.pathSegList;
1097 },
1098 enumerable: true,
1099 });
1100 window.SVGPathSegList.prototype._checkPathSynchronizedToList = function () {
1101 this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords());
1102 };
1103 window.SVGPathSegList.prototype._updateListFromPathMutations = function (mutationRecords) {
1104 if (!this._pathElement)
1105 return;
1106 var hasPathMutations = false;
1107 mutationRecords.forEach(function (record) {
1108 if (record.attributeName == "d")
1109 hasPathMutations = true;
1110 });
1111 if (hasPathMutations)
1112 this._list = this._parsePath(this._pathElement.getAttribute("d"));
1113 };
1114 window.SVGPathSegList.prototype._writeListToPath = function () {
1115 this._pathElementMutationObserver.disconnect();
1116 this._pathElement.setAttribute("d", window.SVGPathSegList._pathSegArrayAsString(this._list));
1117 this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);
1118 };
1119 window.SVGPathSegList.prototype.segmentChanged = function (pathSeg) {
1120 this._writeListToPath();
1121 };
1122 window.SVGPathSegList.prototype.clear = function () {
1123 this._checkPathSynchronizedToList();
1124 this._list.forEach(function (pathSeg) {
1125 pathSeg._owningPathSegList = null;
1126 });
1127 this._list = [];
1128 this._writeListToPath();
1129 };
1130 window.SVGPathSegList.prototype.initialize = function (newItem) {
1131 this._checkPathSynchronizedToList();
1132 this._list = [newItem];
1133 newItem._owningPathSegList = this;
1134 this._writeListToPath();
1135 return newItem;
1136 };
1137 window.SVGPathSegList.prototype._checkValidIndex = function (index) {
1138 if (isNaN(index) || index < 0 || index >= this.numberOfItems)
1139 throw "INDEX_SIZE_ERR";
1140 };
1141 window.SVGPathSegList.prototype.getItem = function (index) {
1142 this._checkPathSynchronizedToList();
1143 this._checkValidIndex(index);
1144 return this._list[index];
1145 };
1146 window.SVGPathSegList.prototype.insertItemBefore = function (newItem, index) {
1147 this._checkPathSynchronizedToList();
1148 if (index > this.numberOfItems)
1149 index = this.numberOfItems;
1150 if (newItem._owningPathSegList) {
1151 newItem = newItem.clone();
1152 }
1153 this._list.splice(index, 0, newItem);
1154 newItem._owningPathSegList = this;
1155 this._writeListToPath();
1156 return newItem;
1157 };
1158 window.SVGPathSegList.prototype.replaceItem = function (newItem, index) {
1159 this._checkPathSynchronizedToList();
1160 if (newItem._owningPathSegList) {
1161 newItem = newItem.clone();
1162 }
1163 this._checkValidIndex(index);
1164 this._list[index] = newItem;
1165 newItem._owningPathSegList = this;
1166 this._writeListToPath();
1167 return newItem;
1168 };
1169 window.SVGPathSegList.prototype.removeItem = function (index) {
1170 this._checkPathSynchronizedToList();
1171 this._checkValidIndex(index);
1172 var item = this._list[index];
1173 this._list.splice(index, 1);
1174 this._writeListToPath();
1175 return item;
1176 };
1177 window.SVGPathSegList.prototype.appendItem = function (newItem) {
1178 this._checkPathSynchronizedToList();
1179 if (newItem._owningPathSegList) {
1180 newItem = newItem.clone();
1181 }
1182 this._list.push(newItem);
1183 newItem._owningPathSegList = this;
1184 this._writeListToPath();
1185 return newItem;
1186 };
1187 window.SVGPathSegList._pathSegArrayAsString = function (pathSegArray) {
1188 var string = "";
1189 var first = true;
1190 pathSegArray.forEach(function (pathSeg) {
1191 if (first) {
1192 first = false;
1193 string += pathSeg._asPathString();
1194 }
1195 else {
1196 string += " " + pathSeg._asPathString();
1197 }
1198 });
1199 return string;
1200 };
1201 window.SVGPathSegList.prototype._parsePath = function (string) {
1202 if (!string || string.length == 0)
1203 return [];
1204 var owningPathSegList = this;
1205 var Builder = function () {
1206 this.pathSegList = [];
1207 };
1208 Builder.prototype.appendSegment = function (pathSeg) {
1209 this.pathSegList.push(pathSeg);
1210 };
1211 var Source = function (string) {
1212 this._string = string;
1213 this._currentIndex = 0;
1214 this._endIndex = this._string.length;
1215 this._previousCommand = window.SVGPathSeg.PATHSEG_UNKNOWN;
1216 this._skipOptionalSpaces();
1217 };
1218 Source.prototype._isCurrentSpace = function () {
1219 var character = this._string[this._currentIndex];
1220 return (character <= " " &&
1221 (character == " " || character == "\n" || character == "\t" || character == "\r" || character == "\f"));
1222 };
1223 Source.prototype._skipOptionalSpaces = function () {
1224 while (this._currentIndex < this._endIndex && this._isCurrentSpace())
1225 this._currentIndex++;
1226 return this._currentIndex < this._endIndex;
1227 };
1228 Source.prototype._skipOptionalSpacesOrDelimiter = function () {
1229 if (this._currentIndex < this._endIndex &&
1230 !this._isCurrentSpace() &&
1231 this._string.charAt(this._currentIndex) != ",")
1232 return false;
1233 if (this._skipOptionalSpaces()) {
1234 if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == ",") {
1235 this._currentIndex++;
1236 this._skipOptionalSpaces();
1237 }
1238 }
1239 return this._currentIndex < this._endIndex;
1240 };
1241 Source.prototype.hasMoreData = function () {
1242 return this._currentIndex < this._endIndex;
1243 };
1244 Source.prototype.peekSegmentType = function () {
1245 var lookahead = this._string[this._currentIndex];
1246 return this._pathSegTypeFromChar(lookahead);
1247 };
1248 Source.prototype._pathSegTypeFromChar = function (lookahead) {
1249 switch (lookahead) {
1250 case "Z":
1251 case "z":
1252 return window.SVGPathSeg.PATHSEG_CLOSEPATH;
1253 case "M":
1254 return window.SVGPathSeg.PATHSEG_MOVETO_ABS;
1255 case "m":
1256 return window.SVGPathSeg.PATHSEG_MOVETO_REL;
1257 case "L":
1258 return window.SVGPathSeg.PATHSEG_LINETO_ABS;
1259 case "l":
1260 return window.SVGPathSeg.PATHSEG_LINETO_REL;
1261 case "C":
1262 return window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS;
1263 case "c":
1264 return window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL;
1265 case "Q":
1266 return window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;
1267 case "q":
1268 return window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;
1269 case "A":
1270 return window.SVGPathSeg.PATHSEG_ARC_ABS;
1271 case "a":
1272 return window.SVGPathSeg.PATHSEG_ARC_REL;
1273 case "H":
1274 return window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;
1275 case "h":
1276 return window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;
1277 case "V":
1278 return window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;
1279 case "v":
1280 return window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;
1281 case "S":
1282 return window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
1283 case "s":
1284 return window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
1285 case "T":
1286 return window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
1287 case "t":
1288 return window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
1289 default:
1290 return window.SVGPathSeg.PATHSEG_UNKNOWN;
1291 }
1292 };
1293 Source.prototype._nextCommandHelper = function (lookahead, previousCommand) {
1294 if ((lookahead == "+" || lookahead == "-" || lookahead == "." || (lookahead >= "0" && lookahead <= "9")) &&
1295 previousCommand != window.SVGPathSeg.PATHSEG_CLOSEPATH) {
1296 if (previousCommand == window.SVGPathSeg.PATHSEG_MOVETO_ABS)
1297 return window.SVGPathSeg.PATHSEG_LINETO_ABS;
1298 if (previousCommand == window.SVGPathSeg.PATHSEG_MOVETO_REL)
1299 return window.SVGPathSeg.PATHSEG_LINETO_REL;
1300 return previousCommand;
1301 }
1302 return window.SVGPathSeg.PATHSEG_UNKNOWN;
1303 };
1304 Source.prototype.initialCommandIsMoveTo = function () {
1305 if (!this.hasMoreData())
1306 return true;
1307 var command = this.peekSegmentType();
1308 return command == window.SVGPathSeg.PATHSEG_MOVETO_ABS || command == window.SVGPathSeg.PATHSEG_MOVETO_REL;
1309 };
1310 Source.prototype._parseNumber = function () {
1311 var exponent = 0;
1312 var integer = 0;
1313 var frac = 1;
1314 var decimal = 0;
1315 var sign = 1;
1316 var expsign = 1;
1317 var startIndex = this._currentIndex;
1318 this._skipOptionalSpaces();
1319 if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == "+")
1320 this._currentIndex++;
1321 else if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == "-") {
1322 this._currentIndex++;
1323 sign = -1;
1324 }
1325 if (this._currentIndex == this._endIndex ||
1326 ((this._string.charAt(this._currentIndex) < "0" || this._string.charAt(this._currentIndex) > "9") &&
1327 this._string.charAt(this._currentIndex) != "."))
1328 return undefined;
1329 var startIntPartIndex = this._currentIndex;
1330 while (this._currentIndex < this._endIndex &&
1331 this._string.charAt(this._currentIndex) >= "0" &&
1332 this._string.charAt(this._currentIndex) <= "9")
1333 this._currentIndex++;
1334 if (this._currentIndex != startIntPartIndex) {
1335 var scanIntPartIndex = this._currentIndex - 1;
1336 var multiplier = 1;
1337 while (scanIntPartIndex >= startIntPartIndex) {
1338 integer += multiplier * (this._string.charAt(scanIntPartIndex--) - "0");
1339 multiplier *= 10;
1340 }
1341 }
1342 if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == ".") {
1343 this._currentIndex++;
1344 if (this._currentIndex >= this._endIndex ||
1345 this._string.charAt(this._currentIndex) < "0" ||
1346 this._string.charAt(this._currentIndex) > "9")
1347 return undefined;
1348 while (this._currentIndex < this._endIndex &&
1349 this._string.charAt(this._currentIndex) >= "0" &&
1350 this._string.charAt(this._currentIndex) <= "9") {
1351 frac *= 10;
1352 decimal += (this._string.charAt(this._currentIndex) - "0") / frac;
1353 this._currentIndex += 1;
1354 }
1355 }
1356 if (this._currentIndex != startIndex &&
1357 this._currentIndex + 1 < this._endIndex &&
1358 (this._string.charAt(this._currentIndex) == "e" || this._string.charAt(this._currentIndex) == "E") &&
1359 this._string.charAt(this._currentIndex + 1) != "x" &&
1360 this._string.charAt(this._currentIndex + 1) != "m") {
1361 this._currentIndex++;
1362 if (this._string.charAt(this._currentIndex) == "+") {
1363 this._currentIndex++;
1364 }
1365 else if (this._string.charAt(this._currentIndex) == "-") {
1366 this._currentIndex++;
1367 expsign = -1;
1368 }
1369 if (this._currentIndex >= this._endIndex ||
1370 this._string.charAt(this._currentIndex) < "0" ||
1371 this._string.charAt(this._currentIndex) > "9")
1372 return undefined;
1373 while (this._currentIndex < this._endIndex &&
1374 this._string.charAt(this._currentIndex) >= "0" &&
1375 this._string.charAt(this._currentIndex) <= "9") {
1376 exponent *= 10;
1377 exponent += this._string.charAt(this._currentIndex) - "0";
1378 this._currentIndex++;
1379 }
1380 }
1381 var number = integer + decimal;
1382 number *= sign;
1383 if (exponent)
1384 number *= Math.pow(10, expsign * exponent);
1385 if (startIndex == this._currentIndex)
1386 return undefined;
1387 this._skipOptionalSpacesOrDelimiter();
1388 return number;
1389 };
1390 Source.prototype._parseArcFlag = function () {
1391 if (this._currentIndex >= this._endIndex)
1392 return undefined;
1393 var flag = false;
1394 var flagChar = this._string.charAt(this._currentIndex++);
1395 if (flagChar == "0")
1396 flag = false;
1397 else if (flagChar == "1")
1398 flag = true;
1399 else
1400 return undefined;
1401 this._skipOptionalSpacesOrDelimiter();
1402 return flag;
1403 };
1404 Source.prototype.parseSegment = function () {
1405 var lookahead = this._string[this._currentIndex];
1406 var command = this._pathSegTypeFromChar(lookahead);
1407 if (command == window.SVGPathSeg.PATHSEG_UNKNOWN) {
1408 if (this._previousCommand == window.SVGPathSeg.PATHSEG_UNKNOWN)
1409 return null;
1410 command = this._nextCommandHelper(lookahead, this._previousCommand);
1411 if (command == window.SVGPathSeg.PATHSEG_UNKNOWN)
1412 return null;
1413 }
1414 else {
1415 this._currentIndex++;
1416 }
1417 this._previousCommand = command;
1418 switch (command) {
1419 case window.SVGPathSeg.PATHSEG_MOVETO_REL:
1420 return new window.SVGPathSegMovetoRel(owningPathSegList, this._parseNumber(), this._parseNumber());
1421 case window.SVGPathSeg.PATHSEG_MOVETO_ABS:
1422 return new window.SVGPathSegMovetoAbs(owningPathSegList, this._parseNumber(), this._parseNumber());
1423 case window.SVGPathSeg.PATHSEG_LINETO_REL:
1424 return new window.SVGPathSegLinetoRel(owningPathSegList, this._parseNumber(), this._parseNumber());
1425 case window.SVGPathSeg.PATHSEG_LINETO_ABS:
1426 return new window.SVGPathSegLinetoAbs(owningPathSegList, this._parseNumber(), this._parseNumber());
1427 case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:
1428 return new window.SVGPathSegLinetoHorizontalRel(owningPathSegList, this._parseNumber());
1429 case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:
1430 return new window.SVGPathSegLinetoHorizontalAbs(owningPathSegList, this._parseNumber());
1431 case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:
1432 return new window.SVGPathSegLinetoVerticalRel(owningPathSegList, this._parseNumber());
1433 case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:
1434 return new window.SVGPathSegLinetoVerticalAbs(owningPathSegList, this._parseNumber());
1435 case window.SVGPathSeg.PATHSEG_CLOSEPATH:
1436 this._skipOptionalSpaces();
1437 return new window.SVGPathSegClosePath(owningPathSegList);
1438 case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
1439 var points = {
1440 x1: this._parseNumber(),
1441 y1: this._parseNumber(),
1442 x2: this._parseNumber(),
1443 y2: this._parseNumber(),
1444 x: this._parseNumber(),
1445 y: this._parseNumber(),
1446 };
1447 return new window.SVGPathSegCurvetoCubicRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2);
1448 case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
1449 var points = {
1450 x1: this._parseNumber(),
1451 y1: this._parseNumber(),
1452 x2: this._parseNumber(),
1453 y2: this._parseNumber(),
1454 x: this._parseNumber(),
1455 y: this._parseNumber(),
1456 };
1457 return new window.SVGPathSegCurvetoCubicAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2);
1458 case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
1459 var points = {
1460 x2: this._parseNumber(),
1461 y2: this._parseNumber(),
1462 x: this._parseNumber(),
1463 y: this._parseNumber(),
1464 };
1465 return new window.SVGPathSegCurvetoCubicSmoothRel(owningPathSegList, points.x, points.y, points.x2, points.y2);
1466 case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
1467 var points = {
1468 x2: this._parseNumber(),
1469 y2: this._parseNumber(),
1470 x: this._parseNumber(),
1471 y: this._parseNumber(),
1472 };
1473 return new window.SVGPathSegCurvetoCubicSmoothAbs(owningPathSegList, points.x, points.y, points.x2, points.y2);
1474 case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:
1475 var points = {
1476 x1: this._parseNumber(),
1477 y1: this._parseNumber(),
1478 x: this._parseNumber(),
1479 y: this._parseNumber(),
1480 };
1481 return new window.SVGPathSegCurvetoQuadraticRel(owningPathSegList, points.x, points.y, points.x1, points.y1);
1482 case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
1483 var points = {
1484 x1: this._parseNumber(),
1485 y1: this._parseNumber(),
1486 x: this._parseNumber(),
1487 y: this._parseNumber(),
1488 };
1489 return new window.SVGPathSegCurvetoQuadraticAbs(owningPathSegList, points.x, points.y, points.x1, points.y1);
1490 case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
1491 return new window.SVGPathSegCurvetoQuadraticSmoothRel(owningPathSegList, this._parseNumber(), this._parseNumber());
1492 case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
1493 return new window.SVGPathSegCurvetoQuadraticSmoothAbs(owningPathSegList, this._parseNumber(), this._parseNumber());
1494 case window.SVGPathSeg.PATHSEG_ARC_REL:
1495 var points = {
1496 x1: this._parseNumber(),
1497 y1: this._parseNumber(),
1498 arcAngle: this._parseNumber(),
1499 arcLarge: this._parseArcFlag(),
1500 arcSweep: this._parseArcFlag(),
1501 x: this._parseNumber(),
1502 y: this._parseNumber(),
1503 };
1504 return new window.SVGPathSegArcRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep);
1505 case window.SVGPathSeg.PATHSEG_ARC_ABS:
1506 var points = {
1507 x1: this._parseNumber(),
1508 y1: this._parseNumber(),
1509 arcAngle: this._parseNumber(),
1510 arcLarge: this._parseArcFlag(),
1511 arcSweep: this._parseArcFlag(),
1512 x: this._parseNumber(),
1513 y: this._parseNumber(),
1514 };
1515 return new window.SVGPathSegArcAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep);
1516 default:
1517 throw "Unknown path seg type.";
1518 }
1519 };
1520 var builder = new Builder();
1521 var source = new Source(string);
1522 if (!source.initialCommandIsMoveTo())
1523 return [];
1524 while (source.hasMoreData()) {
1525 var pathSeg = source.parseSegment();
1526 if (!pathSeg)
1527 return [];
1528 builder.appendSegment(pathSeg);
1529 }
1530 return builder.pathSegList;
1531 };
1532 }
1533 }
1534 catch (e) {
1535 console.warn("An error occurred in tsParticles pathseg polyfill. If the Polygon Mask is not working, please open an issue here: https://github.com/matteobruni/tsparticles", e);
1536 }
1537})();