@antv/g-canvas 1.9.38 → 1.9.40
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/dist/index.esm.js +36 -40
- package/dist/index.js +36 -40
- package/dist/index.umd.js +160 -172
- package/dist/index.umd.min.js +1 -1
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -1682,9 +1682,7 @@
|
|
|
1682
1682
|
if (!isNaN(iterable.length)) {
|
|
1683
1683
|
var i = -1,
|
|
1684
1684
|
next = function next() {
|
|
1685
|
-
for (; ++i < iterable.length;)
|
|
1686
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1687
|
-
}
|
|
1685
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1688
1686
|
return next.value = undefined, next.done = !0, next;
|
|
1689
1687
|
};
|
|
1690
1688
|
return next.next = next;
|
|
@@ -1730,9 +1728,7 @@
|
|
|
1730
1728
|
}), exports.keys = function (val) {
|
|
1731
1729
|
var object = Object(val),
|
|
1732
1730
|
keys = [];
|
|
1733
|
-
for (var key in object)
|
|
1734
|
-
keys.push(key);
|
|
1735
|
-
}
|
|
1731
|
+
for (var key in object) keys.push(key);
|
|
1736
1732
|
return keys.reverse(), function next() {
|
|
1737
1733
|
for (; keys.length;) {
|
|
1738
1734
|
var key = keys.pop();
|
|
@@ -1743,9 +1739,7 @@
|
|
|
1743
1739
|
}, exports.values = values, Context.prototype = {
|
|
1744
1740
|
constructor: Context,
|
|
1745
1741
|
reset: function reset(skipTempReset) {
|
|
1746
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this)
|
|
1747
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
1748
|
-
}
|
|
1742
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
1749
1743
|
},
|
|
1750
1744
|
stop: function stop() {
|
|
1751
1745
|
this.done = !0;
|
|
@@ -1875,9 +1869,7 @@
|
|
|
1875
1869
|
}
|
|
1876
1870
|
function _arrayLikeToArray(arr, len) {
|
|
1877
1871
|
if (len == null || len > arr.length) len = arr.length;
|
|
1878
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
1879
|
-
arr2[i] = arr[i];
|
|
1880
|
-
}
|
|
1872
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1881
1873
|
return arr2;
|
|
1882
1874
|
}
|
|
1883
1875
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
@@ -1934,6 +1926,10 @@
|
|
|
1934
1926
|
}
|
|
1935
1927
|
return false;
|
|
1936
1928
|
};
|
|
1929
|
+
/**
|
|
1930
|
+
* use native picking method
|
|
1931
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/isPointInPath
|
|
1932
|
+
*/
|
|
1937
1933
|
this.isPointInPath = function (runtime, displayObject, position) {
|
|
1938
1934
|
var context = runtime.offscreenCanvas.getOrCreateContext(_this.canvasConfig.offscreenCanvas);
|
|
1939
1935
|
var generatePath = _this.pathGeneratorFactory[displayObject.nodeName];
|
|
@@ -1961,14 +1957,12 @@
|
|
|
1961
1957
|
renderingService.hooks.pick.tapPromise(CanvasPickerPlugin.tag, /*#__PURE__*/function () {
|
|
1962
1958
|
var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee(result) {
|
|
1963
1959
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
1964
|
-
while (1) {
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
return _context.stop();
|
|
1971
|
-
}
|
|
1960
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1961
|
+
case 0:
|
|
1962
|
+
return _context.abrupt("return", _this2.pick(document, result, runtime));
|
|
1963
|
+
case 1:
|
|
1964
|
+
case "end":
|
|
1965
|
+
return _context.stop();
|
|
1972
1966
|
}
|
|
1973
1967
|
}, _callee);
|
|
1974
1968
|
}));
|
|
@@ -3024,9 +3018,7 @@
|
|
|
3024
3018
|
if (!isNaN(iterable.length)) {
|
|
3025
3019
|
var i = -1,
|
|
3026
3020
|
next = function next() {
|
|
3027
|
-
for (; ++i < iterable.length;)
|
|
3028
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
3029
|
-
}
|
|
3021
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
3030
3022
|
return next.value = undefined, next.done = !0, next;
|
|
3031
3023
|
};
|
|
3032
3024
|
return next.next = next;
|
|
@@ -3072,9 +3064,7 @@
|
|
|
3072
3064
|
}), exports.keys = function (val) {
|
|
3073
3065
|
var object = Object(val),
|
|
3074
3066
|
keys = [];
|
|
3075
|
-
for (var key in object)
|
|
3076
|
-
keys.push(key);
|
|
3077
|
-
}
|
|
3067
|
+
for (var key in object) keys.push(key);
|
|
3078
3068
|
return keys.reverse(), function next() {
|
|
3079
3069
|
for (; keys.length;) {
|
|
3080
3070
|
var key = keys.pop();
|
|
@@ -3085,9 +3075,7 @@
|
|
|
3085
3075
|
}, exports.values = values, Context.prototype = {
|
|
3086
3076
|
constructor: Context,
|
|
3087
3077
|
reset: function reset(skipTempReset) {
|
|
3088
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this)
|
|
3089
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
3090
|
-
}
|
|
3078
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
3091
3079
|
},
|
|
3092
3080
|
stop: function stop() {
|
|
3093
3081
|
this.done = !0;
|
|
@@ -3239,8 +3227,14 @@
|
|
|
3239
3227
|
this.rBush = void 0;
|
|
3240
3228
|
this.removedRBushNodeAABBs = [];
|
|
3241
3229
|
this.renderQueue = [];
|
|
3230
|
+
/**
|
|
3231
|
+
* This stack is only used by clipPath for now.
|
|
3232
|
+
*/
|
|
3242
3233
|
this.restoreStack = [];
|
|
3243
3234
|
this.clearFullScreen = false;
|
|
3235
|
+
/**
|
|
3236
|
+
* view projection matrix
|
|
3237
|
+
*/
|
|
3244
3238
|
this.vpMatrix = create();
|
|
3245
3239
|
this.dprMatrix = create();
|
|
3246
3240
|
this.tmpMat4 = create();
|
|
@@ -3286,20 +3280,18 @@
|
|
|
3286
3280
|
renderingService.hooks.init.tapPromise(CanvasRendererPlugin.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
3287
3281
|
var dpr, width, height, context;
|
|
3288
3282
|
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
3289
|
-
while (1) {
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
return _context.stop();
|
|
3302
|
-
}
|
|
3283
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3284
|
+
case 0:
|
|
3285
|
+
canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
3286
|
+
canvas.addEventListener(gLite.ElementEvent.CULLED, handleCulled);
|
|
3287
|
+
// clear fullscreen
|
|
3288
|
+
dpr = contextService.getDPR();
|
|
3289
|
+
width = config.width, height = config.height;
|
|
3290
|
+
context = contextService.getContext();
|
|
3291
|
+
_this.clearRect(context, 0, 0, width * dpr, height * dpr, config.background);
|
|
3292
|
+
case 6:
|
|
3293
|
+
case "end":
|
|
3294
|
+
return _context.stop();
|
|
3303
3295
|
}
|
|
3304
3296
|
}, _callee);
|
|
3305
3297
|
})));
|
|
@@ -3326,7 +3318,7 @@
|
|
|
3326
3318
|
var ratio = rendered / total;
|
|
3327
3319
|
_this.clearFullScreen = renderingService.disableDirtyRectangleRendering() || rendered > dirtyObjectNumThreshold && ratio > dirtyObjectRatioThreshold;
|
|
3328
3320
|
if (context) {
|
|
3329
|
-
context.resetTransform();
|
|
3321
|
+
context.resetTransform ? context.resetTransform() : context.setTransform(1, 0, 0, 1, 0, 0);
|
|
3330
3322
|
if (_this.clearFullScreen) {
|
|
3331
3323
|
_this.clearRect(context, 0, 0, width * dpr, height * dpr, config.background);
|
|
3332
3324
|
}
|
|
@@ -3736,13 +3728,13 @@
|
|
|
3736
3728
|
if (Array.isArray(_fill)) {
|
|
3737
3729
|
_fill.forEach(function (gradient) {
|
|
3738
3730
|
context.fillStyle = _this.getColor(gradient, object, context);
|
|
3739
|
-
context.fill(fillRule);
|
|
3731
|
+
fillRule ? context.fill(fillRule) : context.fill();
|
|
3740
3732
|
});
|
|
3741
3733
|
} else {
|
|
3742
3734
|
if (gLite.isPattern(_fill)) {
|
|
3743
3735
|
context.fillStyle = this.getPattern(_fill, object, context, canvasContext, plugin, runtime);
|
|
3744
3736
|
}
|
|
3745
|
-
context.fill(fillRule);
|
|
3737
|
+
fillRule ? context.fill(fillRule) : context.fill();
|
|
3746
3738
|
}
|
|
3747
3739
|
};
|
|
3748
3740
|
_proto.stroke = function stroke(context, object, _stroke, canvasContext, plugin, runtime) {
|
|
@@ -3890,10 +3882,11 @@
|
|
|
3890
3882
|
context.lineWidth = lineWidth;
|
|
3891
3883
|
context.textAlign = textAlign === 'middle' ? 'center' : textAlign;
|
|
3892
3884
|
var formattedTextBaseline = textBaseline;
|
|
3893
|
-
if (
|
|
3894
|
-
|
|
3885
|
+
if (
|
|
3886
|
+
// formattedTextBaseline === 'bottom' ||
|
|
3887
|
+
!gLite.runtime.enableCSSParsing && formattedTextBaseline === 'alphabetic') {
|
|
3888
|
+
formattedTextBaseline = 'bottom';
|
|
3895
3889
|
}
|
|
3896
|
-
context.textBaseline = formattedTextBaseline;
|
|
3897
3890
|
context.lineJoin = lineJoin;
|
|
3898
3891
|
if (!isNil(miterLimit)) {
|
|
3899
3892
|
context.miterLimit = miterLimit;
|
|
@@ -3910,6 +3903,16 @@
|
|
|
3910
3903
|
// account for dx & dy
|
|
3911
3904
|
var offsetX = dx || 0;
|
|
3912
3905
|
linePositionY += dy || 0;
|
|
3906
|
+
if (lines.length === 1) {
|
|
3907
|
+
if (formattedTextBaseline === 'bottom') {
|
|
3908
|
+
formattedTextBaseline = 'middle';
|
|
3909
|
+
linePositionY -= 0.5 * height;
|
|
3910
|
+
} else if (formattedTextBaseline === 'top') {
|
|
3911
|
+
formattedTextBaseline = 'middle';
|
|
3912
|
+
linePositionY += 0.5 * height;
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
context.textBaseline = formattedTextBaseline;
|
|
3913
3916
|
var hasShadow = !isNil(shadowColor) && shadowBlur > 0;
|
|
3914
3917
|
setShadowAndFilter(object, context, hasShadow);
|
|
3915
3918
|
// draw lines line by line
|
|
@@ -4255,9 +4258,7 @@
|
|
|
4255
4258
|
if (!isNaN(iterable.length)) {
|
|
4256
4259
|
var i = -1,
|
|
4257
4260
|
next = function next() {
|
|
4258
|
-
for (; ++i < iterable.length;)
|
|
4259
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
4260
|
-
}
|
|
4261
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
4261
4262
|
return next.value = undefined, next.done = !0, next;
|
|
4262
4263
|
};
|
|
4263
4264
|
return next.next = next;
|
|
@@ -4303,9 +4304,7 @@
|
|
|
4303
4304
|
}), exports.keys = function (val) {
|
|
4304
4305
|
var object = Object(val),
|
|
4305
4306
|
keys = [];
|
|
4306
|
-
for (var key in object)
|
|
4307
|
-
keys.push(key);
|
|
4308
|
-
}
|
|
4307
|
+
for (var key in object) keys.push(key);
|
|
4309
4308
|
return keys.reverse(), function next() {
|
|
4310
4309
|
for (; keys.length;) {
|
|
4311
4310
|
var key = keys.pop();
|
|
@@ -4316,9 +4315,7 @@
|
|
|
4316
4315
|
}, exports.values = values, Context.prototype = {
|
|
4317
4316
|
constructor: Context,
|
|
4318
4317
|
reset: function reset(skipTempReset) {
|
|
4319
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this)
|
|
4320
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
4321
|
-
}
|
|
4318
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
4322
4319
|
},
|
|
4323
4320
|
stop: function stop() {
|
|
4324
4321
|
this.done = !0;
|
|
@@ -4451,7 +4448,8 @@
|
|
|
4451
4448
|
_proto.apply = function apply(context, runtime) {
|
|
4452
4449
|
var _this = this;
|
|
4453
4450
|
var renderingService = context.renderingService,
|
|
4454
|
-
renderingContext = context.renderingContext
|
|
4451
|
+
renderingContext = context.renderingContext,
|
|
4452
|
+
config = context.config;
|
|
4455
4453
|
this.context = context;
|
|
4456
4454
|
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
4457
4455
|
// const SUPPORT_ONLY_TOUCH = canvas.supportsTouchEvents && MOBILE_REGEX.test(navigator.userAgent);
|
|
@@ -4476,6 +4474,9 @@
|
|
|
4476
4474
|
var onPointerWheel = function onPointerWheel(ev) {
|
|
4477
4475
|
renderingService.hooks.pointerWheel.call(ev);
|
|
4478
4476
|
};
|
|
4477
|
+
var onClick = function onClick(ev) {
|
|
4478
|
+
renderingService.hooks.click.call(ev);
|
|
4479
|
+
};
|
|
4479
4480
|
var addPointerEventListener = function addPointerEventListener($el) {
|
|
4480
4481
|
runtime.globalThis.document.addEventListener('pointermove', onPointerMove, true);
|
|
4481
4482
|
$el.addEventListener('pointerdown', onPointerDown, true);
|
|
@@ -4519,36 +4520,37 @@
|
|
|
4519
4520
|
renderingService.hooks.init.tapPromise(DOMInteractionPlugin.tag, /*#__PURE__*/_asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee() {
|
|
4520
4521
|
var $el;
|
|
4521
4522
|
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
4522
|
-
while (1) {
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4523
|
+
while (1) switch (_context.prev = _context.next) {
|
|
4524
|
+
case 0:
|
|
4525
|
+
$el = _this.context.contextService.getDomElement(); // @ts-ignore
|
|
4526
|
+
if (runtime.globalThis.navigator.msPointerEnabled) {
|
|
4527
|
+
// @ts-ignore
|
|
4528
|
+
$el.style.msContentZooming = 'none';
|
|
4529
|
+
// @ts-ignore
|
|
4530
|
+
$el.style.msTouchAction = 'none';
|
|
4531
|
+
} else if (canvas.supportsPointerEvents) {
|
|
4532
|
+
$el.style.touchAction = 'none';
|
|
4533
|
+
}
|
|
4534
|
+
if (canvas.supportsPointerEvents) {
|
|
4535
|
+
addPointerEventListener($el);
|
|
4536
|
+
} else {
|
|
4537
|
+
addMouseEventListener($el);
|
|
4538
|
+
}
|
|
4539
|
+
if (canvas.supportsTouchEvents) {
|
|
4540
|
+
addTouchEventListener($el);
|
|
4541
|
+
}
|
|
4542
|
+
if (config.useNativeClickEvent) {
|
|
4543
|
+
$el.addEventListener('click', onClick, true);
|
|
4544
|
+
}
|
|
4545
|
+
// use passive event listeners
|
|
4546
|
+
// @see https://zhuanlan.zhihu.com/p/24555031
|
|
4547
|
+
$el.addEventListener('wheel', onPointerWheel, {
|
|
4548
|
+
passive: true,
|
|
4549
|
+
capture: true
|
|
4550
|
+
});
|
|
4551
|
+
case 6:
|
|
4552
|
+
case "end":
|
|
4553
|
+
return _context.stop();
|
|
4552
4554
|
}
|
|
4553
4555
|
}, _callee);
|
|
4554
4556
|
})));
|
|
@@ -4571,6 +4573,9 @@
|
|
|
4571
4573
|
if (canvas.supportsTouchEvents) {
|
|
4572
4574
|
removeTouchEventListener($el);
|
|
4573
4575
|
}
|
|
4576
|
+
if (config.useNativeClickEvent) {
|
|
4577
|
+
$el.removeEventListener('click', onClick, true);
|
|
4578
|
+
}
|
|
4574
4579
|
$el.removeEventListener('wheel', onPointerWheel, true);
|
|
4575
4580
|
});
|
|
4576
4581
|
};
|
|
@@ -4769,9 +4774,7 @@
|
|
|
4769
4774
|
if (!isNaN(iterable.length)) {
|
|
4770
4775
|
var i = -1,
|
|
4771
4776
|
next = function next() {
|
|
4772
|
-
for (; ++i < iterable.length;)
|
|
4773
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
4774
|
-
}
|
|
4777
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
4775
4778
|
return next.value = undefined, next.done = !0, next;
|
|
4776
4779
|
};
|
|
4777
4780
|
return next.next = next;
|
|
@@ -4817,9 +4820,7 @@
|
|
|
4817
4820
|
}), exports.keys = function (val) {
|
|
4818
4821
|
var object = Object(val),
|
|
4819
4822
|
keys = [];
|
|
4820
|
-
for (var key in object)
|
|
4821
|
-
keys.push(key);
|
|
4822
|
-
}
|
|
4823
|
+
for (var key in object) keys.push(key);
|
|
4823
4824
|
return keys.reverse(), function next() {
|
|
4824
4825
|
for (; keys.length;) {
|
|
4825
4826
|
var key = keys.pop();
|
|
@@ -4830,9 +4831,7 @@
|
|
|
4830
4831
|
}, exports.values = values, Context.prototype = {
|
|
4831
4832
|
constructor: Context,
|
|
4832
4833
|
reset: function reset(skipTempReset) {
|
|
4833
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this)
|
|
4834
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
4835
|
-
}
|
|
4834
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
4836
4835
|
},
|
|
4837
4836
|
stop: function stop() {
|
|
4838
4837
|
this.done = !0;
|
|
@@ -4957,6 +4956,9 @@
|
|
|
4957
4956
|
var HTMLRenderingPlugin = /*#__PURE__*/function () {
|
|
4958
4957
|
function HTMLRenderingPlugin() {
|
|
4959
4958
|
this.context = void 0;
|
|
4959
|
+
/**
|
|
4960
|
+
* wrapper for camera
|
|
4961
|
+
*/
|
|
4960
4962
|
this.$camera = void 0;
|
|
4961
4963
|
}
|
|
4962
4964
|
var _proto = HTMLRenderingPlugin.prototype;
|
|
@@ -5034,22 +5036,20 @@
|
|
|
5034
5036
|
};
|
|
5035
5037
|
renderingService.hooks.init.tapPromise(HTMLRenderingPlugin.tag, /*#__PURE__*/_asyncToGenerator$4( /*#__PURE__*/_regeneratorRuntime$4().mark(function _callee() {
|
|
5036
5038
|
return _regeneratorRuntime$4().wrap(function _callee$(_context) {
|
|
5037
|
-
while (1) {
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
return _context.stop();
|
|
5052
|
-
}
|
|
5039
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5040
|
+
case 0:
|
|
5041
|
+
if (displayObjectPool.getHTMLs().length) {
|
|
5042
|
+
// append camera
|
|
5043
|
+
_this.$camera = _this.createCamera(camera);
|
|
5044
|
+
}
|
|
5045
|
+
canvas.addEventListener(gLite.CanvasEvent.RESIZE, handleCanvasResize);
|
|
5046
|
+
canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
5047
|
+
canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
5048
|
+
canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
5049
|
+
canvas.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
5050
|
+
case 6:
|
|
5051
|
+
case "end":
|
|
5052
|
+
return _context.stop();
|
|
5053
5053
|
}
|
|
5054
5054
|
}, _callee);
|
|
5055
5055
|
})));
|
|
@@ -5416,9 +5416,7 @@
|
|
|
5416
5416
|
if (!isNaN(iterable.length)) {
|
|
5417
5417
|
var i = -1,
|
|
5418
5418
|
next = function next() {
|
|
5419
|
-
for (; ++i < iterable.length;)
|
|
5420
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
5421
|
-
}
|
|
5419
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
5422
5420
|
return next.value = undefined, next.done = !0, next;
|
|
5423
5421
|
};
|
|
5424
5422
|
return next.next = next;
|
|
@@ -5464,9 +5462,7 @@
|
|
|
5464
5462
|
}), exports.keys = function (val) {
|
|
5465
5463
|
var object = Object(val),
|
|
5466
5464
|
keys = [];
|
|
5467
|
-
for (var key in object)
|
|
5468
|
-
keys.push(key);
|
|
5469
|
-
}
|
|
5465
|
+
for (var key in object) keys.push(key);
|
|
5470
5466
|
return keys.reverse(), function next() {
|
|
5471
5467
|
for (; keys.length;) {
|
|
5472
5468
|
var key = keys.pop();
|
|
@@ -5477,9 +5473,7 @@
|
|
|
5477
5473
|
}, exports.values = values, Context.prototype = {
|
|
5478
5474
|
constructor: Context,
|
|
5479
5475
|
reset: function reset(skipTempReset) {
|
|
5480
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this)
|
|
5481
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
5482
|
-
}
|
|
5476
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
5483
5477
|
},
|
|
5484
5478
|
stop: function stop() {
|
|
5485
5479
|
this.done = !0;
|
|
@@ -5912,15 +5906,13 @@
|
|
|
5912
5906
|
};
|
|
5913
5907
|
renderingService.hooks.init.tapPromise(LoadImagePlugin.tag, /*#__PURE__*/_asyncToGenerator$5( /*#__PURE__*/_regeneratorRuntime$5().mark(function _callee() {
|
|
5914
5908
|
return _regeneratorRuntime$5().wrap(function _callee$(_context) {
|
|
5915
|
-
while (1) {
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
return _context.stop();
|
|
5923
|
-
}
|
|
5909
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5910
|
+
case 0:
|
|
5911
|
+
canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
5912
|
+
canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
5913
|
+
case 2:
|
|
5914
|
+
case "end":
|
|
5915
|
+
return _context.stop();
|
|
5924
5916
|
}
|
|
5925
5917
|
}, _callee);
|
|
5926
5918
|
})));
|
|
@@ -5977,36 +5969,34 @@
|
|
|
5977
5969
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5978
5970
|
var _this$canvasConfig, container, canvas, $canvas;
|
|
5979
5971
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5980
|
-
while (1) {
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
this.$container.style.position = 'relative';
|
|
6000
|
-
}
|
|
6001
|
-
this.$canvas = $canvas;
|
|
5972
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5973
|
+
case 0:
|
|
5974
|
+
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas;
|
|
5975
|
+
if (canvas) {
|
|
5976
|
+
this.$canvas = canvas;
|
|
5977
|
+
if (container && canvas.parentElement !== container) {
|
|
5978
|
+
container.appendChild(canvas);
|
|
5979
|
+
}
|
|
5980
|
+
this.$container = canvas.parentElement;
|
|
5981
|
+
this.canvasConfig.container = this.$container;
|
|
5982
|
+
} else if (container) {
|
|
5983
|
+
// create container
|
|
5984
|
+
this.$container = isString(container) ? document.getElementById(container) : container;
|
|
5985
|
+
if (this.$container) {
|
|
5986
|
+
// create canvas
|
|
5987
|
+
$canvas = document.createElement('canvas');
|
|
5988
|
+
this.$container.appendChild($canvas);
|
|
5989
|
+
if (!this.$container.style.position) {
|
|
5990
|
+
this.$container.style.position = 'relative';
|
|
6002
5991
|
}
|
|
5992
|
+
this.$canvas = $canvas;
|
|
6003
5993
|
}
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
5994
|
+
}
|
|
5995
|
+
this.context = this.$canvas.getContext('2d');
|
|
5996
|
+
this.resize(this.canvasConfig.width, this.canvasConfig.height);
|
|
5997
|
+
case 4:
|
|
5998
|
+
case "end":
|
|
5999
|
+
return _context.stop();
|
|
6010
6000
|
}
|
|
6011
6001
|
}, _callee, this);
|
|
6012
6002
|
}));
|
|
@@ -6066,18 +6056,16 @@
|
|
|
6066
6056
|
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
6067
6057
|
var _options, type, encoderOptions;
|
|
6068
6058
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6069
|
-
while (1) {
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
return _context2.stop();
|
|
6080
|
-
}
|
|
6059
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
6060
|
+
case 0:
|
|
6061
|
+
if (options === void 0) {
|
|
6062
|
+
options = {};
|
|
6063
|
+
}
|
|
6064
|
+
_options = options, type = _options.type, encoderOptions = _options.encoderOptions;
|
|
6065
|
+
return _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
|
|
6066
|
+
case 3:
|
|
6067
|
+
case "end":
|
|
6068
|
+
return _context2.stop();
|
|
6081
6069
|
}
|
|
6082
6070
|
}, _callee2, this);
|
|
6083
6071
|
}));
|