@antv/g-lite 1.0.12 → 1.0.13

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
@@ -5376,16 +5376,11 @@
5376
5376
  return result[0].length === result[1].length ? result : equalizeSegments(result[0], result[1], tl);
5377
5377
  }
5378
5378
 
5379
- var toString = {}.toString;
5380
- var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
5381
-
5382
5379
  /**
5383
- * 是否为函数
5384
- * @param {*} fn 对象
5385
- * @return {Boolean} 是否函数
5380
+ * @see https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_isfunction
5386
5381
  */
5387
5382
  var isFunction = (function (value) {
5388
- return isType(value, 'Function');
5383
+ return typeof value === 'function';
5389
5384
  });
5390
5385
 
5391
5386
  // isFinite,
@@ -5397,6 +5392,9 @@
5397
5392
  return value === null || value === undefined;
5398
5393
  };
5399
5394
 
5395
+ var toString = {}.toString;
5396
+ var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
5397
+
5400
5398
  var isObject = (function (value) {
5401
5399
  /**
5402
5400
  * isObject({}) => true
@@ -5945,10 +5943,7 @@
5945
5943
  alias: 'lineWidth'
5946
5944
  },
5947
5945
  textAnchor: {
5948
- alias: 'textAlign',
5949
- values: {
5950
- middle: 'center'
5951
- }
5946
+ alias: 'textAlign'
5952
5947
  },
5953
5948
  src: {
5954
5949
  alias: 'img'
@@ -5958,18 +5953,8 @@
5958
5953
  var attributeName = camelCase(name);
5959
5954
  var map = FORMAT_ATTR_MAP[attributeName];
5960
5955
  attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
5961
- return [attributeName, map];
5956
+ return attributeName;
5962
5957
  });
5963
- function formatAttribute(name, value) {
5964
- var _map$values;
5965
-
5966
- var _formatAttributeName = formatAttributeName(name),
5967
- attributeName = _formatAttributeName[0],
5968
- map = _formatAttributeName[1];
5969
-
5970
- var attributeValue = isString(value) && (map === null || map === void 0 ? void 0 : (_map$values = map.values) === null || _map$values === void 0 ? void 0 : _map$values[value]) || value;
5971
- return [attributeName, attributeValue];
5972
- }
5973
5958
 
5974
5959
  var canvasMap = {};
5975
5960
  var defaultCanvasIdCounter = 0;
@@ -11539,16 +11524,23 @@
11539
11524
  };
11540
11525
 
11541
11526
  _proto.postProcessor = function postProcessor(object) {
11542
- if (!object.attributes.offsetPath) {
11527
+ var _object$parsedStyle = object.parsedStyle,
11528
+ offsetPath = _object$parsedStyle.offsetPath,
11529
+ offsetDistance = _object$parsedStyle.offsetDistance;
11530
+
11531
+ if (!offsetPath) {
11543
11532
  return;
11544
11533
  }
11545
11534
 
11546
- var offsetPathNodeName = object.attributes.offsetPath.nodeName;
11535
+ var nodeName = offsetPath.nodeName;
11547
11536
 
11548
- if (offsetPathNodeName === exports.Shape.LINE || offsetPathNodeName === exports.Shape.PATH || offsetPathNodeName === exports.Shape.POLYLINE) {
11549
- var point = object.attributes.offsetPath.getPoint(object.parsedStyle.offsetDistance);
11537
+ if (nodeName === exports.Shape.LINE || nodeName === exports.Shape.PATH || nodeName === exports.Shape.POLYLINE) {
11538
+ // set position in world space
11539
+ var point = offsetPath.getPoint(offsetDistance);
11550
11540
 
11551
11541
  if (point) {
11542
+ object.parsedStyle.defX = point.x;
11543
+ object.parsedStyle.defY = point.y;
11552
11544
  object.setLocalPosition(point.x, point.y);
11553
11545
  }
11554
11546
  }
@@ -14654,7 +14646,7 @@
14654
14646
  n: 'textAlign',
14655
14647
  l: true,
14656
14648
  inh: true,
14657
- k: ['start', 'center', 'end', 'left', 'right'],
14649
+ k: ['start', 'center', 'middle', 'end', 'left', 'right'],
14658
14650
  d: 'start'
14659
14651
  }, // {
14660
14652
  // n: 'whiteSpace',
@@ -14766,12 +14758,10 @@
14766
14758
  attributeNames.forEach(function (attributeName) {
14767
14759
  var _propertyMetadataCach;
14768
14760
 
14769
- var _formatAttribute = formatAttribute(attributeName, attributes[attributeName]),
14770
- name = _formatAttribute[0],
14771
- value = _formatAttribute[1];
14761
+ var name = formatAttributeName(attributeName);
14772
14762
 
14773
14763
  if (!skipUpdateAttribute) {
14774
- object.attributes[name] = value;
14764
+ object.attributes[name] = attributes[attributeName];
14775
14765
  }
14776
14766
 
14777
14767
  if (!needUpdateGeometry && ((_propertyMetadataCach = propertyMetadataCache[name]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.l)) {
@@ -15907,7 +15897,11 @@
15907
15897
  */
15908
15898
  ;
15909
15899
 
15910
- _proto.dispatchEvent = function dispatchEvent(e) {
15900
+ _proto.dispatchEvent = function dispatchEvent(e, skipPropagate) {
15901
+ if (skipPropagate === void 0) {
15902
+ skipPropagate = false;
15903
+ }
15904
+
15911
15905
  if (!(e instanceof FederatedEvent)) {
15912
15906
  throw new Error('DisplayObject cannot propagate events outside of the Federated Events API');
15913
15907
  } // should account for Element / Document / Canvas
@@ -15937,8 +15931,12 @@
15937
15931
 
15938
15932
  e.defaultPrevented = false;
15939
15933
  e.path = [];
15940
- e.target = this;
15941
- (_e$manager = e.manager) === null || _e$manager === void 0 ? void 0 : _e$manager.dispatchEvent(e);
15934
+
15935
+ if (!skipPropagate) {
15936
+ e.target = this;
15937
+ }
15938
+
15939
+ (_e$manager = e.manager) === null || _e$manager === void 0 ? void 0 : _e$manager.dispatchEvent(e, e.type, skipPropagate);
15942
15940
  }
15943
15941
 
15944
15942
  return !e.defaultPrevented;
@@ -17256,9 +17254,7 @@
17256
17254
  var value = this.attributes[name];
17257
17255
 
17258
17256
  if (value === undefined) {
17259
- var _formatAttribute = formatAttribute(name, ''),
17260
- attributeName = _formatAttribute[0];
17261
-
17257
+ var attributeName = formatAttributeName(name);
17262
17258
  value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
17263
17259
 
17264
17260
  return isNil(value) ? null : value;
@@ -17667,6 +17663,7 @@
17667
17663
  filter: [],
17668
17664
  shadowType: 'outer'
17669
17665
  };
17666
+ var INHERITABLE_STYLE_PROPS = ['opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform'];
17670
17667
  /**
17671
17668
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
17672
17669
  *
@@ -17706,6 +17703,7 @@
17706
17703
 
17707
17704
  _this.config = void 0;
17708
17705
  _this.isCustomElement = false;
17706
+ _this.isMutationObserved = false;
17709
17707
  _this.activeAnimations = [];
17710
17708
 
17711
17709
  _this.getClip = function () {
@@ -17840,14 +17838,7 @@
17840
17838
 
17841
17839
  runtime.styleValueRegistry.processProperties(this, attributes, {
17842
17840
  forceUpdateGeometry: true,
17843
- usedAttributes: [// 'anchor',
17844
- // 'transform',
17845
- // 'zIndex',
17846
- // 'filter',
17847
- // 'shadowType',
17848
- // 'fill',
17849
- // 'stroke',
17850
- 'opacity', 'fillOpacity', 'strokeOpacity', 'transformOrigin', 'visibility', 'pointerEvents', 'lineWidth', 'lineCap', 'lineJoin', 'increasedLineWidthForHitTesting', 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight', 'fontVariant', 'textAlign', 'textBaseline', 'textTransform']
17841
+ usedAttributes: INHERITABLE_STYLE_PROPS
17851
17842
  }); // redraw at next frame
17852
17843
 
17853
17844
  renderable.dirty = true;
@@ -17858,19 +17849,16 @@
17858
17849
  force = false;
17859
17850
  }
17860
17851
 
17861
- var _formatAttribute = formatAttribute(name, value),
17862
- attributeName = _formatAttribute[0],
17863
- attributeValue = _formatAttribute[1]; // ignore undefined value
17864
-
17852
+ var attributeName = formatAttributeName(name); // ignore undefined value
17865
17853
 
17866
17854
  if (isUndefined(value)) {
17867
17855
  return;
17868
17856
  }
17869
17857
 
17870
- if (force || attributeValue !== this.attributes[attributeName]) {
17871
- this.internalSetAttribute(attributeName, attributeValue);
17858
+ if (force || value !== this.attributes[attributeName]) {
17859
+ this.internalSetAttribute(attributeName, value);
17872
17860
 
17873
- _Element.prototype.setAttribute.call(this, attributeName, attributeValue);
17861
+ _Element.prototype.setAttribute.call(this, attributeName, value);
17874
17862
  }
17875
17863
  }
17876
17864
  /**
@@ -17900,7 +17888,13 @@
17900
17888
  mutationEvent.attrName = name;
17901
17889
  mutationEvent.prevParsedValue = oldParsedValue;
17902
17890
  mutationEvent.newParsedValue = newParsedValue;
17903
- this.dispatchEvent(mutationEvent);
17891
+
17892
+ if (this.isMutationObserved) {
17893
+ this.dispatchEvent(mutationEvent);
17894
+ } else {
17895
+ mutationEvent.target = this;
17896
+ this.ownerDocument.defaultView.dispatchEvent(mutationEvent, true);
17897
+ }
17904
17898
  }
17905
17899
 
17906
17900
  if ((this.isCustomElement && this.isConnected || !this.isCustomElement) && this.attributeChangedCallback) {
@@ -18957,7 +18951,11 @@
18957
18951
  marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
18958
18952
  };
18959
18953
 
18960
- _proto.getPoint = function getPoint(ratio) {
18954
+ _proto.getPoint = function getPoint(ratio, inWorldSpace) {
18955
+ if (inWorldSpace === void 0) {
18956
+ inWorldSpace = false;
18957
+ }
18958
+
18961
18959
  // TODO: account for z1/z2 in 3D line
18962
18960
  var _this$parsedStyle3 = this.parsedStyle,
18963
18961
  x1 = _this$parsedStyle3.x1,
@@ -18971,13 +18969,17 @@
18971
18969
  x = _LineUtil$pointAt.x,
18972
18970
  y = _LineUtil$pointAt.y;
18973
18971
 
18974
- var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
18972
+ var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
18975
18973
 
18976
18974
  return new Point(transformed[0], transformed[1]);
18977
18975
  };
18978
18976
 
18979
- _proto.getPointAtLength = function getPointAtLength(distance) {
18980
- return this.getPoint(distance / this.getTotalLength());
18977
+ _proto.getPointAtLength = function getPointAtLength(distance, inWorldSpace) {
18978
+ if (inWorldSpace === void 0) {
18979
+ inWorldSpace = false;
18980
+ }
18981
+
18982
+ return this.getPoint(distance / this.getTotalLength(), inWorldSpace);
18981
18983
  };
18982
18984
 
18983
18985
  _proto.getTotalLength = function getTotalLength() {
@@ -19174,7 +19176,11 @@
19174
19176
  */
19175
19177
  ;
19176
19178
 
19177
- _proto.getPointAtLength = function getPointAtLength$1(distance) {
19179
+ _proto.getPointAtLength = function getPointAtLength$1(distance, inWorldSpace) {
19180
+ if (inWorldSpace === void 0) {
19181
+ inWorldSpace = false;
19182
+ }
19183
+
19178
19184
  var _this$parsedStyle4 = this.parsedStyle,
19179
19185
  defX = _this$parsedStyle4.defX,
19180
19186
  defY = _this$parsedStyle4.defY,
@@ -19184,7 +19190,7 @@
19184
19190
  x = _getPointAtLength2.x,
19185
19191
  y = _getPointAtLength2.y;
19186
19192
 
19187
- var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
19193
+ var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
19188
19194
 
19189
19195
  return new Point(transformed[0], transformed[1]);
19190
19196
  }
@@ -19193,8 +19199,12 @@
19193
19199
  */
19194
19200
  ;
19195
19201
 
19196
- _proto.getPoint = function getPoint(ratio) {
19197
- return this.getPointAtLength(ratio * getOrCalculatePathTotalLength(this));
19202
+ _proto.getPoint = function getPoint(ratio, inWorldSpace) {
19203
+ if (inWorldSpace === void 0) {
19204
+ inWorldSpace = false;
19205
+ }
19206
+
19207
+ return this.getPointAtLength(ratio * getOrCalculatePathTotalLength(this), inWorldSpace);
19198
19208
  }
19199
19209
  /**
19200
19210
  * Get start tangent vector
@@ -19453,11 +19463,19 @@
19453
19463
  return this.parsedStyle.points.totalLength;
19454
19464
  };
19455
19465
 
19456
- _proto.getPointAtLength = function getPointAtLength(distance) {
19457
- return this.getPoint(distance / this.getTotalLength());
19466
+ _proto.getPointAtLength = function getPointAtLength(distance, inWorldSpace) {
19467
+ if (inWorldSpace === void 0) {
19468
+ inWorldSpace = false;
19469
+ }
19470
+
19471
+ return this.getPoint(distance / this.getTotalLength(), inWorldSpace);
19458
19472
  };
19459
19473
 
19460
- _proto.getPoint = function getPoint(ratio) {
19474
+ _proto.getPoint = function getPoint(ratio, inWorldSpace) {
19475
+ if (inWorldSpace === void 0) {
19476
+ inWorldSpace = false;
19477
+ }
19478
+
19461
19479
  var _this$parsedStyle = this.parsedStyle,
19462
19480
  defX = _this$parsedStyle.defX,
19463
19481
  defY = _this$parsedStyle.defY,
@@ -19477,7 +19495,7 @@
19477
19495
  x = _LineUtil$pointAt.x,
19478
19496
  y = _LineUtil$pointAt.y;
19479
19497
 
19480
- var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
19498
+ var transformed = transformMat4(create$2(), fromValues$2(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform()); // apply local transformation
19481
19499
 
19482
19500
  return new Point(transformed[0], transformed[1]);
19483
19501
  };
@@ -20665,7 +20683,7 @@
20665
20683
  var anchor = [0, 1];
20666
20684
  var lineXOffset = 0;
20667
20685
 
20668
- if (textAlign === 'center') {
20686
+ if (textAlign === 'center' || textAlign === 'middle') {
20669
20687
  lineXOffset = lineWidth / 2;
20670
20688
  anchor = [0.5, 1];
20671
20689
  } else if (textAlign === 'right' || textAlign === 'end') {
@@ -21390,10 +21408,20 @@
21390
21408
  }
21391
21409
  };
21392
21410
 
21393
- _proto.dispatchEvent = function dispatchEvent(e, type) {
21394
- e.propagationStopped = false;
21395
- e.propagationImmediatelyStopped = false;
21396
- this.propagate(e, type);
21411
+ _proto.dispatchEvent = function dispatchEvent(e, type, skipPropagate) {
21412
+ // Canvas should skip
21413
+ if (!skipPropagate) {
21414
+ e.propagationStopped = false;
21415
+ e.propagationImmediatelyStopped = false;
21416
+ this.propagate(e, type);
21417
+ } else {
21418
+ // target phase
21419
+ e.eventPhase = e.AT_TARGET;
21420
+ var canvas = this.rootTarget.defaultView || null;
21421
+ e.currentTarget = canvas;
21422
+ this.notifyListeners(e, type);
21423
+ }
21424
+
21397
21425
  this.emitter.emit(type || e.type, e);
21398
21426
  };
21399
21427
 
@@ -22199,10 +22227,11 @@
22199
22227
 
22200
22228
  if (renderOrderChanged) {
22201
22229
  displayObject.forEach(function (child) {
22230
+ _this2.renderOrderChangedEvent.target = child;
22202
22231
  _this2.renderOrderChangedEvent.detail = {
22203
22232
  renderOrder: child.sortable.renderOrder
22204
22233
  };
22205
- child.dispatchEvent(_this2.renderOrderChangedEvent);
22234
+ child.ownerDocument.defaultView.dispatchEvent(_this2.renderOrderChangedEvent, true);
22206
22235
  });
22207
22236
  }
22208
22237
  };
@@ -22863,9 +22892,10 @@
22863
22892
  var set = new Set();
22864
22893
 
22865
22894
  var trigger = function trigger(element, detail) {
22866
- if (!set.has(element.entity)) {
22895
+ if (element.isConnected && !set.has(element.entity)) {
22867
22896
  _this2.boundsChangedEvent.detail = detail;
22868
- element.dispatchEvent(_this2.boundsChangedEvent);
22897
+ _this2.boundsChangedEvent.target = element;
22898
+ element.ownerDocument.defaultView.dispatchEvent(_this2.boundsChangedEvent, true);
22869
22899
  set.add(element.entity);
22870
22900
  }
22871
22901
  };
@@ -22883,6 +22913,7 @@
22883
22913
  }
22884
22914
  });
22885
22915
  this.pendingEvents = [];
22916
+ set.clear();
22886
22917
  };
22887
22918
 
22888
22919
  _proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
@@ -23533,7 +23564,7 @@
23533
23564
  lineMetrics: lineWidths.map(function (width, i) {
23534
23565
  var offsetX = 0; // handle horizontal text align
23535
23566
 
23536
- if (textAlign === 'center') {
23567
+ if (textAlign === 'center' || textAlign === 'middle') {
23537
23568
  offsetX -= width / 2;
23538
23569
  } else if (textAlign === 'right' || textAlign === 'end') {
23539
23570
  offsetX -= width;
@@ -24365,21 +24396,14 @@
24365
24396
 
24366
24397
  var _proto = PrepareRendererPlugin.prototype;
24367
24398
 
24368
- _proto.pushToSync = function pushToSync(list) {
24369
- var _this = this;
24370
-
24371
- list.forEach(function (i) {
24372
- _this.toSync.add(i);
24373
- });
24374
- } // private isFirstTimeRendering = true;
24375
- ;
24376
-
24399
+ // private isFirstTimeRendering = true;
24377
24400
  _proto.apply = function apply(context) {
24378
- var _this2 = this;
24401
+ var _this = this;
24379
24402
 
24380
24403
  var renderingService = context.renderingService,
24381
24404
  renderingContext = context.renderingContext,
24382
24405
  rBushRoot = context.rBushRoot;
24406
+ var canvas = renderingContext.root.ownerDocument.defaultView;
24383
24407
  this.rBush = rBushRoot;
24384
24408
 
24385
24409
  var handleAttributeChanged = function handleAttributeChanged(e) {
@@ -24394,20 +24418,26 @@
24394
24418
 
24395
24419
  if (affectChildren) {
24396
24420
  object.forEach(function (node) {
24397
- _this2.pushToSync([node]);
24421
+ _this.toSync.add(node);
24398
24422
  });
24399
24423
  }
24400
24424
 
24401
- _this2.pushToSync(e.composedPath().slice(0, -2));
24425
+ var p = object;
24426
+
24427
+ while (p) {
24428
+ if (p.renderable) {
24429
+ _this.toSync.add(p);
24430
+ }
24431
+
24432
+ p = p.parentElement;
24433
+ } // this.pushToSync(e.composedPath().slice(0, -2) as DisplayObject[]);
24434
+
24402
24435
 
24403
24436
  renderingService.dirtify();
24404
24437
  };
24405
24438
 
24406
24439
  var handleMounted = function handleMounted(e) {
24407
- var object = e.target;
24408
-
24409
- _this2.pushToSync(e.composedPath().slice(0, -2)); // recalc style values
24410
-
24440
+ var object = e.target; // recalc style values
24411
24441
 
24412
24442
  runtime.styleValueRegistry.recalc(object);
24413
24443
  runtime.sceneGraphService.dirtifyToRoot(object);
@@ -24419,12 +24449,12 @@
24419
24449
  var rBushNode = object.rBushNode;
24420
24450
 
24421
24451
  if (rBushNode.aabb) {
24422
- _this2.rBush.remove(rBushNode.aabb);
24452
+ _this.rBush.remove(rBushNode.aabb);
24423
24453
  }
24424
24454
 
24425
- _this2.toSync.delete(object);
24455
+ _this.toSync.delete(object);
24426
24456
 
24427
- runtime.sceneGraphService.dirtifyToRoot(e.target);
24457
+ runtime.sceneGraphService.dirtifyToRoot(object);
24428
24458
  renderingService.dirtify();
24429
24459
  };
24430
24460
 
@@ -24433,10 +24463,10 @@
24433
24463
  while (1) {
24434
24464
  switch (_context.prev = _context.next) {
24435
24465
  case 0:
24436
- renderingContext.root.addEventListener(exports.ElementEvent.MOUNTED, handleMounted);
24437
- renderingContext.root.addEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
24438
- renderingContext.root.addEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
24439
- renderingContext.root.addEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
24466
+ canvas.addEventListener(exports.ElementEvent.MOUNTED, handleMounted);
24467
+ canvas.addEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
24468
+ canvas.addEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
24469
+ canvas.addEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
24440
24470
 
24441
24471
  case 4:
24442
24472
  case "end":
@@ -24446,10 +24476,10 @@
24446
24476
  }, _callee);
24447
24477
  })));
24448
24478
  renderingService.hooks.destroy.tap(PrepareRendererPlugin.tag, function () {
24449
- renderingContext.root.removeEventListener(exports.ElementEvent.MOUNTED, handleMounted);
24450
- renderingContext.root.removeEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
24451
- renderingContext.root.removeEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
24452
- renderingContext.root.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
24479
+ canvas.removeEventListener(exports.ElementEvent.MOUNTED, handleMounted);
24480
+ canvas.removeEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
24481
+ canvas.removeEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
24482
+ canvas.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
24453
24483
  });
24454
24484
  renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
24455
24485
  // if (this.isFirstTimeRendering) {
@@ -24459,12 +24489,12 @@
24459
24489
  // } else {
24460
24490
  // this.syncRTree();
24461
24491
  // }
24462
- _this2.syncRTree();
24492
+ _this.syncRTree();
24463
24493
  });
24464
24494
  };
24465
24495
 
24466
24496
  _proto.syncRTree = function syncRTree() {
24467
- var _this3 = this;
24497
+ var _this2 = this;
24468
24498
 
24469
24499
  // bounds changed, need re-inserting its children
24470
24500
  var bulk = [];
@@ -24475,7 +24505,7 @@
24475
24505
  var rBushNode = node.rBushNode; // clear dirty node
24476
24506
 
24477
24507
  if (rBushNode && rBushNode.aabb) {
24478
- _this3.rBush.remove(rBushNode.aabb);
24508
+ _this2.rBush.remove(rBushNode.aabb);
24479
24509
  }
24480
24510
 
24481
24511
  var renderBounds = node.getRenderBounds();
@@ -24536,8 +24566,8 @@
24536
24566
  * reuse custom event preventing from re-create them in every frame
24537
24567
  */
24538
24568
 
24539
- var mountEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
24540
- var unmountEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
24569
+ var mountedEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
24570
+ var unmountedEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
24541
24571
  var beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
24542
24572
  var afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
24543
24573
  /**
@@ -25052,13 +25082,20 @@
25052
25082
 
25053
25083
  path.reverse().forEach(function (child) {
25054
25084
  // trigger before unmounted
25055
- if (child instanceof CustomElement) {
25085
+ if (child.isCustomElement) {
25056
25086
  if (child.disconnectedCallback) {
25057
25087
  child.disconnectedCallback();
25058
25088
  }
25059
25089
  }
25060
25090
 
25061
- child.dispatchEvent(unmountEvent); // skip document.documentElement
25091
+ if (child.isMutationObserved) {
25092
+ child.dispatchEvent(unmountedEvent);
25093
+ } else {
25094
+ unmountedEvent.target = child;
25095
+
25096
+ _this5.dispatchEvent(unmountedEvent, true);
25097
+ } // skip document.documentElement
25098
+
25062
25099
 
25063
25100
  if (child !== _this5.document.documentElement) {
25064
25101
  child.ownerDocument = null;
@@ -25077,9 +25114,17 @@
25077
25114
  if (!child.isConnected) {
25078
25115
  child.ownerDocument = _this6.document;
25079
25116
  child.isConnected = true;
25080
- child.dispatchEvent(mountEvent); // trigger after mounted
25081
25117
 
25082
- if (child instanceof CustomElement) {
25118
+ if (child.isMutationObserved) {
25119
+ child.dispatchEvent(mountedEvent);
25120
+ } else {
25121
+ mountedEvent.target = child;
25122
+
25123
+ _this6.dispatchEvent(mountedEvent, true);
25124
+ } // trigger after mounted
25125
+
25126
+
25127
+ if (child.isCustomElement) {
25083
25128
  if (child.connectedCallback) {
25084
25129
  child.connectedCallback();
25085
25130
  }