@antv/g-canvas 1.9.39 → 1.9.41

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.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
- switch (_context.prev = _context.next) {
1966
- case 0:
1967
- return _context.abrupt("return", _this2.pick(document, result, runtime));
1968
- case 1:
1969
- case "end":
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
- switch (_context.prev = _context.next) {
3291
- case 0:
3292
- canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
3293
- canvas.addEventListener(gLite.ElementEvent.CULLED, handleCulled);
3294
- // clear fullscreen
3295
- dpr = contextService.getDPR();
3296
- width = config.width, height = config.height;
3297
- context = contextService.getContext();
3298
- _this.clearRect(context, 0, 0, width * dpr, height * dpr, config.background);
3299
- case 6:
3300
- case "end":
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
  })));
@@ -3416,7 +3408,7 @@
3416
3408
  }));
3417
3409
  }
3418
3410
  // search objects intersect with dirty rectangle
3419
- var dirtyObjects = _this.searchDirtyObjects(runtime, dirtyRenderBounds);
3411
+ var dirtyObjects = _this.searchDirtyObjects(dirtyRenderBounds);
3420
3412
  // do rendering
3421
3413
  dirtyObjects
3422
3414
  // sort by z-index
@@ -3546,7 +3538,7 @@
3546
3538
  });
3547
3539
  return aabb;
3548
3540
  };
3549
- _proto.searchDirtyObjects = function searchDirtyObjects(runtime, dirtyRectangle) {
3541
+ _proto.searchDirtyObjects = function searchDirtyObjects(dirtyRectangle) {
3550
3542
  // search in r-tree, get all affected nodes
3551
3543
  var _dirtyRectangle$getMi = dirtyRectangle.getMin(),
3552
3544
  minX = _dirtyRectangle$getMi[0],
@@ -3561,8 +3553,8 @@
3561
3553
  maxY: maxY
3562
3554
  });
3563
3555
  return rBushNodes.map(function (_ref3) {
3564
- var id = _ref3.id;
3565
- return runtime.displayObjectPool.getByEntity(id);
3556
+ var displayObject = _ref3.displayObject;
3557
+ return displayObject;
3566
3558
  });
3567
3559
  };
3568
3560
  _proto.saveDirtyAABB = function saveDirtyAABB(object) {
@@ -4266,9 +4258,7 @@
4266
4258
  if (!isNaN(iterable.length)) {
4267
4259
  var i = -1,
4268
4260
  next = function next() {
4269
- for (; ++i < iterable.length;) {
4270
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
4271
- }
4261
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
4272
4262
  return next.value = undefined, next.done = !0, next;
4273
4263
  };
4274
4264
  return next.next = next;
@@ -4314,9 +4304,7 @@
4314
4304
  }), exports.keys = function (val) {
4315
4305
  var object = Object(val),
4316
4306
  keys = [];
4317
- for (var key in object) {
4318
- keys.push(key);
4319
- }
4307
+ for (var key in object) keys.push(key);
4320
4308
  return keys.reverse(), function next() {
4321
4309
  for (; keys.length;) {
4322
4310
  var key = keys.pop();
@@ -4327,9 +4315,7 @@
4327
4315
  }, exports.values = values, Context.prototype = {
4328
4316
  constructor: Context,
4329
4317
  reset: function reset(skipTempReset) {
4330
- 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) {
4331
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
4332
- }
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);
4333
4319
  },
4334
4320
  stop: function stop() {
4335
4321
  this.done = !0;
@@ -4462,7 +4448,8 @@
4462
4448
  _proto.apply = function apply(context, runtime) {
4463
4449
  var _this = this;
4464
4450
  var renderingService = context.renderingService,
4465
- renderingContext = context.renderingContext;
4451
+ renderingContext = context.renderingContext,
4452
+ config = context.config;
4466
4453
  this.context = context;
4467
4454
  var canvas = renderingContext.root.ownerDocument.defaultView;
4468
4455
  // const SUPPORT_ONLY_TOUCH = canvas.supportsTouchEvents && MOBILE_REGEX.test(navigator.userAgent);
@@ -4487,6 +4474,9 @@
4487
4474
  var onPointerWheel = function onPointerWheel(ev) {
4488
4475
  renderingService.hooks.pointerWheel.call(ev);
4489
4476
  };
4477
+ var onClick = function onClick(ev) {
4478
+ renderingService.hooks.click.call(ev);
4479
+ };
4490
4480
  var addPointerEventListener = function addPointerEventListener($el) {
4491
4481
  runtime.globalThis.document.addEventListener('pointermove', onPointerMove, true);
4492
4482
  $el.addEventListener('pointerdown', onPointerDown, true);
@@ -4530,36 +4520,37 @@
4530
4520
  renderingService.hooks.init.tapPromise(DOMInteractionPlugin.tag, /*#__PURE__*/_asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee() {
4531
4521
  var $el;
4532
4522
  return _regeneratorRuntime$3().wrap(function _callee$(_context) {
4533
- while (1) {
4534
- switch (_context.prev = _context.next) {
4535
- case 0:
4536
- $el = _this.context.contextService.getDomElement(); // @ts-ignore
4537
- if (runtime.globalThis.navigator.msPointerEnabled) {
4538
- // @ts-ignore
4539
- $el.style.msContentZooming = 'none';
4540
- // @ts-ignore
4541
- $el.style.msTouchAction = 'none';
4542
- } else if (canvas.supportsPointerEvents) {
4543
- $el.style.touchAction = 'none';
4544
- }
4545
- if (canvas.supportsPointerEvents) {
4546
- addPointerEventListener($el);
4547
- } else {
4548
- addMouseEventListener($el);
4549
- }
4550
- if (canvas.supportsTouchEvents) {
4551
- addTouchEventListener($el);
4552
- }
4553
- // use passive event listeners
4554
- // @see https://zhuanlan.zhihu.com/p/24555031
4555
- $el.addEventListener('wheel', onPointerWheel, {
4556
- passive: true,
4557
- capture: true
4558
- });
4559
- case 5:
4560
- case "end":
4561
- return _context.stop();
4562
- }
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();
4563
4554
  }
4564
4555
  }, _callee);
4565
4556
  })));
@@ -4582,6 +4573,9 @@
4582
4573
  if (canvas.supportsTouchEvents) {
4583
4574
  removeTouchEventListener($el);
4584
4575
  }
4576
+ if (config.useNativeClickEvent) {
4577
+ $el.removeEventListener('click', onClick, true);
4578
+ }
4585
4579
  $el.removeEventListener('wheel', onPointerWheel, true);
4586
4580
  });
4587
4581
  };
@@ -4780,9 +4774,7 @@
4780
4774
  if (!isNaN(iterable.length)) {
4781
4775
  var i = -1,
4782
4776
  next = function next() {
4783
- for (; ++i < iterable.length;) {
4784
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
4785
- }
4777
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
4786
4778
  return next.value = undefined, next.done = !0, next;
4787
4779
  };
4788
4780
  return next.next = next;
@@ -4828,9 +4820,7 @@
4828
4820
  }), exports.keys = function (val) {
4829
4821
  var object = Object(val),
4830
4822
  keys = [];
4831
- for (var key in object) {
4832
- keys.push(key);
4833
- }
4823
+ for (var key in object) keys.push(key);
4834
4824
  return keys.reverse(), function next() {
4835
4825
  for (; keys.length;) {
4836
4826
  var key = keys.pop();
@@ -4841,9 +4831,7 @@
4841
4831
  }, exports.values = values, Context.prototype = {
4842
4832
  constructor: Context,
4843
4833
  reset: function reset(skipTempReset) {
4844
- 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) {
4845
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
4846
- }
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);
4847
4835
  },
4848
4836
  stop: function stop() {
4849
4837
  this.done = !0;
@@ -4968,6 +4956,9 @@
4968
4956
  var HTMLRenderingPlugin = /*#__PURE__*/function () {
4969
4957
  function HTMLRenderingPlugin() {
4970
4958
  this.context = void 0;
4959
+ /**
4960
+ * wrapper for camera
4961
+ */
4971
4962
  this.$camera = void 0;
4972
4963
  }
4973
4964
  var _proto = HTMLRenderingPlugin.prototype;
@@ -4978,8 +4969,7 @@
4978
4969
  var _this = this;
4979
4970
  var camera = context.camera,
4980
4971
  renderingContext = context.renderingContext,
4981
- renderingService = context.renderingService,
4982
- displayObjectPool = context.displayObjectPool;
4972
+ renderingService = context.renderingService;
4983
4973
  this.context = context;
4984
4974
  var canvas = renderingContext.root.ownerDocument.defaultView;
4985
4975
  var setTransform = function setTransform(object, $el) {
@@ -5003,6 +4993,7 @@
5003
4993
  _this.updateAttribute(name, object);
5004
4994
  });
5005
4995
  setTransform(object, $el);
4996
+ gLite.runtime.nativeHTMLMap.set($el, object);
5006
4997
  }
5007
4998
  };
5008
4999
  var handleUnmounted = function handleUnmounted(e) {
@@ -5011,6 +5002,7 @@
5011
5002
  var $el = _this.getOrCreateEl(object);
5012
5003
  if ($el) {
5013
5004
  $el.remove();
5005
+ gLite.runtime.nativeHTMLMap.delete($el);
5014
5006
  }
5015
5007
  // const existedId = this.getId(object);
5016
5008
  // const $existedElement: HTMLElement | null = this.$camera.querySelector('#' + existedId);
@@ -5045,22 +5037,16 @@
5045
5037
  };
5046
5038
  renderingService.hooks.init.tapPromise(HTMLRenderingPlugin.tag, /*#__PURE__*/_asyncToGenerator$4( /*#__PURE__*/_regeneratorRuntime$4().mark(function _callee() {
5047
5039
  return _regeneratorRuntime$4().wrap(function _callee$(_context) {
5048
- while (1) {
5049
- switch (_context.prev = _context.next) {
5050
- case 0:
5051
- if (displayObjectPool.getHTMLs().length) {
5052
- // append camera
5053
- _this.$camera = _this.createCamera(camera);
5054
- }
5055
- canvas.addEventListener(gLite.CanvasEvent.RESIZE, handleCanvasResize);
5056
- canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
5057
- canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
5058
- canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
5059
- canvas.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
5060
- case 6:
5061
- case "end":
5062
- return _context.stop();
5063
- }
5040
+ while (1) switch (_context.prev = _context.next) {
5041
+ case 0:
5042
+ canvas.addEventListener(gLite.CanvasEvent.RESIZE, handleCanvasResize);
5043
+ canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
5044
+ canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
5045
+ canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
5046
+ canvas.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
5047
+ case 5:
5048
+ case "end":
5049
+ return _context.stop();
5064
5050
  }
5065
5051
  }, _callee);
5066
5052
  })));
@@ -5427,9 +5413,7 @@
5427
5413
  if (!isNaN(iterable.length)) {
5428
5414
  var i = -1,
5429
5415
  next = function next() {
5430
- for (; ++i < iterable.length;) {
5431
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
5432
- }
5416
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
5433
5417
  return next.value = undefined, next.done = !0, next;
5434
5418
  };
5435
5419
  return next.next = next;
@@ -5475,9 +5459,7 @@
5475
5459
  }), exports.keys = function (val) {
5476
5460
  var object = Object(val),
5477
5461
  keys = [];
5478
- for (var key in object) {
5479
- keys.push(key);
5480
- }
5462
+ for (var key in object) keys.push(key);
5481
5463
  return keys.reverse(), function next() {
5482
5464
  for (; keys.length;) {
5483
5465
  var key = keys.pop();
@@ -5488,9 +5470,7 @@
5488
5470
  }, exports.values = values, Context.prototype = {
5489
5471
  constructor: Context,
5490
5472
  reset: function reset(skipTempReset) {
5491
- 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) {
5492
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
5493
- }
5473
+ 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);
5494
5474
  },
5495
5475
  stop: function stop() {
5496
5476
  this.done = !0;
@@ -5923,15 +5903,13 @@
5923
5903
  };
5924
5904
  renderingService.hooks.init.tapPromise(LoadImagePlugin.tag, /*#__PURE__*/_asyncToGenerator$5( /*#__PURE__*/_regeneratorRuntime$5().mark(function _callee() {
5925
5905
  return _regeneratorRuntime$5().wrap(function _callee$(_context) {
5926
- while (1) {
5927
- switch (_context.prev = _context.next) {
5928
- case 0:
5929
- canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
5930
- canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
5931
- case 2:
5932
- case "end":
5933
- return _context.stop();
5934
- }
5906
+ while (1) switch (_context.prev = _context.next) {
5907
+ case 0:
5908
+ canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
5909
+ canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
5910
+ case 2:
5911
+ case "end":
5912
+ return _context.stop();
5935
5913
  }
5936
5914
  }, _callee);
5937
5915
  })));
@@ -5988,36 +5966,34 @@
5988
5966
  var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5989
5967
  var _this$canvasConfig, container, canvas, $canvas;
5990
5968
  return _regeneratorRuntime().wrap(function _callee$(_context) {
5991
- while (1) {
5992
- switch (_context.prev = _context.next) {
5993
- case 0:
5994
- _this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas;
5995
- if (canvas) {
5996
- this.$canvas = canvas;
5997
- if (container && canvas.parentElement !== container) {
5998
- container.appendChild(canvas);
5999
- }
6000
- this.$container = canvas.parentElement;
6001
- this.canvasConfig.container = this.$container;
6002
- } else if (container) {
6003
- // create container
6004
- this.$container = isString(container) ? document.getElementById(container) : container;
6005
- if (this.$container) {
6006
- // create canvas
6007
- $canvas = document.createElement('canvas');
6008
- this.$container.appendChild($canvas);
6009
- if (!this.$container.style.position) {
6010
- this.$container.style.position = 'relative';
6011
- }
6012
- this.$canvas = $canvas;
5969
+ while (1) switch (_context.prev = _context.next) {
5970
+ case 0:
5971
+ _this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas;
5972
+ if (canvas) {
5973
+ this.$canvas = canvas;
5974
+ if (container && canvas.parentElement !== container) {
5975
+ container.appendChild(canvas);
5976
+ }
5977
+ this.$container = canvas.parentElement;
5978
+ this.canvasConfig.container = this.$container;
5979
+ } else if (container) {
5980
+ // create container
5981
+ this.$container = isString(container) ? document.getElementById(container) : container;
5982
+ if (this.$container) {
5983
+ // create canvas
5984
+ $canvas = document.createElement('canvas');
5985
+ this.$container.appendChild($canvas);
5986
+ if (!this.$container.style.position) {
5987
+ this.$container.style.position = 'relative';
6013
5988
  }
5989
+ this.$canvas = $canvas;
6014
5990
  }
6015
- this.context = this.$canvas.getContext('2d');
6016
- this.resize(this.canvasConfig.width, this.canvasConfig.height);
6017
- case 4:
6018
- case "end":
6019
- return _context.stop();
6020
- }
5991
+ }
5992
+ this.context = this.$canvas.getContext('2d');
5993
+ this.resize(this.canvasConfig.width, this.canvasConfig.height);
5994
+ case 4:
5995
+ case "end":
5996
+ return _context.stop();
6021
5997
  }
6022
5998
  }, _callee, this);
6023
5999
  }));
@@ -6077,18 +6053,16 @@
6077
6053
  var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
6078
6054
  var _options, type, encoderOptions;
6079
6055
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6080
- while (1) {
6081
- switch (_context2.prev = _context2.next) {
6082
- case 0:
6083
- if (options === void 0) {
6084
- options = {};
6085
- }
6086
- _options = options, type = _options.type, encoderOptions = _options.encoderOptions;
6087
- return _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
6088
- case 3:
6089
- case "end":
6090
- return _context2.stop();
6091
- }
6056
+ while (1) switch (_context2.prev = _context2.next) {
6057
+ case 0:
6058
+ if (options === void 0) {
6059
+ options = {};
6060
+ }
6061
+ _options = options, type = _options.type, encoderOptions = _options.encoderOptions;
6062
+ return _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
6063
+ case 3:
6064
+ case "end":
6065
+ return _context2.stop();
6092
6066
  }
6093
6067
  }, _callee2, this);
6094
6068
  }));