@antv/g-lite 1.3.0-next.10 → 1.3.0-next.12

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.js CHANGED
@@ -6565,7 +6565,7 @@ var BUILT_IN_PROPERTIES = [
6565
6565
  d: '0',
6566
6566
  },
6567
6567
  ];
6568
- var GEOMETRY_ATTRIBUTE_NAMES = BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
6568
+ BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
6569
6569
  var propertyMetadataCache = {};
6570
6570
  var unresolvedProperties = new WeakMap();
6571
6571
  // const uniqueAttributeSet = new Set<string>();
@@ -6622,20 +6622,20 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6622
6622
  }; }
6623
6623
  if (!this.runtime.enableCSSParsing) {
6624
6624
  Object.assign(object.attributes, attributes);
6625
- var attributeNames_1 = Object.keys(attributes);
6625
+ var attributeNames = Object.keys(attributes);
6626
6626
  // clipPath
6627
6627
  var oldClipPath = object.parsedStyle.clipPath;
6628
6628
  var oldOffsetPath = object.parsedStyle.offsetPath;
6629
6629
  object.parsedStyle = Object.assign(object.parsedStyle, attributes);
6630
- var needUpdateGeometry_1 = !!options.forceUpdateGeometry;
6631
- if (!needUpdateGeometry_1) {
6632
- for (var i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
6633
- if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
6634
- needUpdateGeometry_1 = true;
6635
- break;
6636
- }
6637
- }
6638
- }
6630
+ var needUpdateGeometry = !!options.forceUpdateGeometry;
6631
+ // if (!needUpdateGeometry) {
6632
+ // for (let i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
6633
+ // if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
6634
+ // needUpdateGeometry = true;
6635
+ // break;
6636
+ // }
6637
+ // }
6638
+ // }
6639
6639
  if (attributes.fill) {
6640
6640
  object.parsedStyle.fill = parseColor(attributes.fill);
6641
6641
  }
@@ -6718,97 +6718,98 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6718
6718
  attributes.markerMid, null, null);
6719
6719
  }
6720
6720
  if (!util.isNil(attributes.zIndex)) {
6721
- this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames_1);
6721
+ this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames);
6722
6722
  }
6723
6723
  if (!util.isNil(attributes.offsetDistance)) {
6724
- this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames_1);
6724
+ this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames);
6725
6725
  }
6726
6726
  if (attributes.transform) {
6727
- this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames_1);
6727
+ this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
6728
6728
  }
6729
- if (needUpdateGeometry_1) {
6729
+ if (needUpdateGeometry) {
6730
6730
  object.geometry.dirty = true;
6731
6731
  // FIXME setOrigin may have already dirtified to root.
6732
- this.runtime.sceneGraphService.dirtifyToRoot(object);
6732
+ // this.runtime.sceneGraphService.dirtifyToRoot(object);
6733
6733
  }
6734
- return;
6735
6734
  }
6736
- var skipUpdateAttribute = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize = options.memoize;
6737
- var needUpdateGeometry = forceUpdateGeometry;
6738
- var attributeNames = Object.keys(attributes);
6739
- attributeNames.forEach(function (attributeName) {
6740
- var _a;
6741
- if (!skipUpdateAttribute) {
6742
- object.attributes[attributeName] = attributes[attributeName];
6743
- }
6744
- if (!needUpdateGeometry && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
6745
- needUpdateGeometry = true;
6746
- }
6747
- });
6748
- if (!skipParse) {
6749
- attributeNames.forEach(function (name) {
6750
- object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize);
6735
+ else {
6736
+ var skipUpdateAttribute_1 = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize_1 = options.memoize;
6737
+ var needUpdateGeometry_1 = forceUpdateGeometry;
6738
+ var attributeNames_1 = Object.keys(attributes);
6739
+ attributeNames_1.forEach(function (attributeName) {
6740
+ var _a;
6741
+ if (!skipUpdateAttribute_1) {
6742
+ object.attributes[attributeName] = attributes[attributeName];
6743
+ }
6744
+ if (!needUpdateGeometry_1 && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
6745
+ needUpdateGeometry_1 = true;
6746
+ }
6751
6747
  });
6752
- }
6753
- // let hasUnresolvedProperties = false;
6754
- // parse according to priority
6755
- // path 50
6756
- // points 50
6757
- // text 50
6758
- // textTransform 51
6759
- // transform 100
6760
- // transformOrigin 100
6761
- if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
6762
- // uniqueAttributeSet.clear();
6763
- attributeNames = Array.from(new Set(attributeNames.concat(usedAttributes)));
6764
- }
6765
- // [
6766
- // 'path',
6767
- // 'points',
6768
- // 'text',
6769
- // 'textTransform',
6770
- // 'transform',
6771
- // 'transformOrigin',
6772
- // ].forEach((name) => {
6773
- // const index = attributeNames.indexOf(name);
6774
- // if (index > -1) {
6775
- // attributeNames.splice(index, 1);
6776
- // attributeNames.push(name);
6777
- // }
6778
- // });
6779
- attributeNames.forEach(function (name) {
6780
- // some style props maybe deleted after parsing such as `anchor` in Text
6781
- if (name in object.computedStyle) {
6782
- object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize);
6748
+ if (!skipParse) {
6749
+ attributeNames_1.forEach(function (name) {
6750
+ object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize_1);
6751
+ });
6783
6752
  }
6784
- });
6785
- // if (hasUnresolvedProperties) {
6786
- // this.dirty = true;
6787
- // return;
6788
- // }
6789
- // update geometry
6790
- if (needUpdateGeometry) {
6791
- object.geometry.dirty = true;
6792
- // FIXME setOrigin may have already dirtified to root.
6793
- this.runtime.sceneGraphService.dirtifyToRoot(object);
6794
- }
6795
- attributeNames.forEach(function (name) {
6796
- if (name in object.parsedStyle) {
6797
- _this.postProcessProperty(name, object, attributeNames);
6753
+ // let hasUnresolvedProperties = false;
6754
+ // parse according to priority
6755
+ // path 50
6756
+ // points 50
6757
+ // text 50
6758
+ // textTransform 51
6759
+ // transform 100
6760
+ // transformOrigin 100
6761
+ if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
6762
+ // uniqueAttributeSet.clear();
6763
+ attributeNames_1 = Array.from(new Set(attributeNames_1.concat(usedAttributes)));
6764
+ }
6765
+ // [
6766
+ // 'path',
6767
+ // 'points',
6768
+ // 'text',
6769
+ // 'textTransform',
6770
+ // 'transform',
6771
+ // 'transformOrigin',
6772
+ // ].forEach((name) => {
6773
+ // const index = attributeNames.indexOf(name);
6774
+ // if (index > -1) {
6775
+ // attributeNames.splice(index, 1);
6776
+ // attributeNames.push(name);
6777
+ // }
6778
+ // });
6779
+ attributeNames_1.forEach(function (name) {
6780
+ // some style props maybe deleted after parsing such as `anchor` in Text
6781
+ if (name in object.computedStyle) {
6782
+ object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize_1);
6783
+ }
6784
+ });
6785
+ // if (hasUnresolvedProperties) {
6786
+ // this.dirty = true;
6787
+ // return;
6788
+ // }
6789
+ // update geometry
6790
+ if (needUpdateGeometry_1) {
6791
+ object.geometry.dirty = true;
6792
+ // FIXME setOrigin may have already dirtified to root.
6793
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6798
6794
  }
6799
- });
6800
- if (this.runtime.enableCSSParsing && object.children.length) {
6801
- attributeNames.forEach(function (name) {
6802
- if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
6803
- // update children's inheritable
6804
- object.children.forEach(function (child) {
6805
- child.internalSetAttribute(name, null, {
6806
- skipUpdateAttribute: true,
6807
- skipParse: true,
6808
- });
6809
- });
6795
+ attributeNames_1.forEach(function (name) {
6796
+ if (name in object.parsedStyle) {
6797
+ _this.postProcessProperty(name, object, attributeNames_1);
6810
6798
  }
6811
6799
  });
6800
+ if (this.runtime.enableCSSParsing && object.children.length) {
6801
+ attributeNames_1.forEach(function (name) {
6802
+ if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
6803
+ // update children's inheritable
6804
+ object.children.forEach(function (child) {
6805
+ child.internalSetAttribute(name, null, {
6806
+ skipUpdateAttribute: true,
6807
+ skipParse: true,
6808
+ });
6809
+ });
6810
+ }
6811
+ });
6812
+ }
6812
6813
  }
6813
6814
  };
6814
6815
  /**
@@ -7583,6 +7584,7 @@ var clock = typeof performance === 'object' && performance.now ? performance : D
7583
7584
  function isFillOrStrokeAffected(pointerEvents, fill, stroke) {
7584
7585
  // account for pointerEvents
7585
7586
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
7587
+ if (pointerEvents === void 0) { pointerEvents = 'auto'; }
7586
7588
  var hasFill = false;
7587
7589
  var hasStroke = false;
7588
7590
  var isFillOtherThanNone = !!fill && !fill.isNone;
@@ -10701,6 +10703,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10701
10703
  }
10702
10704
  };
10703
10705
  DefaultSceneGraphService.prototype.getOrigin = function (element) {
10706
+ element.getGeometryBounds();
10704
10707
  return element.transformable.origin;
10705
10708
  };
10706
10709
  /**
@@ -11640,12 +11643,13 @@ runtime.globalThis = getGlobalThis();
11640
11643
  runtime.enableCSSParsing = true;
11641
11644
  runtime.enableDataset = false;
11642
11645
  runtime.enableStyleSyntax = true;
11646
+ runtime.enableAttributeDashCased = false;
11643
11647
 
11644
11648
  var entityCounter = 0;
11645
11649
  function resetEntityCounter() {
11646
11650
  entityCounter = 0;
11647
11651
  }
11648
- var insertedEvent = new MutationEvent(exports.ElementEvent.INSERTED, null, '', '', '', 0, '', '');
11652
+ new MutationEvent(exports.ElementEvent.INSERTED, null, '', '', '', 0, '', '');
11649
11653
  var removedEvent = new MutationEvent(exports.ElementEvent.REMOVED, null, '', '', '', 0, '', '');
11650
11654
  var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
11651
11655
  /**
@@ -11885,8 +11889,8 @@ var Element = /** @class */ (function (_super) {
11885
11889
  if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
11886
11890
  this.ownerDocument.defaultView.mountChildren(child);
11887
11891
  }
11888
- insertedEvent.relatedNode = this;
11889
- child.dispatchEvent(insertedEvent);
11892
+ // insertedEvent.relatedNode = this as IElement;
11893
+ // child.dispatchEvent(insertedEvent);
11890
11894
  return child;
11891
11895
  };
11892
11896
  Element.prototype.insertBefore = function (newChild, refChild) {
@@ -12159,8 +12163,10 @@ var Element = /** @class */ (function (_super) {
12159
12163
  }
12160
12164
  var value = this.attributes[name];
12161
12165
  if (value === undefined) {
12162
- var attributeName = formatAttributeName(name);
12163
- value = this.attributes[attributeName];
12166
+ if (runtime.enableAttributeDashCased) {
12167
+ var attributeName = formatAttributeName(name);
12168
+ value = this.attributes[attributeName];
12169
+ }
12164
12170
  // if the given attribute does not exist, the value returned will either be null or ""
12165
12171
  return runtime.enableCSSParsing ? (util.isNil(value) ? null : value) : value;
12166
12172
  }
@@ -12230,6 +12236,9 @@ var Element = /** @class */ (function (_super) {
12230
12236
  function isDisplayObject(value) {
12231
12237
  return !!(value === null || value === void 0 ? void 0 : value.nodeName);
12232
12238
  }
12239
+ var Proxy = runtime.globalThis.Proxy
12240
+ ? runtime.globalThis.Proxy
12241
+ : function () { };
12233
12242
  var mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
12234
12243
  var DEFAULT_STYLE_PROPS = {
12235
12244
  opacity: '',
@@ -12266,7 +12275,20 @@ var DEFAULT_PARSED_STYLE_PROPS = {
12266
12275
  shadowType: 'outer',
12267
12276
  miterLimit: 10,
12268
12277
  };
12269
- var DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = tslib.__assign(tslib.__assign({}, DEFAULT_PARSED_STYLE_PROPS), { opacity: 1, fillOpacity: 1, strokeOpacity: 1, visibility: 'visible', pointerEvents: 'auto', lineWidth: 1, lineCap: 'butt', lineJoin: 'miter', increasedLineWidthForHitTesting: 0, fillRule: 'nonzero' });
12278
+ // const DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = {
12279
+ // ...DEFAULT_PARSED_STYLE_PROPS,
12280
+ // opacity: 1,
12281
+ // fillOpacity: 1,
12282
+ // strokeOpacity: 1,
12283
+ // visibility: 'visible',
12284
+ // pointerEvents: 'auto',
12285
+ // lineWidth: 1,
12286
+ // lineCap: 'butt',
12287
+ // lineJoin: 'miter',
12288
+ // increasedLineWidthForHitTesting: 0,
12289
+ // fillRule: 'nonzero',
12290
+ // // TODO: transformOrigin
12291
+ // };
12270
12292
  var INHERITABLE_BASE_STYLE_PROPS = [
12271
12293
  'opacity',
12272
12294
  'fillOpacity',
@@ -12318,13 +12340,6 @@ var DisplayObject = /** @class */ (function (_super) {
12318
12340
  * push to active animations after calling `animate()`
12319
12341
  */
12320
12342
  _this.activeAnimations = [];
12321
- /**
12322
- * Use `this.style.clipPath` instead.
12323
- * @deprecated
12324
- */
12325
- _this.getClip = function () {
12326
- return this.style.clipPath || null;
12327
- };
12328
12343
  // assign name, id to config
12329
12344
  // eg. group.get('name')
12330
12345
  _this.config = config;
@@ -12335,18 +12350,12 @@ var DisplayObject = /** @class */ (function (_super) {
12335
12350
  _this.className = _this.config.className || _this.config.class;
12336
12351
  }
12337
12352
  _this.nodeName = _this.config.type || exports.Shape.GROUP;
12338
- // merge parsed value
12339
- Object.assign(_this.parsedStyle, runtime.enableCSSParsing
12340
- ? DEFAULT_PARSED_STYLE_PROPS
12341
- : DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED, _this.config.initialParsedStyle);
12342
12353
  if (runtime.enableCSSParsing) {
12343
12354
  Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
12355
+ Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
12344
12356
  }
12345
12357
  // start to process attributes
12346
12358
  _this.initAttributes(_this.config.style);
12347
- var Proxy = runtime.globalThis.Proxy
12348
- ? runtime.globalThis.Proxy
12349
- : function () { };
12350
12359
  if (runtime.enableDataset) {
12351
12360
  _this.dataset = new Proxy({}, {
12352
12361
  get: function (target, name) {
@@ -12464,10 +12473,14 @@ var DisplayObject = /** @class */ (function (_super) {
12464
12473
  options.usedAttributes = INHERITABLE_STYLE_PROPS;
12465
12474
  }
12466
12475
  // account for FCP, process properties as less as possible
12467
- var formattedAttributes = {};
12468
- for (var name_1 in attributes) {
12469
- var attributeName = formatAttributeName(name_1);
12470
- formattedAttributes[attributeName] = attributes[name_1];
12476
+ var formattedAttributes = attributes;
12477
+ if (runtime.enableAttributeDashCased) {
12478
+ // @ts-ignore
12479
+ formattedAttributes = {};
12480
+ for (var name_1 in attributes) {
12481
+ var attributeName = formatAttributeName(name_1);
12482
+ formattedAttributes[attributeName] = attributes[name_1];
12483
+ }
12471
12484
  }
12472
12485
  runtime.styleValueRegistry.processProperties(this, formattedAttributes, options);
12473
12486
  // redraw at next frame
@@ -12476,14 +12489,16 @@ var DisplayObject = /** @class */ (function (_super) {
12476
12489
  DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
12477
12490
  if (force === void 0) { force = false; }
12478
12491
  if (memoize === void 0) { memoize = true; }
12479
- var attributeName = formatAttributeName(name);
12492
+ if (runtime.enableAttributeDashCased) {
12493
+ name = formatAttributeName(name);
12494
+ }
12480
12495
  // ignore undefined value
12481
12496
  if (util.isUndefined(value)) {
12482
12497
  return;
12483
12498
  }
12484
- if (force || value !== this.attributes[attributeName]) {
12485
- this.internalSetAttribute(attributeName, value, { memoize: memoize });
12486
- _super.prototype.setAttribute.call(this, attributeName, value);
12499
+ if (force || value !== this.attributes[name]) {
12500
+ this.internalSetAttribute(name, value, { memoize: memoize });
12501
+ _super.prototype.setAttribute.call(this, name, value);
12487
12502
  }
12488
12503
  };
12489
12504
  /**
@@ -12737,8 +12752,10 @@ var DisplayObject = /** @class */ (function (_super) {
12737
12752
  * shortcut for Used value of `visibility`
12738
12753
  */
12739
12754
  DisplayObject.prototype.isVisible = function () {
12740
- var _a;
12741
- return ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible';
12755
+ var _a, _b;
12756
+ return runtime.enableCSSParsing
12757
+ ? ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible'
12758
+ : ((_b = this.parsedStyle) === null || _b === void 0 ? void 0 : _b.visibility) !== 'hidden';
12742
12759
  };
12743
12760
  Object.defineProperty(DisplayObject.prototype, "interactive", {
12744
12761
  get: function () {
@@ -12930,13 +12947,6 @@ var DisplayObject = /** @class */ (function (_super) {
12930
12947
  DisplayObject.prototype.add = function (child, index) {
12931
12948
  return this.appendChild(child, index);
12932
12949
  };
12933
- /**
12934
- * Use `this.style.clipPath` instead.
12935
- * @deprecated
12936
- */
12937
- DisplayObject.prototype.setClip = function (clipPath) {
12938
- this.style.clipPath = clipPath;
12939
- };
12940
12950
  /**
12941
12951
  * @deprecated
12942
12952
  */
@@ -13037,11 +13047,11 @@ var Ellipse = /** @class */ (function (_super) {
13037
13047
  */
13038
13048
  var Group = /** @class */ (function (_super) {
13039
13049
  tslib.__extends(Group, _super);
13040
- function Group(_a) {
13041
- if (_a === void 0) { _a = {}; }
13042
- var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13043
- return _super.call(this, tslib.__assign({ type: exports.Shape.GROUP, style: runtime.enableCSSParsing
13044
- ? tslib.__assign({ width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
13050
+ function Group(options) {
13051
+ if (options === void 0) { options = {}; }
13052
+ var _this = _super.call(this, options) || this;
13053
+ _this.nodeName = exports.Shape.GROUP;
13054
+ return _this;
13045
13055
  }
13046
13056
  return Group;
13047
13057
  }(DisplayObject));
@@ -13114,11 +13124,11 @@ var HTML = /** @class */ (function (_super) {
13114
13124
 
13115
13125
  var Image = /** @class */ (function (_super) {
13116
13126
  tslib.__extends(Image, _super);
13117
- function Image(_a) {
13118
- if (_a === void 0) { _a = {}; }
13119
- var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13120
- return _super.call(this, tslib.__assign({ type: exports.Shape.IMAGE, style: runtime.enableCSSParsing
13121
- ? tslib.__assign({ x: '', y: '', img: '', width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
13127
+ function Image(options) {
13128
+ if (options === void 0) { options = {}; }
13129
+ var _this = _super.call(this, options) || this;
13130
+ _this.nodeName = exports.Shape.IMAGE;
13131
+ return _this;
13122
13132
  }
13123
13133
  return Image;
13124
13134
  }(DisplayObject));
@@ -13649,11 +13659,11 @@ var Polyline = /** @class */ (function (_super) {
13649
13659
 
13650
13660
  var Rect = /** @class */ (function (_super) {
13651
13661
  tslib.__extends(Rect, _super);
13652
- function Rect(_a) {
13653
- if (_a === void 0) { _a = {}; }
13654
- var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13655
- return _super.call(this, tslib.__assign({ type: exports.Shape.RECT, style: runtime.enableCSSParsing
13656
- ? tslib.__assign({ x: '', y: '', width: '', height: '', radius: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
13662
+ function Rect(options) {
13663
+ if (options === void 0) { options = {}; }
13664
+ var _this = _super.call(this, options) || this;
13665
+ _this.nodeName = exports.Shape.RECT;
13666
+ return _this;
13657
13667
  }
13658
13668
  return Rect;
13659
13669
  }(DisplayObject));
@@ -14714,9 +14724,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
14714
14724
  * sync to RBush later
14715
14725
  */
14716
14726
  this.toSync = new Set();
14727
+ // private isFirstTimeRendering = true;
14728
+ this.syncing = false;
14717
14729
  }
14718
- // private isFirstTimeRendering = true;
14719
- // private syncing = false;
14720
14730
  PrepareRendererPlugin.prototype.apply = function (context) {
14721
14731
  var _this = this;
14722
14732
  var renderingService = context.renderingService, renderingContext = context.renderingContext, rBushRoot = context.rBushRoot;
@@ -14778,25 +14788,17 @@ var PrepareRendererPlugin = /** @class */ (function () {
14778
14788
  _this.toSync.clear();
14779
14789
  });
14780
14790
  renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
14781
- // if (this.isFirstTimeRendering) {
14782
- // this.isFirstTimeRendering = false;
14783
- // this.syncing = true;
14784
- // // @see https://github.com/antvis/G/issues/1117
14785
- // setTimeout(() => {
14786
- // this.syncRTree();
14787
- // console.log('fcp...');
14788
- // });
14789
- // } else {
14790
- // console.log('next...');
14791
- _this.syncRTree();
14792
- // }
14791
+ requestIdleCallback(function () {
14792
+ _this.syncRTree();
14793
+ });
14793
14794
  });
14794
14795
  };
14795
14796
  PrepareRendererPlugin.prototype.syncRTree = function () {
14796
- // if (this.syncing) {
14797
- // return;
14798
- // }
14799
14797
  var _this = this;
14798
+ if (this.syncing || this.toSync.size === 0) {
14799
+ return;
14800
+ }
14801
+ this.syncing = true;
14800
14802
  // bounds changed, need re-inserting its children
14801
14803
  var bulk = [];
14802
14804
  Array.from(this.toSync)
@@ -14836,7 +14838,7 @@ var PrepareRendererPlugin = /** @class */ (function () {
14836
14838
  this.rBush.load(bulk);
14837
14839
  bulk.length = 0;
14838
14840
  this.toSync.clear();
14839
- // this.syncing = false;
14841
+ this.syncing = false;
14840
14842
  };
14841
14843
  PrepareRendererPlugin.tag = 'Prepare';
14842
14844
  return PrepareRendererPlugin;