path2d-polyfill 1.2.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,23 +1,32 @@
1
1
  {
2
2
  "name": "path2d-polyfill",
3
- "version": "1.2.3",
3
+ "version": "2.0.0",
4
4
  "description": "Polyfills Path2D api for canvas rendering",
5
5
  "scripts": {
6
6
  "build": "rm -rf dist/* && rollup -c",
7
7
  "start": "rollup -c -w",
8
- "lint": "eslint src test",
9
- "test": "nyc --reporter=html --reporter=text mocha",
8
+ "lint": "eslint .",
9
+ "check-types": "tsc --noEmit",
10
+ "test": "ts-mocha test/*.spec.ts",
11
+ "test:watch": "ts-mocha --watch test/*.spec.ts",
12
+ "test:coverage": "nyc --reporter=html --reporter=text --reporter=text-summary yarn test",
10
13
  "format:check": "prettier --check \"./**\"",
11
14
  "format:write": "prettier --write \"./**\"",
12
15
  "prepare": "husky install",
13
16
  "release": "release-it"
14
17
  },
18
+ "exports": {
19
+ "node": {
20
+ "import": "./dist/path2d-node.mjs",
21
+ "require": "./dist/path2d-node.cjs"
22
+ },
23
+ "development": "./dist/path2d-polyfill.dev.js",
24
+ "module": "./dist/path2d-polyfill.esm.js",
25
+ "default": "./dist/path2d-polyfill.min.js"
26
+ },
15
27
  "files": [
16
- "/dist",
17
- "/src"
28
+ "dist"
18
29
  ],
19
- "main": "dist/index.js",
20
- "module": "dist/index.esm.js",
21
30
  "repository": {
22
31
  "type": "git",
23
32
  "url": "git+https://github.com/nilzona/path2d-polyfill.git"
@@ -25,7 +34,8 @@
25
34
  "keywords": [
26
35
  "Path2D",
27
36
  "polyfill",
28
- "canvas"
37
+ "canvas",
38
+ "roundRect"
29
39
  ],
30
40
  "author": "nilzona",
31
41
  "license": "MIT",
@@ -34,29 +44,36 @@
34
44
  },
35
45
  "homepage": "https://github.com/nilzona/path2d-polyfill#readme",
36
46
  "devDependencies": {
37
- "@babel/core": "^7.19.3",
38
- "@babel/preset-env": "^7.19.4",
39
- "@commitlint/cli": "^17.1.2",
40
- "@commitlint/config-conventional": "^17.1.0",
41
- "@release-it/conventional-changelog": "^5.1.1",
42
- "@rollup/plugin-babel": "^6.0.0",
43
- "@rollup/plugin-commonjs": "^23.0.0",
44
- "chai": "^4.3.6",
45
- "eslint": "^8.25.0",
46
- "eslint-config-prettier": "^8.5.0",
47
- "eslint-plugin-prettier": "^4.2.1",
48
- "husky": "^8.0.1",
49
- "lint-staged": "^13.0.3",
50
- "mocha": "^10.0.0",
51
- "nyc": "^15.1.0",
52
- "prettier": "^2.7.1",
53
- "release-it": "^15.5.0",
54
- "rollup": "^2.79.1",
55
- "rollup-plugin-livereload": "^2.0.5",
56
- "rollup-plugin-serve": "^2.0.1",
57
- "rollup-plugin-terser": "7.0.2",
58
- "sinon": "^14.0.1",
59
- "sinon-chai": "^3.7.0"
47
+ "@commitlint/cli": "17.3.0",
48
+ "@commitlint/config-conventional": "17.3.0",
49
+ "@release-it/conventional-changelog": "5.1.1",
50
+ "@rollup/plugin-terser": "0.2.1",
51
+ "@rollup/plugin-typescript": "10.0.1",
52
+ "@types/chai": "^4.3.4",
53
+ "@types/mocha": "^10.0.1",
54
+ "@types/sinon": "^10.0.13",
55
+ "@types/sinon-chai": "^3.2.9",
56
+ "@typescript-eslint/eslint-plugin": "5.48.0",
57
+ "@typescript-eslint/parser": "5.48.0",
58
+ "chai": "4.3.7",
59
+ "eslint": "8.31.0",
60
+ "eslint-config-prettier": "8.6.0",
61
+ "husky": "8.0.2",
62
+ "lint-staged": "13.1.0",
63
+ "mocha": "10.2.0",
64
+ "nyc": "15.1.0",
65
+ "prettier": "2.8.1",
66
+ "release-it": "15.6.0",
67
+ "rollup": "3.9.1",
68
+ "rollup-plugin-livereload": "2.0.5",
69
+ "rollup-plugin-serve": "2.0.2",
70
+ "sinon": "15.0.1",
71
+ "sinon-chai": "3.7.0",
72
+ "ts-mocha": "^10.0.0",
73
+ "typescript": "^4.9.4"
60
74
  },
61
- "dependencies": {}
75
+ "dependencies": {},
76
+ "engines": {
77
+ "node": ">=8"
78
+ }
62
79
  }
package/dist/index.esm.js DELETED
@@ -1,571 +0,0 @@
1
- var ARG_LENGTH = {
2
- a: 7,
3
- c: 6,
4
- h: 1,
5
- l: 2,
6
- m: 2,
7
- q: 4,
8
- s: 4,
9
- t: 2,
10
- v: 1,
11
- z: 0
12
- };
13
- var SEGMENT_PATTERN = /([astvzqmhlc])([^astvzqmhlc]*)/gi;
14
- var NUMBER = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;
15
- function parseValues(args) {
16
- var numbers = args.match(NUMBER);
17
- return numbers ? numbers.map(Number) : [];
18
- }
19
-
20
- /**
21
- * parse an svg path data string. Generates an Array
22
- * of commands where each command is an Array of the
23
- * form `[command, arg1, arg2, ...]`
24
- *
25
- * https://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation
26
- * @ignore
27
- *
28
- * @param {string} path
29
- * @returns {array}
30
- */
31
- function parse(path) {
32
- var data = [];
33
- var p = String(path).trim();
34
-
35
- // A path data segment (if there is one) must begin with a "moveto" command
36
- if (p[0] !== "M" && p[0] !== "m") {
37
- return data;
38
- }
39
- p.replace(SEGMENT_PATTERN, function (_, command, args) {
40
- var type = command.toLowerCase();
41
- var theArgs = parseValues(args);
42
- var theCommand = command;
43
- // overloaded moveTo
44
- if (type === "m" && theArgs.length > 2) {
45
- data.push([theCommand].concat(theArgs.splice(0, 2)));
46
- type = "l";
47
- theCommand = theCommand === "m" ? "l" : "L";
48
- }
49
-
50
- // Ignore invalid commands
51
- if (theArgs.length < ARG_LENGTH[type]) {
52
- return "";
53
- }
54
- data.push([theCommand].concat(theArgs.splice(0, ARG_LENGTH[type])));
55
-
56
- // The command letter can be eliminated on subsequent commands if the
57
- // same command is used multiple times in a row (e.g., you can drop the
58
- // second "L" in "M 100 200 L 200 100 L -100 -200" and use
59
- // "M 100 200 L 200 100 -100 -200" instead).
60
- while (theArgs.length >= ARG_LENGTH[type] && theArgs.length && ARG_LENGTH[type]) {
61
- data.push([theCommand].concat(theArgs.splice(0, ARG_LENGTH[type])));
62
- }
63
- return "";
64
- });
65
- return data;
66
- }
67
- var parsePath$2 = parse;
68
-
69
- function _classCallCheck(instance, Constructor) {
70
- if (!(instance instanceof Constructor)) {
71
- throw new TypeError("Cannot call a class as a function");
72
- }
73
- }
74
- function _defineProperties(target, props) {
75
- for (var i = 0; i < props.length; i++) {
76
- var descriptor = props[i];
77
- descriptor.enumerable = descriptor.enumerable || false;
78
- descriptor.configurable = true;
79
- if ("value" in descriptor) descriptor.writable = true;
80
- Object.defineProperty(target, descriptor.key, descriptor);
81
- }
82
- }
83
- function _createClass(Constructor, protoProps, staticProps) {
84
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
85
- if (staticProps) _defineProperties(Constructor, staticProps);
86
- Object.defineProperty(Constructor, "prototype", {
87
- writable: false
88
- });
89
- return Constructor;
90
- }
91
- function _toConsumableArray(arr) {
92
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
93
- }
94
- function _arrayWithoutHoles(arr) {
95
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
96
- }
97
- function _iterableToArray(iter) {
98
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
99
- }
100
- function _unsupportedIterableToArray(o, minLen) {
101
- if (!o) return;
102
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
103
- var n = Object.prototype.toString.call(o).slice(8, -1);
104
- if (n === "Object" && o.constructor) n = o.constructor.name;
105
- if (n === "Map" || n === "Set") return Array.from(o);
106
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
107
- }
108
- function _arrayLikeToArray(arr, len) {
109
- if (len == null || len > arr.length) len = arr.length;
110
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
111
- return arr2;
112
- }
113
- function _nonIterableSpread() {
114
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
115
- }
116
-
117
- var parsePath$1 = parsePath$2;
118
-
119
- /**
120
- * Work around for https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8438884/
121
- * @ignore
122
- */
123
- function supportsSvgPathArgument(window) {
124
- var canvas = window.document.createElement("canvas");
125
- var g = canvas.getContext("2d");
126
- var p = new window.Path2D("M0 0 L1 1");
127
- g.strokeStyle = "red";
128
- g.lineWidth = 1;
129
- g.stroke(p);
130
- var imgData = g.getImageData(0, 0, 1, 1);
131
- return imgData.data[0] === 255; // Check if pixel is red
132
- }
133
-
134
- function rotatePoint(point, angle) {
135
- var nx = point.x * Math.cos(angle) - point.y * Math.sin(angle);
136
- var ny = point.y * Math.cos(angle) + point.x * Math.sin(angle);
137
- point.x = nx;
138
- point.y = ny;
139
- }
140
- function translatePoint(point, dx, dy) {
141
- point.x += dx;
142
- point.y += dy;
143
- }
144
- function scalePoint(point, s) {
145
- point.x *= s;
146
- point.y *= s;
147
- }
148
- function polyFillPath2D(window) {
149
- if (typeof window === "undefined" || !window.CanvasRenderingContext2D) {
150
- return;
151
- }
152
- if (window.Path2D && supportsSvgPathArgument(window)) {
153
- return;
154
- }
155
-
156
- /**
157
- * Crates a Path2D polyfill object
158
- * @constructor
159
- * @ignore
160
- * @param {String} path
161
- */
162
- var Path2D = /*#__PURE__*/function () {
163
- function Path2D(path) {
164
- _classCallCheck(this, Path2D);
165
- this.segments = [];
166
- if (path && path instanceof Path2D) {
167
- var _this$segments;
168
- (_this$segments = this.segments).push.apply(_this$segments, _toConsumableArray(path.segments));
169
- } else if (path) {
170
- this.segments = parsePath$1(path);
171
- }
172
- }
173
- _createClass(Path2D, [{
174
- key: "addPath",
175
- value: function addPath(path) {
176
- if (path && path instanceof Path2D) {
177
- var _this$segments2;
178
- (_this$segments2 = this.segments).push.apply(_this$segments2, _toConsumableArray(path.segments));
179
- }
180
- }
181
- }, {
182
- key: "moveTo",
183
- value: function moveTo(x, y) {
184
- this.segments.push(["M", x, y]);
185
- }
186
- }, {
187
- key: "lineTo",
188
- value: function lineTo(x, y) {
189
- this.segments.push(["L", x, y]);
190
- }
191
- }, {
192
- key: "arc",
193
- value: function arc(x, y, r, start, end, ccw) {
194
- this.segments.push(["AC", x, y, r, start, end, !!ccw]);
195
- }
196
- }, {
197
- key: "arcTo",
198
- value: function arcTo(x1, y1, x2, y2, r) {
199
- this.segments.push(["AT", x1, y1, x2, y2, r]);
200
- }
201
- }, {
202
- key: "ellipse",
203
- value: function ellipse(x, y, rx, ry, angle, start, end, ccw) {
204
- this.segments.push(["E", x, y, rx, ry, angle, start, end, !!ccw]);
205
- }
206
- }, {
207
- key: "closePath",
208
- value: function closePath() {
209
- this.segments.push(["Z"]);
210
- }
211
- }, {
212
- key: "bezierCurveTo",
213
- value: function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
214
- this.segments.push(["C", cp1x, cp1y, cp2x, cp2y, x, y]);
215
- }
216
- }, {
217
- key: "quadraticCurveTo",
218
- value: function quadraticCurveTo(cpx, cpy, x, y) {
219
- this.segments.push(["Q", cpx, cpy, x, y]);
220
- }
221
- }, {
222
- key: "rect",
223
- value: function rect(x, y, width, height) {
224
- this.segments.push(["R", x, y, width, height]);
225
- }
226
- }]);
227
- return Path2D;
228
- }();
229
- function buildPath(canvas, segments) {
230
- var endAngle;
231
- var startAngle;
232
- var largeArcFlag;
233
- var sweepFlag;
234
- var endPoint;
235
- var midPoint;
236
- var angle;
237
- var lambda;
238
- var t1;
239
- var t2;
240
- var x;
241
- var x1;
242
- var y;
243
- var y1;
244
- var r;
245
- var rx;
246
- var ry;
247
- var w;
248
- var h;
249
- var pathType;
250
- var centerPoint;
251
- var cpx;
252
- var cpy;
253
- var qcpx;
254
- var qcpy;
255
- var ccw;
256
- var startPoint = {
257
- x: 0,
258
- y: 0
259
- };
260
- var currentPoint = {
261
- x: 0,
262
- y: 0
263
- };
264
- canvas.beginPath();
265
- for (var i = 0; i < segments.length; ++i) {
266
- var s = segments[i];
267
- pathType = s[0];
268
-
269
- // Reset control point if command is not cubic
270
- if (pathType !== "S" && pathType !== "s" && pathType !== "C" && pathType !== "c") {
271
- cpx = null;
272
- cpy = null;
273
- }
274
- if (pathType !== "T" && pathType !== "t" && pathType !== "Q" && pathType !== "q") {
275
- qcpx = null;
276
- qcpy = null;
277
- }
278
- switch (pathType) {
279
- case "m":
280
- case "M":
281
- if (pathType === "m") {
282
- x += s[1];
283
- y += s[2];
284
- } else {
285
- x = s[1];
286
- y = s[2];
287
- }
288
- if (pathType === "M" || !startPoint) {
289
- startPoint = {
290
- x: x,
291
- y: y
292
- };
293
- }
294
- canvas.moveTo(x, y);
295
- break;
296
- case "l":
297
- x += s[1];
298
- y += s[2];
299
- canvas.lineTo(x, y);
300
- break;
301
- case "L":
302
- x = s[1];
303
- y = s[2];
304
- canvas.lineTo(x, y);
305
- break;
306
- case "H":
307
- x = s[1];
308
- canvas.lineTo(x, y);
309
- break;
310
- case "h":
311
- x += s[1];
312
- canvas.lineTo(x, y);
313
- break;
314
- case "V":
315
- y = s[1];
316
- canvas.lineTo(x, y);
317
- break;
318
- case "v":
319
- y += s[1];
320
- canvas.lineTo(x, y);
321
- break;
322
- case "a":
323
- case "A":
324
- if (pathType === "a") {
325
- x += s[6];
326
- y += s[7];
327
- } else {
328
- x = s[6];
329
- y = s[7];
330
- }
331
- rx = s[1]; // rx
332
- ry = s[2]; // ry
333
- angle = s[3] * Math.PI / 180;
334
- largeArcFlag = !!s[4];
335
- sweepFlag = !!s[5];
336
- endPoint = {
337
- x: x,
338
- y: y
339
- };
340
-
341
- // https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
342
-
343
- midPoint = {
344
- x: (currentPoint.x - endPoint.x) / 2,
345
- y: (currentPoint.y - endPoint.y) / 2
346
- };
347
- rotatePoint(midPoint, -angle);
348
-
349
- // radius correction
350
- lambda = midPoint.x * midPoint.x / (rx * rx) + midPoint.y * midPoint.y / (ry * ry);
351
- if (lambda > 1) {
352
- lambda = Math.sqrt(lambda);
353
- rx *= lambda;
354
- ry *= lambda;
355
- }
356
- centerPoint = {
357
- x: rx * midPoint.y / ry,
358
- y: -(ry * midPoint.x) / rx
359
- };
360
- t1 = rx * rx * ry * ry;
361
- t2 = rx * rx * midPoint.y * midPoint.y + ry * ry * midPoint.x * midPoint.x;
362
- if (sweepFlag !== largeArcFlag) {
363
- scalePoint(centerPoint, Math.sqrt((t1 - t2) / t2) || 0);
364
- } else {
365
- scalePoint(centerPoint, -Math.sqrt((t1 - t2) / t2) || 0);
366
- }
367
- startAngle = Math.atan2((midPoint.y - centerPoint.y) / ry, (midPoint.x - centerPoint.x) / rx);
368
- endAngle = Math.atan2(-(midPoint.y + centerPoint.y) / ry, -(midPoint.x + centerPoint.x) / rx);
369
- rotatePoint(centerPoint, angle);
370
- translatePoint(centerPoint, (endPoint.x + currentPoint.x) / 2, (endPoint.y + currentPoint.y) / 2);
371
- canvas.save();
372
- canvas.translate(centerPoint.x, centerPoint.y);
373
- canvas.rotate(angle);
374
- canvas.scale(rx, ry);
375
- canvas.arc(0, 0, 1, startAngle, endAngle, !sweepFlag);
376
- canvas.restore();
377
- break;
378
- case "C":
379
- cpx = s[3]; // Last control point
380
- cpy = s[4];
381
- x = s[5];
382
- y = s[6];
383
- canvas.bezierCurveTo(s[1], s[2], cpx, cpy, x, y);
384
- break;
385
- case "c":
386
- canvas.bezierCurveTo(s[1] + x, s[2] + y, s[3] + x, s[4] + y, s[5] + x, s[6] + y);
387
- cpx = s[3] + x; // Last control point
388
- cpy = s[4] + y;
389
- x += s[5];
390
- y += s[6];
391
- break;
392
- case "S":
393
- if (cpx === null || cpy === null) {
394
- cpx = x;
395
- cpy = y;
396
- }
397
- canvas.bezierCurveTo(2 * x - cpx, 2 * y - cpy, s[1], s[2], s[3], s[4]);
398
- cpx = s[1]; // last control point
399
- cpy = s[2];
400
- x = s[3];
401
- y = s[4];
402
- break;
403
- case "s":
404
- if (cpx === null || cpy === null) {
405
- cpx = x;
406
- cpy = y;
407
- }
408
- canvas.bezierCurveTo(2 * x - cpx, 2 * y - cpy, s[1] + x, s[2] + y, s[3] + x, s[4] + y);
409
- cpx = s[1] + x; // last control point
410
- cpy = s[2] + y;
411
- x += s[3];
412
- y += s[4];
413
- break;
414
- case "Q":
415
- qcpx = s[1]; // last control point
416
- qcpy = s[2];
417
- x = s[3];
418
- y = s[4];
419
- canvas.quadraticCurveTo(qcpx, qcpy, x, y);
420
- break;
421
- case "q":
422
- qcpx = s[1] + x; // last control point
423
- qcpy = s[2] + y;
424
- x += s[3];
425
- y += s[4];
426
- canvas.quadraticCurveTo(qcpx, qcpy, x, y);
427
- break;
428
- case "T":
429
- if (qcpx === null || qcpy === null) {
430
- qcpx = x;
431
- qcpy = y;
432
- }
433
- qcpx = 2 * x - qcpx; // last control point
434
- qcpy = 2 * y - qcpy;
435
- x = s[1];
436
- y = s[2];
437
- canvas.quadraticCurveTo(qcpx, qcpy, x, y);
438
- break;
439
- case "t":
440
- if (qcpx === null || qcpy === null) {
441
- qcpx = x;
442
- qcpy = y;
443
- }
444
- qcpx = 2 * x - qcpx; // last control point
445
- qcpy = 2 * y - qcpy;
446
- x += s[1];
447
- y += s[2];
448
- canvas.quadraticCurveTo(qcpx, qcpy, x, y);
449
- break;
450
- case "z":
451
- case "Z":
452
- x = startPoint.x;
453
- y = startPoint.y;
454
- startPoint = undefined;
455
- canvas.closePath();
456
- break;
457
- case "AC":
458
- // arc
459
- x = s[1];
460
- y = s[2];
461
- r = s[3];
462
- startAngle = s[4];
463
- endAngle = s[5];
464
- ccw = s[6];
465
- canvas.arc(x, y, r, startAngle, endAngle, ccw);
466
- break;
467
- case "AT":
468
- // arcTo
469
- x1 = s[1];
470
- y1 = s[2];
471
- x = s[3];
472
- y = s[4];
473
- r = s[5];
474
- canvas.arcTo(x1, y1, x, y, r);
475
- break;
476
- case "E":
477
- // ellipse
478
- x = s[1];
479
- y = s[2];
480
- rx = s[3];
481
- ry = s[4];
482
- angle = s[5];
483
- startAngle = s[6];
484
- endAngle = s[7];
485
- ccw = s[8];
486
- canvas.save();
487
- canvas.translate(x, y);
488
- canvas.rotate(angle);
489
- canvas.scale(rx, ry);
490
- canvas.arc(0, 0, 1, startAngle, endAngle, ccw);
491
- canvas.restore();
492
- break;
493
- case "R":
494
- // rect
495
- x = s[1];
496
- y = s[2];
497
- w = s[3];
498
- h = s[4];
499
- startPoint = {
500
- x: x,
501
- y: y
502
- };
503
- canvas.rect(x, y, w, h);
504
- break;
505
- // throw new Error(`${pathType} is not implemented`); ?
506
- }
507
-
508
- currentPoint.x = x;
509
- currentPoint.y = y;
510
- }
511
- }
512
- var cFill = window.CanvasRenderingContext2D.prototype.fill;
513
- var cStroke = window.CanvasRenderingContext2D.prototype.stroke;
514
- window.CanvasRenderingContext2D.prototype.fill = function fill() {
515
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
516
- args[_key] = arguments[_key];
517
- }
518
- var fillRule = "nonzero";
519
- if (args.length === 0 || args.length === 1 && typeof args[0] === "string") {
520
- cFill.apply(this, args);
521
- return;
522
- }
523
- if (arguments.length === 2) {
524
- fillRule = args[1];
525
- }
526
- var path = args[0];
527
- buildPath(this, path.segments);
528
- cFill.call(this, fillRule);
529
- };
530
- window.CanvasRenderingContext2D.prototype.stroke = function stroke(path) {
531
- if (!path) {
532
- cStroke.call(this);
533
- return;
534
- }
535
- buildPath(this, path.segments);
536
- cStroke.call(this);
537
- };
538
- var cIsPointInPath = window.CanvasRenderingContext2D.prototype.isPointInPath;
539
- window.CanvasRenderingContext2D.prototype.isPointInPath = function isPointInPath() {
540
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
541
- args[_key2] = arguments[_key2];
542
- }
543
- // let fillRule = 'nonzero';
544
- if (args[0].constructor.name === "Path2D") {
545
- // first argument is a Path2D object
546
- var x = args[1];
547
- var y = args[2];
548
- var fillRule = args[3] || "nonzero";
549
- var path = args[0];
550
- buildPath(this, path.segments);
551
- return cIsPointInPath.apply(this, [x, y, fillRule]);
552
- } else {
553
- return cIsPointInPath.apply(this, args);
554
- }
555
- };
556
- window.Path2D = Path2D;
557
- }
558
- var path2dPolyfill$1 = polyFillPath2D;
559
-
560
- var parsePath = parsePath$2;
561
- var path2dPolyfill = path2dPolyfill$1;
562
- if (typeof window !== "undefined") {
563
- path2dPolyfill(window);
564
- }
565
- var src = {
566
- path2dPolyfill: path2dPolyfill,
567
- parsePath: parsePath
568
- };
569
-
570
- export { src as default };
571
- //# sourceMappingURL=index.esm.js.map