@antv/g-lite 1.0.50 → 1.0.52

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
@@ -14272,8 +14272,7 @@
14272
14272
  });
14273
14273
  var hitTestList = [];
14274
14274
  rBushNodes.forEach(function (_ref2) {
14275
- var id = _ref2.id;
14276
- var displayObject = runtime.displayObjectPool.getByEntity(id);
14275
+ var displayObject = _ref2.displayObject;
14277
14276
  var pointerEvents = displayObject.parsedStyle.pointerEvents;
14278
14277
  // account for `visibility`
14279
14278
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
@@ -15639,15 +15638,11 @@
15639
15638
  return true;
15640
15639
  }
15641
15640
  });
15642
- // insert this group into pool
15643
- runtime.displayObjectPool.add(_this.entity, _assertThisInitialized(_this));
15644
15641
  return _this;
15645
15642
  }
15646
15643
  var _proto = DisplayObject.prototype;
15647
15644
  _proto.destroy = function destroy() {
15648
15645
  _Element.prototype.destroy.call(this);
15649
- // remove from pool
15650
- runtime.displayObjectPool.remove(this.entity);
15651
15646
  // stop all active animations
15652
15647
  this.getAnimations().forEach(function (animation) {
15653
15648
  animation.cancel();
@@ -15716,7 +15711,12 @@
15716
15711
  options.usedAttributes = INHERITABLE_STYLE_PROPS;
15717
15712
  }
15718
15713
  // account for FCP, process properties as less as possible
15719
- runtime.styleValueRegistry.processProperties(this, attributes, options);
15714
+ var formattedAttributes = {};
15715
+ for (var name in attributes) {
15716
+ var attributeName = formatAttributeName(name);
15717
+ formattedAttributes[attributeName] = attributes[name];
15718
+ }
15719
+ runtime.styleValueRegistry.processProperties(this, formattedAttributes, options);
15720
15720
  // redraw at next frame
15721
15721
  renderable.dirty = true;
15722
15722
  };
@@ -16318,41 +16318,6 @@
16318
16318
  return CustomElement;
16319
16319
  }(DisplayObject);
16320
16320
 
16321
- var pool = {};
16322
- var htmlPool = [];
16323
- var DisplayObjectPool = /*#__PURE__*/function () {
16324
- function DisplayObjectPool() {}
16325
- var _proto = DisplayObjectPool.prototype;
16326
- _proto.getByEntity = function getByEntity(entity) {
16327
- return pool[entity];
16328
- };
16329
- _proto.getAll = function getAll() {
16330
- return Object.keys(pool).map(function (entity) {
16331
- return pool[entity];
16332
- });
16333
- };
16334
- _proto.add = function add(entity, groupOrShape) {
16335
- pool[entity] = groupOrShape;
16336
- if (groupOrShape.nodeName === exports.Shape.HTML) {
16337
- htmlPool.push(groupOrShape);
16338
- }
16339
- };
16340
- _proto.remove = function remove(entity) {
16341
- var existed = pool[entity];
16342
- if (existed) {
16343
- delete pool[entity];
16344
- if (existed.nodeName === exports.Shape.HTML) {
16345
- var index = htmlPool.indexOf(existed);
16346
- htmlPool.splice(index, 1);
16347
- }
16348
- }
16349
- };
16350
- _proto.getHTMLs = function getHTMLs() {
16351
- return htmlPool;
16352
- };
16353
- return DisplayObjectPool;
16354
- }();
16355
-
16356
16321
  var _excluded$2 = ["style"];
16357
16322
  var Ellipse = /*#__PURE__*/function (_DisplayObject) {
16358
16323
  _inheritsLoose(Ellipse, _DisplayObject);
@@ -17328,7 +17293,11 @@
17328
17293
  int: true,
17329
17294
  k: ['none'],
17330
17295
  d: 'none',
17331
- syntax: exports.PropertySyntax.PAINT
17296
+ syntax: exports.PropertySyntax.PAINT,
17297
+ /**
17298
+ * Stroke 'none' won't affect geometry but others will.
17299
+ */
17300
+ l: true
17332
17301
  }, {
17333
17302
  n: 'shadowType',
17334
17303
  k: ['inner', 'outer', 'both'],
@@ -17819,28 +17788,6 @@
17819
17788
  };
17820
17789
  }
17821
17790
  if (!runtime.enableCSSParsing) {
17822
- // alias
17823
- // @ts-ignore
17824
- if (attributes.src) {
17825
- // @ts-ignore
17826
- attributes.img = attributes.src;
17827
- }
17828
- // @ts-ignore
17829
- if (attributes.d) {
17830
- // @ts-ignore
17831
- attributes.path = attributes.d;
17832
- }
17833
- if (attributes.strokeDasharray) {
17834
- attributes.lineDash = attributes.strokeDasharray;
17835
- }
17836
- if (attributes.strokeWidth) {
17837
- attributes.lineWidth = attributes.strokeWidth;
17838
- }
17839
- // @ts-ignore
17840
- if (attributes.textAnchor) {
17841
- // @ts-ignore
17842
- attributes.textAlign = attributes.textAnchor;
17843
- }
17844
17791
  Object.assign(object.attributes, attributes);
17845
17792
  var _attributeNames = Object.keys(attributes);
17846
17793
  // clipPath
@@ -18007,11 +17954,10 @@
18007
17954
  var attributeNames = Object.keys(attributes);
18008
17955
  attributeNames.forEach(function (attributeName) {
18009
17956
  var _propertyMetadataCach;
18010
- var name = formatAttributeName(attributeName);
18011
17957
  if (!skipUpdateAttribute) {
18012
- object.attributes[name] = attributes[attributeName];
17958
+ object.attributes[attributeName] = attributes[attributeName];
18013
17959
  }
18014
- if (!needUpdateGeometry && ((_propertyMetadataCach = propertyMetadataCache[name]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.l)) {
17960
+ if (!needUpdateGeometry && ((_propertyMetadataCach = propertyMetadataCache[attributeName]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.l)) {
18015
17961
  needUpdateGeometry = true;
18016
17962
  }
18017
17963
  });
@@ -19817,14 +19763,17 @@
19817
19763
  }
19818
19764
  // account for Touch
19819
19765
  return false;
19820
- };
19766
+ }
19767
+ /**
19768
+ * Find HTML from composed path in native UI event.
19769
+ */;
19821
19770
  _proto.getExistedHTML = function getExistedHTML(event) {
19822
19771
  if (event.nativeEvent.composedPath) {
19823
- var htmls = this.globalRuntime.displayObjectPool.getHTMLs();
19824
- for (var _iterator = _createForOfIteratorHelperLoose(htmls), _step; !(_step = _iterator()).done;) {
19825
- var html = _step.value;
19826
- if (event.nativeEvent.composedPath().indexOf(html) > -1) {
19827
- return html;
19772
+ for (var _iterator = _createForOfIteratorHelperLoose(event.nativeEvent.composedPath()), _step; !(_step = _iterator()).done;) {
19773
+ var eventTarget = _step.value;
19774
+ var existed = runtime.nativeHTMLMap.get(eventTarget);
19775
+ if (existed) {
19776
+ return existed;
19828
19777
  }
19829
19778
  }
19830
19779
  }
@@ -21606,7 +21555,7 @@
21606
21555
  runtime.AnimationTimeline = null;
21607
21556
  runtime.EasingFunction = null;
21608
21557
  runtime.offscreenCanvas = new OffscreenCanvasCreator();
21609
- runtime.displayObjectPool = new DisplayObjectPool();
21558
+ runtime.nativeHTMLMap = new WeakMap();
21610
21559
  runtime.sceneGraphSelector = new DefaultSceneGraphSelector();
21611
21560
  runtime.sceneGraphService = new DefaultSceneGraphService(runtime);
21612
21561
  runtime.textService = new TextService(runtime);
@@ -22232,10 +22181,9 @@
22232
22181
  maxX = _renderBounds$getMax[0],
22233
22182
  maxY = _renderBounds$getMax[1];
22234
22183
  if (!rBushNode.aabb) {
22235
- // @ts-ignore
22236
22184
  rBushNode.aabb = {};
22237
22185
  }
22238
- rBushNode.aabb.id = node.entity;
22186
+ rBushNode.aabb.displayObject = node;
22239
22187
  rBushNode.aabb.minX = minX;
22240
22188
  rBushNode.aabb.minY = minY;
22241
22189
  rBushNode.aabb.maxX = maxX;
@@ -22860,7 +22808,6 @@
22860
22808
  exports.DefaultSceneGraphSelector = DefaultSceneGraphSelector;
22861
22809
  exports.DefaultSceneGraphService = DefaultSceneGraphService;
22862
22810
  exports.DisplayObject = DisplayObject;
22863
- exports.DisplayObjectPool = DisplayObjectPool;
22864
22811
  exports.Document = Document;
22865
22812
  exports.EMPTY_PARSED_PATH = EMPTY_PARSED_PATH;
22866
22813
  exports.ERROR_MSG_METHOD_NOT_IMPLEMENTED = ERROR_MSG_METHOD_NOT_IMPLEMENTED;