@antv/g-lite 1.3.0-next.10 → 1.3.0-next.11
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/global-runtime.d.ts +6 -0
- package/dist/index.esm.js +144 -127
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +144 -127
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6565,7 +6565,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6565
6565
|
d: '0',
|
|
6566
6566
|
},
|
|
6567
6567
|
];
|
|
6568
|
-
|
|
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
|
|
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
|
|
6631
|
-
if (!
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
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,
|
|
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,
|
|
6724
|
+
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames);
|
|
6725
6725
|
}
|
|
6726
6726
|
if (attributes.transform) {
|
|
6727
|
-
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object,
|
|
6727
|
+
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
|
|
6728
6728
|
}
|
|
6729
|
-
if (
|
|
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
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
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
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
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
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
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
|
-
|
|
6801
|
-
|
|
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;
|
|
@@ -10060,7 +10062,7 @@ var RenderingService = /** @class */ (function () {
|
|
|
10060
10062
|
this.zIndexCounter = 0;
|
|
10061
10063
|
var renderingContext = this.context.renderingContext;
|
|
10062
10064
|
this.globalRuntime.sceneGraphService.syncHierarchy(renderingContext.root);
|
|
10063
|
-
this.globalRuntime.sceneGraphService.triggerPendingEvents();
|
|
10065
|
+
// this.globalRuntime.sceneGraphService.triggerPendingEvents();
|
|
10064
10066
|
if (renderingContext.renderReasons.size && this.inited) {
|
|
10065
10067
|
// @ts-ignore
|
|
10066
10068
|
renderingContext.dirtyRectangleRenderingDisabled =
|
|
@@ -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
|
-
|
|
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
|
-
|
|
12163
|
-
|
|
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
|
}
|
|
@@ -12266,7 +12272,20 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
12266
12272
|
shadowType: 'outer',
|
|
12267
12273
|
miterLimit: 10,
|
|
12268
12274
|
};
|
|
12269
|
-
|
|
12275
|
+
// const DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = {
|
|
12276
|
+
// ...DEFAULT_PARSED_STYLE_PROPS,
|
|
12277
|
+
// opacity: 1,
|
|
12278
|
+
// fillOpacity: 1,
|
|
12279
|
+
// strokeOpacity: 1,
|
|
12280
|
+
// visibility: 'visible',
|
|
12281
|
+
// pointerEvents: 'auto',
|
|
12282
|
+
// lineWidth: 1,
|
|
12283
|
+
// lineCap: 'butt',
|
|
12284
|
+
// lineJoin: 'miter',
|
|
12285
|
+
// increasedLineWidthForHitTesting: 0,
|
|
12286
|
+
// fillRule: 'nonzero',
|
|
12287
|
+
// // TODO: transformOrigin
|
|
12288
|
+
// };
|
|
12270
12289
|
var INHERITABLE_BASE_STYLE_PROPS = [
|
|
12271
12290
|
'opacity',
|
|
12272
12291
|
'fillOpacity',
|
|
@@ -12335,12 +12354,9 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12335
12354
|
_this.className = _this.config.className || _this.config.class;
|
|
12336
12355
|
}
|
|
12337
12356
|
_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
12357
|
if (runtime.enableCSSParsing) {
|
|
12343
12358
|
Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
|
|
12359
|
+
Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
|
|
12344
12360
|
}
|
|
12345
12361
|
// start to process attributes
|
|
12346
12362
|
_this.initAttributes(_this.config.style);
|
|
@@ -12464,10 +12480,14 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12464
12480
|
options.usedAttributes = INHERITABLE_STYLE_PROPS;
|
|
12465
12481
|
}
|
|
12466
12482
|
// account for FCP, process properties as less as possible
|
|
12467
|
-
var formattedAttributes =
|
|
12468
|
-
|
|
12469
|
-
|
|
12470
|
-
formattedAttributes
|
|
12483
|
+
var formattedAttributes = attributes;
|
|
12484
|
+
if (runtime.enableAttributeDashCased) {
|
|
12485
|
+
// @ts-ignore
|
|
12486
|
+
formattedAttributes = {};
|
|
12487
|
+
for (var name_1 in attributes) {
|
|
12488
|
+
var attributeName = formatAttributeName(name_1);
|
|
12489
|
+
formattedAttributes[attributeName] = attributes[name_1];
|
|
12490
|
+
}
|
|
12471
12491
|
}
|
|
12472
12492
|
runtime.styleValueRegistry.processProperties(this, formattedAttributes, options);
|
|
12473
12493
|
// redraw at next frame
|
|
@@ -12476,14 +12496,16 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12476
12496
|
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12477
12497
|
if (force === void 0) { force = false; }
|
|
12478
12498
|
if (memoize === void 0) { memoize = true; }
|
|
12479
|
-
|
|
12499
|
+
if (runtime.enableAttributeDashCased) {
|
|
12500
|
+
name = formatAttributeName(name);
|
|
12501
|
+
}
|
|
12480
12502
|
// ignore undefined value
|
|
12481
12503
|
if (util.isUndefined(value)) {
|
|
12482
12504
|
return;
|
|
12483
12505
|
}
|
|
12484
|
-
if (force || value !== this.attributes[
|
|
12485
|
-
this.internalSetAttribute(
|
|
12486
|
-
_super.prototype.setAttribute.call(this,
|
|
12506
|
+
if (force || value !== this.attributes[name]) {
|
|
12507
|
+
this.internalSetAttribute(name, value, { memoize: memoize });
|
|
12508
|
+
_super.prototype.setAttribute.call(this, name, value);
|
|
12487
12509
|
}
|
|
12488
12510
|
};
|
|
12489
12511
|
/**
|
|
@@ -12737,8 +12759,10 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12737
12759
|
* shortcut for Used value of `visibility`
|
|
12738
12760
|
*/
|
|
12739
12761
|
DisplayObject.prototype.isVisible = function () {
|
|
12740
|
-
var _a;
|
|
12741
|
-
return
|
|
12762
|
+
var _a, _b;
|
|
12763
|
+
return runtime.enableCSSParsing
|
|
12764
|
+
? ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible'
|
|
12765
|
+
: ((_b = this.parsedStyle) === null || _b === void 0 ? void 0 : _b.visibility) !== 'hidden';
|
|
12742
12766
|
};
|
|
12743
12767
|
Object.defineProperty(DisplayObject.prototype, "interactive", {
|
|
12744
12768
|
get: function () {
|
|
@@ -14714,9 +14738,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14714
14738
|
* sync to RBush later
|
|
14715
14739
|
*/
|
|
14716
14740
|
this.toSync = new Set();
|
|
14741
|
+
// private isFirstTimeRendering = true;
|
|
14742
|
+
this.syncing = false;
|
|
14717
14743
|
}
|
|
14718
|
-
// private isFirstTimeRendering = true;
|
|
14719
|
-
// private syncing = false;
|
|
14720
14744
|
PrepareRendererPlugin.prototype.apply = function (context) {
|
|
14721
14745
|
var _this = this;
|
|
14722
14746
|
var renderingService = context.renderingService, renderingContext = context.renderingContext, rBushRoot = context.rBushRoot;
|
|
@@ -14778,25 +14802,17 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14778
14802
|
_this.toSync.clear();
|
|
14779
14803
|
});
|
|
14780
14804
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
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
|
-
// }
|
|
14805
|
+
requestIdleCallback(function () {
|
|
14806
|
+
_this.syncRTree();
|
|
14807
|
+
});
|
|
14793
14808
|
});
|
|
14794
14809
|
};
|
|
14795
14810
|
PrepareRendererPlugin.prototype.syncRTree = function () {
|
|
14796
|
-
// if (this.syncing) {
|
|
14797
|
-
// return;
|
|
14798
|
-
// }
|
|
14799
14811
|
var _this = this;
|
|
14812
|
+
if (this.syncing || this.toSync.size === 0) {
|
|
14813
|
+
return;
|
|
14814
|
+
}
|
|
14815
|
+
this.syncing = true;
|
|
14800
14816
|
// bounds changed, need re-inserting its children
|
|
14801
14817
|
var bulk = [];
|
|
14802
14818
|
Array.from(this.toSync)
|
|
@@ -14834,9 +14850,10 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14834
14850
|
// use bulk inserting, which is ~2-3 times faster
|
|
14835
14851
|
// @see https://github.com/mourner/rbush#bulk-inserting-data
|
|
14836
14852
|
this.rBush.load(bulk);
|
|
14853
|
+
console.log('sync...', Array.from(this.toSync));
|
|
14837
14854
|
bulk.length = 0;
|
|
14838
14855
|
this.toSync.clear();
|
|
14839
|
-
|
|
14856
|
+
this.syncing = false;
|
|
14840
14857
|
};
|
|
14841
14858
|
PrepareRendererPlugin.tag = 'Prepare';
|
|
14842
14859
|
return PrepareRendererPlugin;
|