jest-canvas-mock 2.4.0 → 2.5.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/CHANGELOG.md +7 -0
- package/README.md +14 -0
- package/lib/classes/CanvasGradient.js +0 -7
- package/lib/classes/CanvasPattern.js +0 -4
- package/lib/classes/CanvasRenderingContext2D.js +21 -334
- package/lib/classes/DOMMatrix.js +9 -64
- package/lib/classes/ImageBitmap.js +3 -9
- package/lib/classes/ImageData.js +3 -11
- package/lib/classes/Path2D.js +3 -14
- package/lib/classes/TextMetrics.js +3 -17
- package/lib/index.js +7 -6
- package/lib/mock/createCanvasEvent.js +0 -1
- package/lib/mock/createImageBitmap.js +2 -12
- package/lib/mock/prototype.js +7 -23
- package/lib/window.js +4 -17
- package/package.json +1 -1
- package/types/index.d.ts +3 -1
|
@@ -4,165 +4,125 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _DOMMatrix = _interopRequireDefault(require("./DOMMatrix"));
|
|
9
|
-
|
|
10
8
|
var _CanvasPattern = _interopRequireDefault(require("./CanvasPattern"));
|
|
11
|
-
|
|
12
9
|
var _cssfontparser = _interopRequireDefault(require("cssfontparser"));
|
|
13
|
-
|
|
14
10
|
var _TextMetrics = _interopRequireDefault(require("./TextMetrics"));
|
|
15
|
-
|
|
16
11
|
var _createCanvasEvent = _interopRequireDefault(require("../mock/createCanvasEvent"));
|
|
17
|
-
|
|
18
12
|
var _Path2D = _interopRequireDefault(require("./Path2D"));
|
|
19
|
-
|
|
20
13
|
var _mooColor = require("moo-color");
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
26
18
|
const testFuncs = ['setLineDash', 'getLineDash', 'setTransform', 'getTransform', 'getImageData', 'save', 'restore', 'createPattern', 'createRadialGradient', 'addHitRegion', 'arc', 'arcTo', 'beginPath', 'clip', 'closePath', 'scale', 'stroke', 'clearHitRegions', 'clearRect', 'fillRect', 'strokeRect', 'rect', 'resetTransform', 'translate', 'moveTo', 'lineTo', 'bezierCurveTo', 'createLinearGradient', 'ellipse', 'measureText', 'rotate', 'drawImage', 'drawFocusIfNeeded', 'isPointInPath', 'isPointInStroke', 'putImageData', 'strokeText', 'fillText', 'quadraticCurveTo', 'removeHitRegion', 'fill', 'transform', 'scrollPathIntoView', 'createImageData'];
|
|
27
19
|
const compositeOperations = ['source-over', 'source-in', 'source-out', 'source-atop', 'destination-over', 'destination-in', 'destination-out', 'destination-atop', 'lighter', 'copy', 'xor', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'];
|
|
28
|
-
|
|
29
20
|
function getTransformSlice(ctx) {
|
|
30
21
|
return ctx._transformStack[ctx._stackIndex].slice();
|
|
31
22
|
}
|
|
23
|
+
|
|
32
24
|
/**
|
|
33
25
|
* Returns the string serialization of a CSS color, according to https://www.w3.org/TR/2dcontext/#serialization-of-a-color
|
|
34
26
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
27
|
function serializeColor(value) {
|
|
38
28
|
return value.getAlpha() === 1 ? value.toHex() : value.toRgb();
|
|
39
29
|
}
|
|
40
|
-
|
|
41
30
|
class CanvasRenderingContext2D {
|
|
42
31
|
/**
|
|
43
32
|
* Every time a function call would result in a drawing operation, it should be added to this array.
|
|
44
33
|
* This goes for only draw call functions.
|
|
45
34
|
*/
|
|
35
|
+
|
|
46
36
|
__getDrawCalls() {
|
|
47
37
|
return this._drawCalls.slice();
|
|
48
38
|
}
|
|
39
|
+
|
|
49
40
|
/**
|
|
50
41
|
* Clear the list of draw calls
|
|
51
42
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
43
|
__clearDrawCalls() {
|
|
55
44
|
this._drawCalls = [];
|
|
56
45
|
}
|
|
46
|
+
|
|
57
47
|
/**
|
|
58
48
|
* Every time a function call results in something that would have modified the state of the context,
|
|
59
49
|
* an event is added to this array. This goes for every property set, and draw call.
|
|
60
50
|
*/
|
|
61
51
|
|
|
62
|
-
|
|
63
52
|
__getEvents() {
|
|
64
53
|
return this._events.slice();
|
|
65
54
|
}
|
|
55
|
+
|
|
66
56
|
/**
|
|
67
57
|
* Clear the list of events
|
|
68
58
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
59
|
__clearEvents() {
|
|
72
60
|
this._events = [];
|
|
73
61
|
}
|
|
62
|
+
|
|
74
63
|
/**
|
|
75
64
|
* This array keeps track of the current path, so that fill and stroke operations can store the
|
|
76
65
|
* path.
|
|
77
66
|
*/
|
|
78
67
|
|
|
79
|
-
|
|
80
68
|
__getPath() {
|
|
81
69
|
return this._path.slice();
|
|
82
70
|
}
|
|
71
|
+
|
|
83
72
|
/**
|
|
84
73
|
* Clear the path and reset it to a single beginPath event.
|
|
85
74
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
75
|
__clearPath() {
|
|
89
|
-
const event = (0, _createCanvasEvent.default)('beginPath', getTransformSlice(this), {});
|
|
90
|
-
|
|
76
|
+
const event = (0, _createCanvasEvent.default)('beginPath', getTransformSlice(this), {});
|
|
77
|
+
// The clipping path should start after the initial beginPath instruction
|
|
91
78
|
this._clipIndex = 1;
|
|
92
79
|
this._path = [event];
|
|
93
80
|
}
|
|
81
|
+
|
|
94
82
|
/**
|
|
95
83
|
* Get the current clipping region.
|
|
96
84
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
85
|
__getClippingRegion() {
|
|
100
86
|
return this._clipStack[this._stackIndex];
|
|
101
87
|
}
|
|
102
|
-
|
|
103
88
|
constructor(canvas) {
|
|
104
89
|
_defineProperty(this, "_drawCalls", []);
|
|
105
|
-
|
|
106
90
|
_defineProperty(this, "_events", []);
|
|
107
|
-
|
|
108
91
|
_defineProperty(this, "_path", [(0, _createCanvasEvent.default)('beginPath', [1, 0, 0, 1, 0, 0], {})]);
|
|
109
|
-
|
|
110
92
|
_defineProperty(this, "_directionStack", ['inherit']);
|
|
111
|
-
|
|
112
93
|
_defineProperty(this, "_fillStyleStack", ['#000000']);
|
|
113
|
-
|
|
114
94
|
_defineProperty(this, "_filterStack", ['none']);
|
|
115
|
-
|
|
116
95
|
_defineProperty(this, "_fontStack", ['10px sans-serif']);
|
|
117
|
-
|
|
118
96
|
_defineProperty(this, "_globalAlphaStack", [1.0]);
|
|
119
|
-
|
|
120
97
|
_defineProperty(this, "_globalCompositeOperationStack", ['source-over']);
|
|
121
|
-
|
|
122
98
|
_defineProperty(this, "_imageSmoothingEnabledStack", [true]);
|
|
123
|
-
|
|
124
99
|
_defineProperty(this, "_imageSmoothingQualityStack", ['low']);
|
|
125
|
-
|
|
126
100
|
_defineProperty(this, "_lineCapStack", ['butt']);
|
|
127
|
-
|
|
128
101
|
_defineProperty(this, "_lineDashOffsetStack", [0]);
|
|
129
|
-
|
|
130
102
|
_defineProperty(this, "_lineDashStack", [[]]);
|
|
131
|
-
|
|
132
103
|
_defineProperty(this, "_lineJoinStack", ['miter']);
|
|
133
|
-
|
|
134
104
|
_defineProperty(this, "_lineWidthStack", [1]);
|
|
135
|
-
|
|
136
105
|
_defineProperty(this, "_miterLimitStack", [10]);
|
|
137
|
-
|
|
138
106
|
_defineProperty(this, "_shadowBlurStack", [0]);
|
|
139
|
-
|
|
140
107
|
_defineProperty(this, "_shadowColorStack", ['rgba(0, 0, 0, 0)']);
|
|
141
|
-
|
|
142
108
|
_defineProperty(this, "_shadowOffsetXStack", [0]);
|
|
143
|
-
|
|
144
109
|
_defineProperty(this, "_shadowOffsetYStack", [0]);
|
|
145
|
-
|
|
146
110
|
_defineProperty(this, "_stackIndex", 0);
|
|
147
|
-
|
|
148
111
|
_defineProperty(this, "_strokeStyleStack", ['#000000']);
|
|
149
|
-
|
|
150
112
|
_defineProperty(this, "_textAlignStack", ['start']);
|
|
151
|
-
|
|
152
113
|
_defineProperty(this, "_textBaselineStack", ['alphabetic']);
|
|
153
|
-
|
|
154
114
|
_defineProperty(this, "_transformStack", [[1, 0, 0, 1, 0, 0]]);
|
|
155
|
-
|
|
156
115
|
_defineProperty(this, "_clipStack", [[]]);
|
|
157
|
-
|
|
116
|
+
/**
|
|
117
|
+
* This index points to the next path item that should be written to the clipStack
|
|
118
|
+
* when ctx.clip() is called.
|
|
119
|
+
*/
|
|
158
120
|
_defineProperty(this, "_clipIndex", 1);
|
|
159
|
-
|
|
160
121
|
testFuncs.forEach(key => {
|
|
161
122
|
this[key] = jest.fn(CanvasRenderingContext2D.prototype[key].bind(this));
|
|
162
123
|
});
|
|
163
124
|
this._canvas = canvas;
|
|
164
125
|
}
|
|
165
|
-
|
|
166
126
|
addHitRegion(options = {}) {
|
|
167
127
|
const {
|
|
168
128
|
path,
|
|
@@ -176,7 +136,6 @@ class CanvasRenderingContext2D {
|
|
|
176
136
|
} = options;
|
|
177
137
|
if (!path && !id) throw new DOMException('ConstraintError', "Failed to execute 'addHitRegion' on '" + this.constructor.name + "': Both id and control are null.");
|
|
178
138
|
if (fillRule && fillRule !== 'evenodd' && fillRule !== 'nonzero') throw new TypeError("Failed to execute 'addHitRegion' on '" + this.constructor.name + "': The provided value '" + fillRule + "' is not a valid enum value of type CanvasFillRule.");
|
|
179
|
-
|
|
180
139
|
this._events.push((0, _createCanvasEvent.default)('addHitRegion', getTransformSlice(this), {
|
|
181
140
|
path,
|
|
182
141
|
fillRule,
|
|
@@ -188,7 +147,6 @@ class CanvasRenderingContext2D {
|
|
|
188
147
|
role
|
|
189
148
|
}));
|
|
190
149
|
}
|
|
191
|
-
|
|
192
150
|
arc(x, y, radius, startAngle, endAngle, anticlockwise = false) {
|
|
193
151
|
if (arguments.length < 5) throw new TypeError("Failed to execute 'arc' on '" + this.constructor.name + "': 5 arguments required, but only " + arguments.length + ' present.');
|
|
194
152
|
const xResult = Number(x);
|
|
@@ -196,8 +154,9 @@ class CanvasRenderingContext2D {
|
|
|
196
154
|
const radiusResult = Number(radius);
|
|
197
155
|
const startAngleResult = Number(startAngle);
|
|
198
156
|
const endAngleResult = Number(endAngle);
|
|
199
|
-
const anticlockwiseResult = Boolean(anticlockwise);
|
|
157
|
+
const anticlockwiseResult = Boolean(anticlockwise);
|
|
200
158
|
|
|
159
|
+
// quick is finite check
|
|
201
160
|
if (!Number.isFinite(xResult + yResult + radiusResult + startAngleResult + endAngleResult)) return;
|
|
202
161
|
if (Number(radius) < 0) throw new DOMException('IndexSizeError', "Failed to execute 'arc' on '" + this.constructor.name + "': The radius provided (" + radius + ') is negative.');
|
|
203
162
|
const event = (0, _createCanvasEvent.default)('arc', getTransformSlice(this), {
|
|
@@ -208,12 +167,9 @@ class CanvasRenderingContext2D {
|
|
|
208
167
|
endAngle: endAngleResult,
|
|
209
168
|
anticlockwise: anticlockwiseResult
|
|
210
169
|
});
|
|
211
|
-
|
|
212
170
|
this._path.push(event);
|
|
213
|
-
|
|
214
171
|
this._events.push(event);
|
|
215
172
|
}
|
|
216
|
-
|
|
217
173
|
arcTo(cpx1, cpy1, cpx2, cpy2, radius) {
|
|
218
174
|
if (arguments.length < 5) throw new DOMException('IndexSizeError', "Failed to execute 'arcTo' on '" + this.constructor.name + "': 5 arguments required, but only " + arguments.length + ' present.');
|
|
219
175
|
const cpx1Result = Number(cpx1);
|
|
@@ -230,19 +186,14 @@ class CanvasRenderingContext2D {
|
|
|
230
186
|
cpy2: cpy2Result,
|
|
231
187
|
radius: radiusResult
|
|
232
188
|
});
|
|
233
|
-
|
|
234
189
|
this._path.push(event);
|
|
235
|
-
|
|
236
190
|
this._events.push(event);
|
|
237
191
|
}
|
|
238
|
-
|
|
239
192
|
beginPath() {
|
|
240
|
-
this.__clearPath();
|
|
241
|
-
|
|
242
|
-
|
|
193
|
+
this.__clearPath();
|
|
194
|
+
// push the generated beginPath to the event list
|
|
243
195
|
this._events.push(this._path[0]);
|
|
244
196
|
}
|
|
245
|
-
|
|
246
197
|
bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y) {
|
|
247
198
|
if (arguments.length < 6) throw new TypeError("Failed to execute 'bezierCurveTo' on '" + this.constructor.name + "': 6 arguments required, but only " + arguments.length + ' present.');
|
|
248
199
|
const cpx1Result = Number(cpx1);
|
|
@@ -260,22 +211,16 @@ class CanvasRenderingContext2D {
|
|
|
260
211
|
x,
|
|
261
212
|
y
|
|
262
213
|
});
|
|
263
|
-
|
|
264
214
|
this._path.push(event);
|
|
265
|
-
|
|
266
215
|
this._events.push(event);
|
|
267
216
|
}
|
|
268
|
-
|
|
269
217
|
get canvas() {
|
|
270
218
|
return this._canvas;
|
|
271
219
|
}
|
|
272
|
-
|
|
273
220
|
clearHitRegions() {
|
|
274
221
|
const event = (0, _createCanvasEvent.default)('clearHitRegions', getTransformSlice(this), {});
|
|
275
|
-
|
|
276
222
|
this._events.push(event);
|
|
277
223
|
}
|
|
278
|
-
|
|
279
224
|
clearRect(x, y, width, height) {
|
|
280
225
|
if (arguments.length < 4) throw new TypeError("Failed to execute 'clearRect' on '" + this.constructor.name + "': 4 arguments required, but only " + arguments.length + ' present.');
|
|
281
226
|
const xResult = Number(x);
|
|
@@ -289,20 +234,11 @@ class CanvasRenderingContext2D {
|
|
|
289
234
|
width: widthResult,
|
|
290
235
|
height: heightResult
|
|
291
236
|
});
|
|
292
|
-
|
|
293
237
|
this._events.push(event);
|
|
294
|
-
|
|
295
238
|
this._drawCalls.push(event);
|
|
296
239
|
}
|
|
297
|
-
/**
|
|
298
|
-
* This index points to the next path item that should be written to the clipStack
|
|
299
|
-
* when ctx.clip() is called.
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
|
-
|
|
303
240
|
clip(path, fillRule) {
|
|
304
241
|
let clipPath;
|
|
305
|
-
|
|
306
242
|
if (arguments.length === 0) {
|
|
307
243
|
fillRule = 'nonzero';
|
|
308
244
|
path = this._path.slice();
|
|
@@ -310,7 +246,6 @@ class CanvasRenderingContext2D {
|
|
|
310
246
|
this._clipIndex = path.length;
|
|
311
247
|
} else {
|
|
312
248
|
if (arguments.length === 1) fillRule = 'nonzero';
|
|
313
|
-
|
|
314
249
|
if (path instanceof _Path2D.default) {
|
|
315
250
|
fillRule = String(fillRule);
|
|
316
251
|
if (fillRule !== 'nonzero' && fillRule !== 'evenodd') throw new TypeError("Failed to execute 'clip' on '" + this.constructor.name + "': The provided value '" + fillRule + "' is not a valid enum value of type CanvasFillRule.");
|
|
@@ -324,28 +259,20 @@ class CanvasRenderingContext2D {
|
|
|
324
259
|
this._clipIndex = path.length;
|
|
325
260
|
}
|
|
326
261
|
}
|
|
327
|
-
|
|
328
262
|
const event = (0, _createCanvasEvent.default)('clip', getTransformSlice(this), {
|
|
329
263
|
path,
|
|
330
264
|
fillRule
|
|
331
265
|
});
|
|
332
|
-
|
|
333
266
|
this._path.push(event);
|
|
334
|
-
|
|
335
267
|
this._events.push(event);
|
|
336
|
-
|
|
337
268
|
const currentClip = this._clipStack[this._stackIndex];
|
|
338
269
|
this._clipStack[this._stackIndex] = currentClip.concat(clipPath);
|
|
339
270
|
}
|
|
340
|
-
|
|
341
271
|
closePath() {
|
|
342
272
|
const event = (0, _createCanvasEvent.default)('closePath', getTransformSlice(this), {});
|
|
343
|
-
|
|
344
273
|
this._events.push(event);
|
|
345
|
-
|
|
346
274
|
this._path.push(event);
|
|
347
275
|
}
|
|
348
|
-
|
|
349
276
|
createImageData(width, height) {
|
|
350
277
|
if (arguments.length < 1) throw new TypeError("Failed to execute 'createImageData' on '" + this.constructor.name + "': 1 argument required, but only 0 present.");else if (arguments.length === 1) {
|
|
351
278
|
if (!(width instanceof ImageData)) throw new TypeError("Failed to execute 'createImageData' on '" + this.constructor.name + "': parameter 1 is not of type 'ImageData'.");
|
|
@@ -355,9 +282,7 @@ class CanvasRenderingContext2D {
|
|
|
355
282
|
width: width.width,
|
|
356
283
|
height: width.height
|
|
357
284
|
});
|
|
358
|
-
|
|
359
285
|
this._events.push(event);
|
|
360
|
-
|
|
361
286
|
return result;
|
|
362
287
|
} else {
|
|
363
288
|
width = Math.abs(Number(width));
|
|
@@ -368,13 +293,10 @@ class CanvasRenderingContext2D {
|
|
|
368
293
|
width,
|
|
369
294
|
height
|
|
370
295
|
});
|
|
371
|
-
|
|
372
296
|
this._events.push(event);
|
|
373
|
-
|
|
374
297
|
return new ImageData(width, height);
|
|
375
298
|
}
|
|
376
299
|
}
|
|
377
|
-
|
|
378
300
|
createLinearGradient(x0, y0, x1, y1) {
|
|
379
301
|
if (arguments.length < 4) throw new TypeError("Failed to execute 'createLinearGradient' on '" + this.constructor.name + "': 4 arguments required, but only " + arguments.length + ' present.');
|
|
380
302
|
const x0Result = Number(x0);
|
|
@@ -388,55 +310,40 @@ class CanvasRenderingContext2D {
|
|
|
388
310
|
x1: x1Result,
|
|
389
311
|
y1: y1Result
|
|
390
312
|
});
|
|
391
|
-
|
|
392
313
|
this._events.push(event);
|
|
393
|
-
|
|
394
314
|
return new CanvasGradient();
|
|
395
315
|
}
|
|
396
|
-
|
|
397
316
|
createPattern(image, type) {
|
|
398
317
|
if (arguments.length === 1) throw new TypeError("Failed to execute 'createPattern' on '" + this.constructor.name + "': 2 arguments required, but only 1 present.");
|
|
399
318
|
if (type === null) type = 'repeat';
|
|
400
319
|
if (type === '') type = 'repeat';
|
|
401
|
-
|
|
402
320
|
if (type === 'repeat' || type === 'repeat-x' || type === 'repeat-y' || type === 'no-repeat') {
|
|
403
321
|
const event = (0, _createCanvasEvent.default)('createPattern', getTransformSlice(this), {
|
|
404
322
|
image,
|
|
405
323
|
type
|
|
406
324
|
});
|
|
407
|
-
|
|
408
325
|
if (image instanceof ImageBitmap) {
|
|
409
326
|
if (image._closed) throw new DOMException('InvalidStateError', "Failed to execute 'createPattern' on 'CanvasRenderingContext2D': The image source is detached.");
|
|
410
|
-
|
|
411
327
|
this._events.push(event);
|
|
412
|
-
|
|
413
328
|
return new _CanvasPattern.default();
|
|
414
329
|
}
|
|
415
|
-
|
|
416
330
|
if (image instanceof HTMLImageElement) {
|
|
417
331
|
this._events.push(event);
|
|
418
|
-
|
|
419
332
|
return new _CanvasPattern.default();
|
|
420
333
|
}
|
|
421
|
-
|
|
422
334
|
if (image instanceof HTMLVideoElement) {
|
|
423
335
|
this._events.push(event);
|
|
424
|
-
|
|
425
336
|
return new _CanvasPattern.default();
|
|
426
337
|
}
|
|
427
|
-
|
|
428
338
|
if (image instanceof HTMLCanvasElement) {
|
|
429
339
|
this._events.push(event);
|
|
430
|
-
|
|
431
340
|
return new _CanvasPattern.default();
|
|
432
341
|
}
|
|
433
342
|
} else {
|
|
434
343
|
throw new TypeError("Failed to execute 'createPattern' on '" + this.constructor.name + "': The provided type ('" + type + "') is not one of 'repeat', 'no-repeat', 'repeat-x', or 'repeat-y'.");
|
|
435
344
|
}
|
|
436
|
-
|
|
437
345
|
throw new TypeError("Failed to execute 'createPattern' on '" + this.constructor.name + "': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)'");
|
|
438
346
|
}
|
|
439
|
-
|
|
440
347
|
createRadialGradient(x0, y0, r0, x1, y1, r1) {
|
|
441
348
|
if (arguments.length < 6) throw new TypeError("Failed to execute 'createRadialGradient' on '" + this.constructor.name + "': 6 arguments required, but only " + arguments.length + ' present.');
|
|
442
349
|
const x0Result = Number(x0);
|
|
@@ -456,12 +363,9 @@ class CanvasRenderingContext2D {
|
|
|
456
363
|
y1: y1Result,
|
|
457
364
|
r1: r1Result
|
|
458
365
|
});
|
|
459
|
-
|
|
460
366
|
this._events.push(event);
|
|
461
|
-
|
|
462
367
|
return new CanvasGradient();
|
|
463
368
|
}
|
|
464
|
-
|
|
465
369
|
set currentTransform(value) {
|
|
466
370
|
if (value instanceof _DOMMatrix.default) {
|
|
467
371
|
this._transformStack[this._stackIndex][0] = value.a;
|
|
@@ -478,59 +382,47 @@ class CanvasRenderingContext2D {
|
|
|
478
382
|
e: value.e,
|
|
479
383
|
f: value.f
|
|
480
384
|
});
|
|
481
|
-
|
|
482
385
|
this._events.push(event);
|
|
483
386
|
}
|
|
484
387
|
}
|
|
485
|
-
|
|
486
388
|
get currentTransform() {
|
|
487
389
|
return new _DOMMatrix.default(this._transformStack[this._stackIndex]);
|
|
488
390
|
}
|
|
489
|
-
|
|
490
391
|
set direction(value) {
|
|
491
392
|
if (value === 'rtl' || value === 'ltr' || value === 'inherit') {
|
|
492
393
|
this._directionStack[this._stackIndex] = value;
|
|
493
394
|
const event = (0, _createCanvasEvent.default)('direction', getTransformSlice(this), {
|
|
494
395
|
value
|
|
495
396
|
});
|
|
496
|
-
|
|
497
397
|
this._events.push(event);
|
|
498
398
|
}
|
|
499
399
|
}
|
|
500
|
-
|
|
501
400
|
get direction() {
|
|
502
401
|
return this._directionStack[this._stackIndex];
|
|
503
402
|
}
|
|
504
|
-
|
|
505
403
|
drawFocusIfNeeded(path, element) {
|
|
506
404
|
if (arguments.length === 0) throw new TypeError("Failed to execute 'drawFocusIfNeeded' on '" + this.constructor.name + "': 1 argument required, but only 0 present.");
|
|
507
405
|
if (arguments.length === 2 && !(path instanceof _Path2D.default)) throw new TypeError("Failed to execute 'drawFocusIfNeeded' on '" + this.constructor.name + "': parameter 1 is not of type 'Path2D'.");
|
|
508
|
-
|
|
509
406
|
if (arguments.length === 1) {
|
|
510
407
|
element = path;
|
|
511
408
|
path = null;
|
|
512
409
|
}
|
|
513
|
-
|
|
514
410
|
if (!(element instanceof Element)) throw new TypeError("Failed to execute 'drawFocusIfNeeded' on '" + this.constructor.name + "': parameter " + arguments.length + " is not of type 'Element'.");
|
|
515
411
|
const event = (0, _createCanvasEvent.default)('drawFocusIfNeeded', getTransformSlice(this), {
|
|
516
412
|
path: path ? path._path : null,
|
|
517
413
|
element
|
|
518
414
|
});
|
|
519
|
-
|
|
520
415
|
this._events.push(event);
|
|
521
416
|
}
|
|
522
|
-
|
|
523
417
|
drawImage(img, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) {
|
|
524
418
|
if (arguments.length < 3) throw new TypeError("Failed to execute 'drawImage' on '" + this.constructor.name + "': 3 arguments required, but only " + arguments.length + ' present.');
|
|
525
419
|
if (arguments.length === 4 || arguments.length > 5 && arguments.length < 9) throw new TypeError("Failed to execute 'drawImage' on '" + this.constructor.name + "': Valid arities are: [3, 5, 9], but 4 arguments provided.");
|
|
526
420
|
let valid = false;
|
|
527
421
|
if (img instanceof HTMLImageElement) valid = true;
|
|
528
|
-
|
|
529
422
|
if (img instanceof ImageBitmap) {
|
|
530
423
|
if (img._closed) throw new DOMException('InvalidStateError', "DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image source is detached.");
|
|
531
424
|
valid = true;
|
|
532
425
|
}
|
|
533
|
-
|
|
534
426
|
if (img instanceof HTMLVideoElement) valid = true;
|
|
535
427
|
if (img instanceof HTMLCanvasElement) valid = true;
|
|
536
428
|
if (!valid) throw new TypeError("Failed to execute 'drawImage' on '" + this.constructor.name + "': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)'");
|
|
@@ -542,7 +434,6 @@ class CanvasRenderingContext2D {
|
|
|
542
434
|
const dyResult = Number(dy);
|
|
543
435
|
const dWidthResult = Number(dWidth);
|
|
544
436
|
const dHeightResult = Number(dHeight);
|
|
545
|
-
|
|
546
437
|
if (arguments.length === 3) {
|
|
547
438
|
if (!Number.isFinite(sxResult + syResult)) return;
|
|
548
439
|
sx = 0;
|
|
@@ -574,7 +465,6 @@ class CanvasRenderingContext2D {
|
|
|
574
465
|
dWidth = dWidthResult;
|
|
575
466
|
dHeight = dHeightResult;
|
|
576
467
|
}
|
|
577
|
-
|
|
578
468
|
const event = (0, _createCanvasEvent.default)('drawImage', getTransformSlice(this), {
|
|
579
469
|
img,
|
|
580
470
|
sx,
|
|
@@ -586,12 +476,9 @@ class CanvasRenderingContext2D {
|
|
|
586
476
|
dWidth,
|
|
587
477
|
dHeight
|
|
588
478
|
});
|
|
589
|
-
|
|
590
479
|
this._events.push(event);
|
|
591
|
-
|
|
592
480
|
this._drawCalls.push(event);
|
|
593
481
|
}
|
|
594
|
-
|
|
595
482
|
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise = false) {
|
|
596
483
|
if (arguments.length < 7) throw new TypeError("Failed to execute 'ellipse' on '" + this.constructor.name + "': 6 arguments required, but only " + arguments.length + ' present.');
|
|
597
484
|
const xResult = Number(x);
|
|
@@ -615,19 +502,15 @@ class CanvasRenderingContext2D {
|
|
|
615
502
|
endAngle: endAngleResult,
|
|
616
503
|
anticlockwise: anticlockwiseResult
|
|
617
504
|
});
|
|
618
|
-
|
|
619
505
|
this._path.push(event);
|
|
620
|
-
|
|
621
506
|
this._events.push(event);
|
|
622
507
|
}
|
|
623
|
-
|
|
624
508
|
fill(path, fillRule) {
|
|
625
509
|
if (arguments.length === 0) {
|
|
626
510
|
fillRule = 'nonzero';
|
|
627
511
|
path = this._path.slice();
|
|
628
512
|
} else {
|
|
629
513
|
if (arguments.length === 1) fillRule = 'nonzero';
|
|
630
|
-
|
|
631
514
|
if (path instanceof _Path2D.default) {
|
|
632
515
|
fillRule = String(fillRule);
|
|
633
516
|
if (fillRule !== 'nonzero' && fillRule !== 'evenodd') throw new TypeError("Failed to execute 'clip' on '" + this.constructor.name + "': The provided value '" + fillRule + "' is not a valid enum value of type CanvasFillRule.");
|
|
@@ -638,17 +521,13 @@ class CanvasRenderingContext2D {
|
|
|
638
521
|
path = this._path.slice();
|
|
639
522
|
}
|
|
640
523
|
}
|
|
641
|
-
|
|
642
524
|
const event = (0, _createCanvasEvent.default)('fill', getTransformSlice(this), {
|
|
643
525
|
path,
|
|
644
526
|
fillRule
|
|
645
527
|
});
|
|
646
|
-
|
|
647
528
|
this._events.push(event);
|
|
648
|
-
|
|
649
529
|
this._drawCalls.push(event);
|
|
650
530
|
}
|
|
651
|
-
|
|
652
531
|
fillRect(x, y, width, height) {
|
|
653
532
|
if (arguments.length < 4) throw new TypeError("Failed to execute 'fillRect' on '" + this.constructor.name + "': 4 arguments required, but only " + arguments.length + ' present.');
|
|
654
533
|
const xResult = Number(x);
|
|
@@ -662,15 +541,11 @@ class CanvasRenderingContext2D {
|
|
|
662
541
|
width: widthResult,
|
|
663
542
|
height: heightResult
|
|
664
543
|
});
|
|
665
|
-
|
|
666
544
|
this._events.push(event);
|
|
667
|
-
|
|
668
545
|
this._drawCalls.push(event);
|
|
669
546
|
}
|
|
670
|
-
|
|
671
547
|
set fillStyle(value) {
|
|
672
548
|
let valid = false;
|
|
673
|
-
|
|
674
549
|
if (typeof value === 'string') {
|
|
675
550
|
try {
|
|
676
551
|
const result = new _mooColor.MooColor(value);
|
|
@@ -683,20 +558,16 @@ class CanvasRenderingContext2D {
|
|
|
683
558
|
valid = true;
|
|
684
559
|
this._fillStyleStack[this._stackIndex] = value;
|
|
685
560
|
}
|
|
686
|
-
|
|
687
561
|
if (valid) {
|
|
688
562
|
const event = (0, _createCanvasEvent.default)('fillStyle', getTransformSlice(this), {
|
|
689
563
|
value
|
|
690
564
|
});
|
|
691
|
-
|
|
692
565
|
this._events.push(event);
|
|
693
566
|
}
|
|
694
567
|
}
|
|
695
|
-
|
|
696
568
|
get fillStyle() {
|
|
697
569
|
return this._fillStyleStack[this._stackIndex];
|
|
698
570
|
}
|
|
699
|
-
|
|
700
571
|
fillText(text, x, y, maxWidth) {
|
|
701
572
|
if (arguments.length < 3) throw new TypeError("Failed to execute 'fillText' on '" + this.constructor.name + "': 3 arguments required, but only " + arguments.length + ' present.');
|
|
702
573
|
const textResult = String(text);
|
|
@@ -711,56 +582,43 @@ class CanvasRenderingContext2D {
|
|
|
711
582
|
y: yResult,
|
|
712
583
|
maxWidth: arguments.length === 3 ? null : maxWidthResult
|
|
713
584
|
});
|
|
714
|
-
|
|
715
585
|
this._events.push(event);
|
|
716
|
-
|
|
717
586
|
this._drawCalls.push(event);
|
|
718
587
|
}
|
|
719
|
-
|
|
720
588
|
set filter(value) {
|
|
721
589
|
if (value === '') value = 'none';
|
|
722
590
|
value = this._filterStack[this._stackIndex] = typeof value === 'string' ? value : 'none';
|
|
723
591
|
const event = (0, _createCanvasEvent.default)('filter', getTransformSlice(this), {
|
|
724
592
|
value
|
|
725
593
|
});
|
|
726
|
-
|
|
727
594
|
this._events.push(event);
|
|
728
595
|
}
|
|
729
|
-
|
|
730
596
|
get filter() {
|
|
731
597
|
return this._filterStack[this._stackIndex];
|
|
732
598
|
}
|
|
733
|
-
|
|
734
599
|
set font(value) {
|
|
735
600
|
let ex;
|
|
736
|
-
|
|
737
601
|
try {
|
|
738
602
|
const result = (0, _cssfontparser.default)(value);
|
|
739
603
|
value = this._fontStack[this._stackIndex] = result.toString();
|
|
740
604
|
const event = (0, _createCanvasEvent.default)('font', getTransformSlice(this), {
|
|
741
605
|
value
|
|
742
606
|
});
|
|
743
|
-
|
|
744
607
|
this._events.push(event);
|
|
745
608
|
} catch (ex) {}
|
|
746
609
|
}
|
|
747
|
-
|
|
748
610
|
get font() {
|
|
749
611
|
return this._fontStack[this._stackIndex];
|
|
750
612
|
}
|
|
751
|
-
|
|
752
613
|
getImageData() {
|
|
753
614
|
return new ImageData(this._canvas.width, this._canvas.height);
|
|
754
615
|
}
|
|
755
|
-
|
|
756
616
|
getLineDash() {
|
|
757
617
|
return this._lineDashStack[this._stackIndex];
|
|
758
618
|
}
|
|
759
|
-
|
|
760
619
|
getTransform() {
|
|
761
620
|
return new _DOMMatrix.default(this._transformStack[this._stackIndex]);
|
|
762
621
|
}
|
|
763
|
-
|
|
764
622
|
set globalAlpha(value) {
|
|
765
623
|
value = Number(value);
|
|
766
624
|
if (!Number.isFinite(value)) return;
|
|
@@ -770,69 +628,54 @@ class CanvasRenderingContext2D {
|
|
|
770
628
|
const event = (0, _createCanvasEvent.default)('globalAlpha', getTransformSlice(this), {
|
|
771
629
|
value
|
|
772
630
|
});
|
|
773
|
-
|
|
774
631
|
this._events.push(event);
|
|
775
632
|
}
|
|
776
|
-
|
|
777
633
|
get globalAlpha() {
|
|
778
634
|
return this._globalAlphaStack[this._stackIndex];
|
|
779
635
|
}
|
|
780
|
-
|
|
781
636
|
set globalCompositeOperation(value) {
|
|
782
637
|
if (compositeOperations.indexOf(value) !== -1) {
|
|
783
638
|
this._globalCompositeOperationStack[this._stackIndex] = value;
|
|
784
639
|
const event = (0, _createCanvasEvent.default)('globalCompositeOperation', getTransformSlice(this), {
|
|
785
640
|
value
|
|
786
641
|
});
|
|
787
|
-
|
|
788
642
|
this._events.push(event);
|
|
789
643
|
}
|
|
790
644
|
}
|
|
791
|
-
|
|
792
645
|
get globalCompositeOperation() {
|
|
793
646
|
return this._globalCompositeOperationStack[this._stackIndex];
|
|
794
647
|
}
|
|
795
|
-
|
|
796
648
|
set imageSmoothingEnabled(value) {
|
|
797
649
|
value = this._imageSmoothingEnabledStack[this._stackIndex] = Boolean(value);
|
|
798
650
|
const event = (0, _createCanvasEvent.default)('imageSmoothingEnabled', getTransformSlice(this), {
|
|
799
651
|
value
|
|
800
652
|
});
|
|
801
|
-
|
|
802
653
|
this._events.push(event);
|
|
803
654
|
}
|
|
804
|
-
|
|
805
655
|
get imageSmoothingEnabled() {
|
|
806
656
|
return this._imageSmoothingEnabledStack[this._stackIndex];
|
|
807
657
|
}
|
|
808
|
-
|
|
809
658
|
set imageSmoothingQuality(value) {
|
|
810
659
|
if (value === 'high' || value === 'medium' || value === 'low') {
|
|
811
660
|
this._imageSmoothingQualityStack[this._stackIndex] = value;
|
|
812
661
|
const event = (0, _createCanvasEvent.default)('imageSmoothingQuality', getTransformSlice(this), {
|
|
813
662
|
value
|
|
814
663
|
});
|
|
815
|
-
|
|
816
664
|
this._events.push(event);
|
|
817
665
|
}
|
|
818
666
|
}
|
|
819
|
-
|
|
820
667
|
get imageSmoothingQuality() {
|
|
821
668
|
return this._imageSmoothingQualityStack[this._stackIndex];
|
|
822
669
|
}
|
|
823
|
-
|
|
824
670
|
isPointInPath(path, x, y, fillRule = 'nonzero') {
|
|
825
671
|
if (arguments.length < 2) throw new TypeError("Failed to execute 'isPointInPath' on '" + this.constructor.name + "': 2 arguments required, but only " + arguments.length + ' present.');
|
|
826
|
-
|
|
827
672
|
if (!(path instanceof _Path2D.default)) {
|
|
828
673
|
if (arguments.length > 2) {
|
|
829
674
|
fillRule = y;
|
|
830
675
|
}
|
|
831
|
-
|
|
832
676
|
y = x;
|
|
833
677
|
x = path;
|
|
834
678
|
}
|
|
835
|
-
|
|
836
679
|
if (fillRule !== 'nonzero' && fillRule !== 'evenodd') throw new TypeError("Failed to execute 'isPointInPath' on '" + this.constructor.name + "': The provided value '" + fillRule + "' is not a valid enum value of type CanvasFillRule.");
|
|
837
680
|
const event = (0, _createCanvasEvent.default)('isPointInPath', getTransformSlice(this), {
|
|
838
681
|
x: Number(x),
|
|
@@ -840,28 +683,22 @@ class CanvasRenderingContext2D {
|
|
|
840
683
|
fillRule,
|
|
841
684
|
path: path instanceof _Path2D.default ? path._path.slice() : this._path.slice()
|
|
842
685
|
});
|
|
843
|
-
|
|
844
686
|
this._events.push(event);
|
|
845
|
-
|
|
846
687
|
return false; // return false in a mocking environment, unless I can verify a point is actually within the path
|
|
847
688
|
}
|
|
848
689
|
|
|
849
690
|
isPointInStroke(path, x, y) {
|
|
850
691
|
if (arguments.length < 2) throw new TypeError("Failed to execute 'isPointInStroke' on '" + this.constructor.name + "': 2 arguments required, but only " + arguments.length + ' present.');
|
|
851
|
-
|
|
852
692
|
if (!(path instanceof _Path2D.default)) {
|
|
853
693
|
y = x;
|
|
854
694
|
x = path;
|
|
855
695
|
}
|
|
856
|
-
|
|
857
696
|
const event = (0, _createCanvasEvent.default)('isPointInPath', getTransformSlice(this), {
|
|
858
697
|
x: Number(x),
|
|
859
698
|
y: Number(y),
|
|
860
699
|
path: path instanceof _Path2D.default ? path._path.slice() : this._path.slice()
|
|
861
700
|
});
|
|
862
|
-
|
|
863
701
|
this._events.push(event);
|
|
864
|
-
|
|
865
702
|
return false; // return false in a mocking environment, unless I can verify a point is actually within the path
|
|
866
703
|
}
|
|
867
704
|
|
|
@@ -871,47 +708,37 @@ class CanvasRenderingContext2D {
|
|
|
871
708
|
const event = (0, _createCanvasEvent.default)('lineCap', getTransformSlice(this), {
|
|
872
709
|
value
|
|
873
710
|
});
|
|
874
|
-
|
|
875
711
|
this._events.push(event);
|
|
876
712
|
}
|
|
877
713
|
}
|
|
878
|
-
|
|
879
714
|
get lineCap() {
|
|
880
715
|
return this._lineCapStack[this._stackIndex];
|
|
881
716
|
}
|
|
882
|
-
|
|
883
717
|
set lineDashOffset(value) {
|
|
884
718
|
const result = Number(value);
|
|
885
|
-
|
|
886
719
|
if (Number.isFinite(result)) {
|
|
887
720
|
this._lineDashOffsetStack[this._stackIndex] = result;
|
|
888
721
|
const event = (0, _createCanvasEvent.default)('lineDashOffset', getTransformSlice(this), {
|
|
889
722
|
value
|
|
890
723
|
});
|
|
891
|
-
|
|
892
724
|
this._events.push(event);
|
|
893
725
|
}
|
|
894
726
|
}
|
|
895
|
-
|
|
896
727
|
get lineDashOffset() {
|
|
897
728
|
return this._lineDashOffsetStack[this._stackIndex];
|
|
898
729
|
}
|
|
899
|
-
|
|
900
730
|
set lineJoin(value) {
|
|
901
731
|
if (value === 'round' || value === 'bevel' || value === 'miter') {
|
|
902
732
|
this._lineJoinStack[this._stackIndex] = value;
|
|
903
733
|
const event = (0, _createCanvasEvent.default)('lineJoin', getTransformSlice(this), {
|
|
904
734
|
value
|
|
905
735
|
});
|
|
906
|
-
|
|
907
736
|
this._events.push(event);
|
|
908
737
|
}
|
|
909
738
|
}
|
|
910
|
-
|
|
911
739
|
get lineJoin() {
|
|
912
740
|
return this._lineJoinStack[this._stackIndex];
|
|
913
741
|
}
|
|
914
|
-
|
|
915
742
|
lineTo(x, y) {
|
|
916
743
|
if (arguments.length < 2) throw new TypeError("Failed to execute 'lineTo' on '" + this.constructor.name + "': 2 arguments required, but only " + arguments.length + ' present.');
|
|
917
744
|
const xResult = Number(x);
|
|
@@ -921,29 +748,22 @@ class CanvasRenderingContext2D {
|
|
|
921
748
|
x: xResult,
|
|
922
749
|
y: yResult
|
|
923
750
|
});
|
|
924
|
-
|
|
925
751
|
this._events.push(event);
|
|
926
|
-
|
|
927
752
|
this._path.push(event);
|
|
928
753
|
}
|
|
929
|
-
|
|
930
754
|
set lineWidth(value) {
|
|
931
755
|
const result = Number(value);
|
|
932
|
-
|
|
933
756
|
if (Number.isFinite(result) && result > 0) {
|
|
934
757
|
this._lineWidthStack[this._stackIndex] = result;
|
|
935
758
|
const event = (0, _createCanvasEvent.default)('lineWidth', getTransformSlice(this), {
|
|
936
759
|
value: result
|
|
937
760
|
});
|
|
938
|
-
|
|
939
761
|
this._events.push(event);
|
|
940
762
|
}
|
|
941
763
|
}
|
|
942
|
-
|
|
943
764
|
get lineWidth() {
|
|
944
765
|
return this._lineWidthStack[this._stackIndex];
|
|
945
766
|
}
|
|
946
|
-
|
|
947
767
|
measureText(text) {
|
|
948
768
|
if (arguments.length < 1) throw new TypeError("Failed to execute 'measureText' on '" + this.constructor.name + "': 1 argument required, but only 0 present.");
|
|
949
769
|
text = text == null ? '' : text;
|
|
@@ -951,29 +771,22 @@ class CanvasRenderingContext2D {
|
|
|
951
771
|
const event = (0, _createCanvasEvent.default)('measureText', getTransformSlice(this), {
|
|
952
772
|
text
|
|
953
773
|
});
|
|
954
|
-
|
|
955
774
|
this._events.push(event);
|
|
956
|
-
|
|
957
775
|
return new _TextMetrics.default(text);
|
|
958
776
|
}
|
|
959
|
-
|
|
960
777
|
set miterLimit(value) {
|
|
961
778
|
const result = Number(value);
|
|
962
|
-
|
|
963
779
|
if (Number.isFinite(result) && result > 0) {
|
|
964
780
|
this._miterLimitStack[this._stackIndex] = result;
|
|
965
781
|
const event = (0, _createCanvasEvent.default)('lineWidth', getTransformSlice(this), {
|
|
966
782
|
value: result
|
|
967
783
|
});
|
|
968
|
-
|
|
969
784
|
this._events.push(event);
|
|
970
785
|
}
|
|
971
786
|
}
|
|
972
|
-
|
|
973
787
|
get miterLimit() {
|
|
974
788
|
return this._miterLimitStack[this._stackIndex];
|
|
975
789
|
}
|
|
976
|
-
|
|
977
790
|
moveTo(x, y) {
|
|
978
791
|
if (arguments.length < 2) throw new TypeError("Failed to execute 'moveTo' on '" + this.constructor.name + "': 2 arguments required, but only " + arguments.length + ' present.');
|
|
979
792
|
const xResult = Number(x);
|
|
@@ -983,12 +796,9 @@ class CanvasRenderingContext2D {
|
|
|
983
796
|
x: xResult,
|
|
984
797
|
y: yResult
|
|
985
798
|
});
|
|
986
|
-
|
|
987
799
|
this._events.push(event);
|
|
988
|
-
|
|
989
800
|
this._path.push(event);
|
|
990
801
|
}
|
|
991
|
-
|
|
992
802
|
putImageData(data, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) {
|
|
993
803
|
if (arguments.length < 3) throw new TypeError("Failed to execute 'putImageData' on '" + this.constructor.name + "': 3 arguments required, but only " + arguments.length + ' present.');
|
|
994
804
|
if (arguments.length > 3 && arguments.length < 7) throw new TypeError("Failed to execute 'putImageData' on '" + this.constructor.name + "': Valid arities are: [3, 7], but " + arguments.length + ' arguments provided.');
|
|
@@ -999,13 +809,11 @@ class CanvasRenderingContext2D {
|
|
|
999
809
|
const dirtyYResult = Number(dirtyY);
|
|
1000
810
|
const dirtyWidthResult = Number(dirtyWidth);
|
|
1001
811
|
const dirtyHeightResult = Number(dirtyHeight);
|
|
1002
|
-
|
|
1003
812
|
if (arguments.length === 3) {
|
|
1004
813
|
if (!Number.isFinite(xResult + yResult)) return;
|
|
1005
814
|
} else {
|
|
1006
815
|
if (!Number.isFinite(xResult + yResult + dirtyXResult + dirtyYResult + dirtyWidthResult + dirtyHeightResult)) return;
|
|
1007
816
|
}
|
|
1008
|
-
|
|
1009
817
|
const event = (0, _createCanvasEvent.default)('putImageData', getTransformSlice(this), {
|
|
1010
818
|
x: xResult,
|
|
1011
819
|
y: yResult,
|
|
@@ -1014,10 +822,8 @@ class CanvasRenderingContext2D {
|
|
|
1014
822
|
dirtyWidth: dirtyWidthResult,
|
|
1015
823
|
dirtyHeight: dirtyHeightResult
|
|
1016
824
|
});
|
|
1017
|
-
|
|
1018
825
|
this._events.push(event);
|
|
1019
826
|
}
|
|
1020
|
-
|
|
1021
827
|
quadraticCurveTo(cpx, cpy, x, y) {
|
|
1022
828
|
if (arguments.length < 4) throw new TypeError("Failed to execute 'quadraticCurveTo' on '" + this.constructor.name + "': 4 arguments required, but only " + arguments.length + ' present.');
|
|
1023
829
|
const cpxResult = Number(cpx);
|
|
@@ -1031,10 +837,8 @@ class CanvasRenderingContext2D {
|
|
|
1031
837
|
x: xResult,
|
|
1032
838
|
y: yResult
|
|
1033
839
|
});
|
|
1034
|
-
|
|
1035
840
|
this._events.push(event);
|
|
1036
841
|
}
|
|
1037
|
-
|
|
1038
842
|
rect(x, y, width, height) {
|
|
1039
843
|
if (arguments.length < 4) throw new TypeError("Failed to execute 'rect' on '" + this.constructor.name + "': 4 arguments required, but only " + arguments.length + ' present.');
|
|
1040
844
|
if (!Number.isFinite(x + y + width + height)) return;
|
|
@@ -1048,21 +852,16 @@ class CanvasRenderingContext2D {
|
|
|
1048
852
|
width: widthResult,
|
|
1049
853
|
height: heightResult
|
|
1050
854
|
});
|
|
1051
|
-
|
|
1052
855
|
this._events.push(event);
|
|
1053
|
-
|
|
1054
856
|
this._path.push(event);
|
|
1055
857
|
}
|
|
1056
|
-
|
|
1057
858
|
removeHitRegion(id) {
|
|
1058
859
|
if (arguments.length < 1) throw new TypeError("Failed to execute 'removeHitRegion' on '" + this.constructor.name + "': 1 argument required, but only " + arguments.length + ' present.');
|
|
1059
860
|
const event = (0, _createCanvasEvent.default)('removeHitRegion', getTransformSlice(this), {
|
|
1060
861
|
id
|
|
1061
862
|
});
|
|
1062
|
-
|
|
1063
863
|
this._events.push(event);
|
|
1064
864
|
}
|
|
1065
|
-
|
|
1066
865
|
resetTransform() {
|
|
1067
866
|
this._transformStack[this._stackIndex][0] = 1;
|
|
1068
867
|
this._transformStack[this._stackIndex][1] = 0;
|
|
@@ -1078,65 +877,37 @@ class CanvasRenderingContext2D {
|
|
|
1078
877
|
e: 0,
|
|
1079
878
|
f: 0
|
|
1080
879
|
});
|
|
1081
|
-
|
|
1082
880
|
this._events.push(event);
|
|
1083
881
|
}
|
|
1084
|
-
|
|
1085
882
|
restore() {
|
|
1086
883
|
if (this._stackIndex <= 0) return;
|
|
1087
|
-
|
|
1088
884
|
this._transformStack.pop();
|
|
1089
|
-
|
|
1090
885
|
this._clipStack.pop();
|
|
1091
|
-
|
|
1092
886
|
this._directionStack.pop();
|
|
1093
|
-
|
|
1094
887
|
this._fillStyleStack.pop();
|
|
1095
|
-
|
|
1096
888
|
this._filterStack.pop();
|
|
1097
|
-
|
|
1098
889
|
this._fontStack.pop();
|
|
1099
|
-
|
|
1100
890
|
this._globalAlphaStack.pop();
|
|
1101
|
-
|
|
1102
891
|
this._globalCompositeOperationStack.pop();
|
|
1103
|
-
|
|
1104
892
|
this._imageSmoothingEnabledStack.pop();
|
|
1105
|
-
|
|
1106
893
|
this._imageSmoothingQualityStack.pop();
|
|
1107
|
-
|
|
1108
894
|
this._lineCapStack.pop();
|
|
1109
|
-
|
|
1110
895
|
this._lineDashStack.pop();
|
|
1111
|
-
|
|
1112
896
|
this._lineDashOffsetStack.pop();
|
|
1113
|
-
|
|
1114
897
|
this._lineJoinStack.pop();
|
|
1115
|
-
|
|
1116
898
|
this._lineWidthStack.pop();
|
|
1117
|
-
|
|
1118
899
|
this._miterLimitStack.pop();
|
|
1119
|
-
|
|
1120
900
|
this._shadowBlurStack.pop();
|
|
1121
|
-
|
|
1122
901
|
this._shadowColorStack.pop();
|
|
1123
|
-
|
|
1124
902
|
this._shadowOffsetXStack.pop();
|
|
1125
|
-
|
|
1126
903
|
this._shadowOffsetYStack.pop();
|
|
1127
|
-
|
|
1128
904
|
this._strokeStyleStack.pop();
|
|
1129
|
-
|
|
1130
905
|
this._textAlignStack.pop();
|
|
1131
|
-
|
|
1132
906
|
this._textBaselineStack.pop();
|
|
1133
|
-
|
|
1134
907
|
this._stackIndex -= 1;
|
|
1135
908
|
const event = (0, _createCanvasEvent.default)('restore', getTransformSlice(this), {});
|
|
1136
|
-
|
|
1137
909
|
this._events.push(event);
|
|
1138
910
|
}
|
|
1139
|
-
|
|
1140
911
|
rotate(angle) {
|
|
1141
912
|
if (arguments.length < 1) throw new TypeError("Failed to execute 'rotate' on '" + this.constructor.name + "': 1 argument required, but only 0 present.");
|
|
1142
913
|
angle = Number(angle);
|
|
@@ -1154,70 +925,41 @@ class CanvasRenderingContext2D {
|
|
|
1154
925
|
const event = (0, _createCanvasEvent.default)('rotate', getTransformSlice(this), {
|
|
1155
926
|
angle
|
|
1156
927
|
});
|
|
1157
|
-
|
|
1158
928
|
this._events.push(event);
|
|
1159
929
|
}
|
|
1160
|
-
|
|
1161
930
|
save() {
|
|
1162
931
|
const stackIndex = this._stackIndex;
|
|
1163
|
-
|
|
1164
932
|
this._transformStack.push(this._transformStack[stackIndex].slice());
|
|
1165
|
-
|
|
1166
933
|
this._directionStack.push(this._directionStack[stackIndex]);
|
|
1167
|
-
|
|
1168
934
|
this._fillStyleStack.push(this._fillStyleStack[stackIndex]);
|
|
1169
|
-
|
|
1170
935
|
this._filterStack.push(this._filterStack[stackIndex]);
|
|
1171
|
-
|
|
1172
936
|
this._fontStack.push(this._fontStack[stackIndex]);
|
|
1173
|
-
|
|
1174
937
|
this._globalAlphaStack.push(this._globalAlphaStack[stackIndex]);
|
|
1175
|
-
|
|
1176
938
|
this._globalCompositeOperationStack.push(this._globalCompositeOperationStack[stackIndex]);
|
|
1177
|
-
|
|
1178
939
|
this._imageSmoothingEnabledStack.push(this._imageSmoothingEnabledStack[stackIndex]);
|
|
1179
|
-
|
|
1180
940
|
this._imageSmoothingQualityStack.push(this._imageSmoothingQualityStack[stackIndex]);
|
|
1181
|
-
|
|
1182
941
|
this._lineCapStack.push(this._lineCapStack[stackIndex]);
|
|
1183
|
-
|
|
1184
942
|
this._lineDashStack.push(this._lineDashStack[stackIndex]);
|
|
1185
|
-
|
|
1186
943
|
this._lineDashOffsetStack.push(this._lineDashOffsetStack[stackIndex]);
|
|
1187
|
-
|
|
1188
944
|
this._lineJoinStack.push(this._lineJoinStack[stackIndex]);
|
|
1189
|
-
|
|
1190
945
|
this._lineWidthStack.push(this._lineWidthStack[stackIndex]);
|
|
1191
|
-
|
|
1192
946
|
this._miterLimitStack.push(this._miterLimitStack[stackIndex]);
|
|
1193
|
-
|
|
1194
947
|
this._shadowBlurStack.push(this._shadowBlurStack[stackIndex]);
|
|
1195
|
-
|
|
1196
948
|
this._shadowColorStack.push(this._shadowColorStack[stackIndex]);
|
|
1197
|
-
|
|
1198
949
|
this._shadowOffsetXStack.push(this._shadowOffsetXStack[stackIndex]);
|
|
1199
|
-
|
|
1200
950
|
this._shadowOffsetYStack.push(this._shadowOffsetYStack[stackIndex]);
|
|
1201
|
-
|
|
1202
951
|
this._strokeStyleStack.push(this._strokeStyleStack[stackIndex]);
|
|
1203
|
-
|
|
1204
952
|
this._textAlignStack.push(this._textAlignStack[stackIndex]);
|
|
1205
|
-
|
|
1206
953
|
this._textBaselineStack.push(this._textBaselineStack[stackIndex]);
|
|
1207
|
-
|
|
1208
954
|
this._clipStack.push(this._clipStack[stackIndex].slice());
|
|
1209
|
-
|
|
1210
955
|
this._stackIndex = stackIndex + 1;
|
|
1211
956
|
const event = (0, _createCanvasEvent.default)('save', getTransformSlice(this), {});
|
|
1212
|
-
|
|
1213
957
|
this._events.push(event);
|
|
1214
958
|
}
|
|
1215
|
-
|
|
1216
959
|
scale(x, y) {
|
|
1217
960
|
if (arguments.length < 2) throw new TypeError("Failed to execute 'scale' on '" + this.constructor.name + "': 2 arguments required, but only " + arguments.length + ' present.');
|
|
1218
961
|
const xResult = Number(x);
|
|
1219
962
|
const yResult = Number(y);
|
|
1220
|
-
|
|
1221
963
|
if (Number.isFinite(xResult) && Number.isFinite(yResult)) {
|
|
1222
964
|
this._transformStack[this._stackIndex][0] *= xResult;
|
|
1223
965
|
this._transformStack[this._stackIndex][1] *= xResult;
|
|
@@ -1227,43 +969,34 @@ class CanvasRenderingContext2D {
|
|
|
1227
969
|
x: xResult,
|
|
1228
970
|
y: yResult
|
|
1229
971
|
});
|
|
1230
|
-
|
|
1231
972
|
this._events.push(event);
|
|
1232
973
|
}
|
|
1233
974
|
}
|
|
1234
|
-
|
|
1235
975
|
scrollPathIntoView(path) {
|
|
1236
976
|
if (arguments.length > 0 && path instanceof _Path2D.default) path = path._path.slice();else path = this._path.slice();
|
|
1237
977
|
const event = (0, _createCanvasEvent.default)('scrollPathIntoView', getTransformSlice(this), {
|
|
1238
978
|
path
|
|
1239
979
|
});
|
|
1240
|
-
|
|
1241
980
|
this._events.push(event);
|
|
1242
981
|
}
|
|
1243
|
-
|
|
1244
982
|
setLineDash(lineDash) {
|
|
1245
983
|
const isSequence = [Array, Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array].reduce((left, right) => left || lineDash instanceof right, false);
|
|
1246
984
|
if (!isSequence) throw new TypeError("Failed to execute 'setLineDash' on '" + this.constructor.name + "': The provided value cannot be converted to a sequence.");
|
|
1247
985
|
let result = [];
|
|
1248
|
-
|
|
1249
986
|
for (let i = 0; i < lineDash.length; i++) {
|
|
1250
987
|
const value = Number(lineDash[i]);
|
|
1251
|
-
|
|
1252
988
|
if (Number.isFinite(value) && value >= 0) {
|
|
1253
989
|
result.push(value);
|
|
1254
990
|
} else {
|
|
1255
991
|
return;
|
|
1256
992
|
}
|
|
1257
993
|
}
|
|
1258
|
-
|
|
1259
994
|
result = this._lineDashStack[this._stackIndex] = result.length % 2 === 1 ? result.concat(result) : result;
|
|
1260
995
|
const event = (0, _createCanvasEvent.default)('setLineDash', getTransformSlice(this), {
|
|
1261
996
|
segments: result.slice()
|
|
1262
997
|
});
|
|
1263
|
-
|
|
1264
998
|
this._events.push(event);
|
|
1265
999
|
}
|
|
1266
|
-
|
|
1267
1000
|
setTransform(a, b, c, d, e, f) {
|
|
1268
1001
|
if (arguments.length === 0) {
|
|
1269
1002
|
a = 1;
|
|
@@ -1287,7 +1020,6 @@ class CanvasRenderingContext2D {
|
|
|
1287
1020
|
} else if (arguments.length < 6) {
|
|
1288
1021
|
throw new TypeError("Failed to execute 'setTransform' on '" + this.constructor.name + "': Valid arities are: [0, 1, 6], but " + arguments.length + ' arguments provided.');
|
|
1289
1022
|
}
|
|
1290
|
-
|
|
1291
1023
|
a = Number(a);
|
|
1292
1024
|
b = Number(b);
|
|
1293
1025
|
c = Number(c);
|
|
@@ -1309,27 +1041,21 @@ class CanvasRenderingContext2D {
|
|
|
1309
1041
|
e,
|
|
1310
1042
|
f
|
|
1311
1043
|
});
|
|
1312
|
-
|
|
1313
1044
|
this._events.push(event);
|
|
1314
1045
|
}
|
|
1315
|
-
|
|
1316
1046
|
set shadowBlur(value) {
|
|
1317
1047
|
const result = Number(value);
|
|
1318
|
-
|
|
1319
1048
|
if (Number.isFinite(result) && result > 0) {
|
|
1320
1049
|
this._shadowBlurStack[this._stackIndex] = result;
|
|
1321
1050
|
const event = (0, _createCanvasEvent.default)('shadowBlur', getTransformSlice(this), {
|
|
1322
1051
|
value: result
|
|
1323
1052
|
});
|
|
1324
|
-
|
|
1325
1053
|
this._events.push(event);
|
|
1326
1054
|
}
|
|
1327
1055
|
}
|
|
1328
|
-
|
|
1329
1056
|
get shadowBlur() {
|
|
1330
1057
|
return this._shadowBlurStack[this._stackIndex];
|
|
1331
1058
|
}
|
|
1332
|
-
|
|
1333
1059
|
set shadowColor(value) {
|
|
1334
1060
|
if (typeof value === 'string') {
|
|
1335
1061
|
try {
|
|
@@ -1338,53 +1064,41 @@ class CanvasRenderingContext2D {
|
|
|
1338
1064
|
} catch (e) {
|
|
1339
1065
|
return;
|
|
1340
1066
|
}
|
|
1341
|
-
|
|
1342
1067
|
const event = (0, _createCanvasEvent.default)('shadowColor', getTransformSlice(this), {
|
|
1343
1068
|
value
|
|
1344
1069
|
});
|
|
1345
|
-
|
|
1346
1070
|
this._events.push(event);
|
|
1347
1071
|
}
|
|
1348
1072
|
}
|
|
1349
|
-
|
|
1350
1073
|
get shadowColor() {
|
|
1351
1074
|
return this._shadowColorStack[this._stackIndex];
|
|
1352
1075
|
}
|
|
1353
|
-
|
|
1354
1076
|
set shadowOffsetX(value) {
|
|
1355
1077
|
const result = Number(value);
|
|
1356
|
-
|
|
1357
1078
|
if (Number.isFinite(result)) {
|
|
1358
1079
|
this._shadowOffsetXStack[this._stackIndex] = result;
|
|
1359
1080
|
const event = (0, _createCanvasEvent.default)('shadowOffsetX', getTransformSlice(this), {
|
|
1360
1081
|
value: result
|
|
1361
1082
|
});
|
|
1362
|
-
|
|
1363
1083
|
this._events.push(event);
|
|
1364
1084
|
}
|
|
1365
1085
|
}
|
|
1366
|
-
|
|
1367
1086
|
get shadowOffsetX() {
|
|
1368
1087
|
return this._shadowOffsetXStack[this._stackIndex];
|
|
1369
1088
|
}
|
|
1370
|
-
|
|
1371
1089
|
set shadowOffsetY(value) {
|
|
1372
1090
|
const result = Number(value);
|
|
1373
|
-
|
|
1374
1091
|
if (Number.isFinite(result)) {
|
|
1375
1092
|
this._shadowOffsetXStack[this._stackIndex] = result;
|
|
1376
1093
|
const event = (0, _createCanvasEvent.default)('shadowOffsetY', getTransformSlice(this), {
|
|
1377
1094
|
value: result
|
|
1378
1095
|
});
|
|
1379
|
-
|
|
1380
1096
|
this._events.push(event);
|
|
1381
1097
|
}
|
|
1382
1098
|
}
|
|
1383
|
-
|
|
1384
1099
|
get shadowOffsetY() {
|
|
1385
1100
|
return this._shadowOffsetXStack[this._stackIndex];
|
|
1386
1101
|
}
|
|
1387
|
-
|
|
1388
1102
|
stroke(path) {
|
|
1389
1103
|
if (arguments.length === 0) {
|
|
1390
1104
|
path = this._path.slice();
|
|
@@ -1392,16 +1106,12 @@ class CanvasRenderingContext2D {
|
|
|
1392
1106
|
if (!(path instanceof _Path2D.default)) throw new TypeError("Failed to execute 'stroke' on '" + this.constructor.name + "': parameter 1 is not of type 'Path2D'.");
|
|
1393
1107
|
path = path._path.slice();
|
|
1394
1108
|
}
|
|
1395
|
-
|
|
1396
1109
|
const event = (0, _createCanvasEvent.default)('stroke', getTransformSlice(this), {
|
|
1397
1110
|
path
|
|
1398
1111
|
});
|
|
1399
|
-
|
|
1400
1112
|
this._events.push(event);
|
|
1401
|
-
|
|
1402
1113
|
this._drawCalls.push(event);
|
|
1403
1114
|
}
|
|
1404
|
-
|
|
1405
1115
|
strokeRect(x, y, width, height) {
|
|
1406
1116
|
if (arguments.length < 4) throw new TypeError("Failed to execute 'strokeRect' on '" + this.constructor.name + "': 4 arguments required, but only " + arguments.length + ' present.');
|
|
1407
1117
|
x = Number(x);
|
|
@@ -1415,15 +1125,11 @@ class CanvasRenderingContext2D {
|
|
|
1415
1125
|
width,
|
|
1416
1126
|
height
|
|
1417
1127
|
});
|
|
1418
|
-
|
|
1419
1128
|
this._events.push(event);
|
|
1420
|
-
|
|
1421
1129
|
this._drawCalls.push(event);
|
|
1422
1130
|
}
|
|
1423
|
-
|
|
1424
1131
|
set strokeStyle(value) {
|
|
1425
1132
|
let valid = false;
|
|
1426
|
-
|
|
1427
1133
|
if (typeof value === 'string') {
|
|
1428
1134
|
try {
|
|
1429
1135
|
const result = new _mooColor.MooColor(value);
|
|
@@ -1436,20 +1142,16 @@ class CanvasRenderingContext2D {
|
|
|
1436
1142
|
valid = true;
|
|
1437
1143
|
this._strokeStyleStack[this._stackIndex] = value;
|
|
1438
1144
|
}
|
|
1439
|
-
|
|
1440
1145
|
if (valid) {
|
|
1441
1146
|
const event = (0, _createCanvasEvent.default)('strokeStyle', getTransformSlice(this), {
|
|
1442
1147
|
value
|
|
1443
1148
|
});
|
|
1444
|
-
|
|
1445
1149
|
this._events.push(event);
|
|
1446
1150
|
}
|
|
1447
1151
|
}
|
|
1448
|
-
|
|
1449
1152
|
get strokeStyle() {
|
|
1450
1153
|
return this._strokeStyleStack[this._stackIndex];
|
|
1451
1154
|
}
|
|
1452
|
-
|
|
1453
1155
|
strokeText(text, x, y, maxWidth) {
|
|
1454
1156
|
if (arguments.length < 3) throw new TypeError("Failed to execute 'strokeText' on '" + this.constructor.name + "': 3 arguments required, but only " + arguments.length + ' present.');
|
|
1455
1157
|
const textResult = String(text);
|
|
@@ -1464,42 +1166,33 @@ class CanvasRenderingContext2D {
|
|
|
1464
1166
|
y: yResult,
|
|
1465
1167
|
maxWidth: arguments.length === 3 ? null : maxWidthResult
|
|
1466
1168
|
});
|
|
1467
|
-
|
|
1468
1169
|
this._events.push(event);
|
|
1469
|
-
|
|
1470
1170
|
this._drawCalls.push(event);
|
|
1471
1171
|
}
|
|
1472
|
-
|
|
1473
1172
|
set textAlign(value) {
|
|
1474
1173
|
if (value === 'left' || value === 'right' || value === 'center' || value === 'start' || value === 'end') {
|
|
1475
1174
|
this._textAlignStack[this._stackIndex] = value;
|
|
1476
1175
|
const event = (0, _createCanvasEvent.default)('textAlign', getTransformSlice(this), {
|
|
1477
1176
|
value
|
|
1478
1177
|
});
|
|
1479
|
-
|
|
1480
1178
|
this._events.push(event);
|
|
1481
1179
|
}
|
|
1482
1180
|
}
|
|
1483
|
-
|
|
1484
1181
|
get textAlign() {
|
|
1485
1182
|
return this._textAlignStack[this._stackIndex];
|
|
1486
1183
|
}
|
|
1487
|
-
|
|
1488
1184
|
set textBaseline(value) {
|
|
1489
1185
|
if (value === 'top' || value === 'hanging' || value === 'middle' || value === 'alphabetic' || value === 'ideographic' || value === 'bottom') {
|
|
1490
1186
|
this._textBaselineStack[this._stackIndex] = value;
|
|
1491
1187
|
const event = (0, _createCanvasEvent.default)('textBaseline', getTransformSlice(this), {
|
|
1492
1188
|
value
|
|
1493
1189
|
});
|
|
1494
|
-
|
|
1495
1190
|
this._events.push(event);
|
|
1496
1191
|
}
|
|
1497
1192
|
}
|
|
1498
|
-
|
|
1499
1193
|
get textBaseline() {
|
|
1500
1194
|
return this._textBaselineStack[this._stackIndex];
|
|
1501
1195
|
}
|
|
1502
|
-
|
|
1503
1196
|
transform(a, b, c, d, e, f) {
|
|
1504
1197
|
if (arguments.length < 6) throw new TypeError("Failed to execute 'transform' on '" + this.constructor.name + "': 6 arguments required, but only " + arguments.length + ' present.');
|
|
1505
1198
|
a = Number(a);
|
|
@@ -1529,10 +1222,8 @@ class CanvasRenderingContext2D {
|
|
|
1529
1222
|
e,
|
|
1530
1223
|
f
|
|
1531
1224
|
});
|
|
1532
|
-
|
|
1533
1225
|
this._events.push(event);
|
|
1534
1226
|
}
|
|
1535
|
-
|
|
1536
1227
|
translate(x, y) {
|
|
1537
1228
|
if (arguments.length < 2) throw new TypeError("Failed to execute 'translate' on '" + this.constructor.name + "': 2 arguments required, but only " + arguments.length + ' present.');
|
|
1538
1229
|
const xResult = Number(x);
|
|
@@ -1541,7 +1232,6 @@ class CanvasRenderingContext2D {
|
|
|
1541
1232
|
const b = this._transformStack[this._stackIndex][1];
|
|
1542
1233
|
const c = this._transformStack[this._stackIndex][2];
|
|
1543
1234
|
const d = this._transformStack[this._stackIndex][3];
|
|
1544
|
-
|
|
1545
1235
|
if (Number.isFinite(xResult + yResult)) {
|
|
1546
1236
|
this._transformStack[this._stackIndex][4] += a * xResult + c * yResult;
|
|
1547
1237
|
this._transformStack[this._stackIndex][5] += b * xResult + d * yResult;
|
|
@@ -1549,11 +1239,8 @@ class CanvasRenderingContext2D {
|
|
|
1549
1239
|
x: xResult,
|
|
1550
1240
|
y: yResult
|
|
1551
1241
|
});
|
|
1552
|
-
|
|
1553
1242
|
this._events.push(event);
|
|
1554
1243
|
}
|
|
1555
1244
|
}
|
|
1556
|
-
|
|
1557
1245
|
}
|
|
1558
|
-
|
|
1559
1246
|
exports.default = CanvasRenderingContext2D;
|