@antv/g-lite 1.0.42 → 1.0.44
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/camera/Camera.d.ts +1 -0
- package/dist/camera/Camera.d.ts.map +1 -1
- package/dist/camera/interfaces.d.ts +4 -0
- package/dist/camera/interfaces.d.ts.map +1 -1
- package/dist/components/Geometry.d.ts +1 -0
- package/dist/components/Geometry.d.ts.map +1 -1
- package/dist/css/StyleValueRegistry.d.ts +1 -1
- package/dist/css/StyleValueRegistry.d.ts.map +1 -1
- package/dist/css/interfaces.d.ts +1 -0
- package/dist/css/interfaces.d.ts.map +1 -1
- package/dist/css/parser/dimension.d.ts.map +1 -1
- package/dist/display-objects/DisplayObject.d.ts.map +1 -1
- package/dist/dom/Element.d.ts.map +1 -1
- package/dist/index.esm.js +90 -31
- package/dist/index.js +89 -30
- package/dist/index.umd.js +89 -30
- package/dist/index.umd.min.js +1 -1
- package/dist/plugins/DirtyCheckPlugin.d.ts.map +1 -1
- package/dist/plugins/PrepareRendererPlugin.d.ts.map +1 -1
- package/dist/services/SceneGraphService.d.ts +1 -1
- package/dist/services/SceneGraphService.d.ts.map +1 -1
- package/dist/services/TextService.d.ts +1 -1
- package/dist/services/TextService.d.ts.map +1 -1
- package/dist/services/aabb/TextUpdater.d.ts +1 -1
- package/dist/services/aabb/TextUpdater.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1645,8 +1645,8 @@ function cleanExistedCanvas(container, canvas) {
|
|
|
1645
1645
|
var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
1646
1646
|
|
|
1647
1647
|
function sortByZIndex(o1, o2) {
|
|
1648
|
-
var zIndex1 = Number(o1.
|
|
1649
|
-
var zIndex2 = Number(o2.
|
|
1648
|
+
var zIndex1 = Number(o1.parsedStyle.zIndex);
|
|
1649
|
+
var zIndex2 = Number(o2.parsedStyle.zIndex);
|
|
1650
1650
|
if (zIndex1 === zIndex2) {
|
|
1651
1651
|
// return o1.entity.getComponent(Sortable).lastSortedIndex - o2.entity.getComponent(Sortable).lastSortedIndex;
|
|
1652
1652
|
var parent = o1.parentNode;
|
|
@@ -1759,12 +1759,12 @@ function createVec3(x, y, z) {
|
|
|
1759
1759
|
if (z === void 0) {
|
|
1760
1760
|
z = 0;
|
|
1761
1761
|
}
|
|
1762
|
-
if (util.isNumber(x)) {
|
|
1763
|
-
return glMatrix.vec3.fromValues(x, y, z);
|
|
1764
|
-
}
|
|
1765
1762
|
if (Array.isArray(x) && x.length === 3) {
|
|
1766
1763
|
return glMatrix.vec3.clone(x);
|
|
1767
1764
|
}
|
|
1765
|
+
if (util.isNumber(x)) {
|
|
1766
|
+
return glMatrix.vec3.fromValues(x, y, z);
|
|
1767
|
+
}
|
|
1768
1768
|
return glMatrix.vec3.fromValues(x[0], x[1] || y, x[2] || z);
|
|
1769
1769
|
}
|
|
1770
1770
|
function deg2rad(deg) {
|
|
@@ -4519,10 +4519,10 @@ function isCSSGradientValue(object) {
|
|
|
4519
4519
|
return !!object.type && !!object.value;
|
|
4520
4520
|
}
|
|
4521
4521
|
function isPattern(object) {
|
|
4522
|
-
return
|
|
4522
|
+
return object && !!object.image;
|
|
4523
4523
|
}
|
|
4524
4524
|
function isCSSRGB(object) {
|
|
4525
|
-
return
|
|
4525
|
+
return object && !util.isNil(object.r) && !util.isNil(object.g) && !util.isNil(object.b);
|
|
4526
4526
|
}
|
|
4527
4527
|
/**
|
|
4528
4528
|
* @see https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/parser/CSSParser.cpp#L97
|
|
@@ -5110,17 +5110,17 @@ function convertAngleUnit(value) {
|
|
|
5110
5110
|
}
|
|
5111
5111
|
function parseDimensionArrayFormat(string, size) {
|
|
5112
5112
|
var parsed;
|
|
5113
|
-
if (
|
|
5113
|
+
if (Array.isArray(string)) {
|
|
5114
|
+
// [1, '2px', 3]
|
|
5115
|
+
parsed = string.map(function (segment) {
|
|
5116
|
+
return Number(segment);
|
|
5117
|
+
});
|
|
5118
|
+
} else if (util.isString(string)) {
|
|
5114
5119
|
parsed = string.split(' ').map(function (segment) {
|
|
5115
5120
|
return Number(segment);
|
|
5116
5121
|
});
|
|
5117
5122
|
} else if (util.isNumber(string)) {
|
|
5118
5123
|
parsed = [string];
|
|
5119
|
-
} else {
|
|
5120
|
-
// [1, '2px', 3]
|
|
5121
|
-
parsed = string.map(function (segment) {
|
|
5122
|
-
return Number(segment);
|
|
5123
|
-
});
|
|
5124
5124
|
}
|
|
5125
5125
|
if (size === 2) {
|
|
5126
5126
|
if (parsed.length === 1) {
|
|
@@ -5174,7 +5174,9 @@ function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
|
5174
5174
|
if (valueWithUnit.unit === exports.UnitType.kPixels) {
|
|
5175
5175
|
return Number(valueWithUnit.value);
|
|
5176
5176
|
} else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
|
|
5177
|
-
var bounds = target.nodeName === exports.Shape.GROUP ? target.getLocalBounds() :
|
|
5177
|
+
var bounds = target.nodeName === exports.Shape.GROUP ? target.getLocalBounds() :
|
|
5178
|
+
// : target.getGeometryBounds();
|
|
5179
|
+
target.geometry.contentBounds;
|
|
5178
5180
|
var size = 0;
|
|
5179
5181
|
if (!AABB.isEmpty(bounds)) {
|
|
5180
5182
|
size = bounds.halfExtents[vec3Index] * 2;
|
|
@@ -7640,6 +7642,7 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
7640
7642
|
renderOrder: 0
|
|
7641
7643
|
};
|
|
7642
7644
|
_this.geometry = {
|
|
7645
|
+
dirty: false,
|
|
7643
7646
|
contentBounds: undefined,
|
|
7644
7647
|
renderBounds: undefined
|
|
7645
7648
|
};
|
|
@@ -8981,14 +8984,26 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
8981
8984
|
* @deprecated
|
|
8982
8985
|
*/;
|
|
8983
8986
|
_proto.show = function show() {
|
|
8984
|
-
|
|
8987
|
+
if (runtime.enableCSSParsing) {
|
|
8988
|
+
this.style.visibility = 'visible';
|
|
8989
|
+
} else {
|
|
8990
|
+
this.forEach(function (object) {
|
|
8991
|
+
object.style.visibility = 'visible';
|
|
8992
|
+
});
|
|
8993
|
+
}
|
|
8985
8994
|
}
|
|
8986
8995
|
/**
|
|
8987
8996
|
* Use `visibility: hidden` instead.
|
|
8988
8997
|
* @deprecated
|
|
8989
8998
|
*/;
|
|
8990
8999
|
_proto.hide = function hide() {
|
|
8991
|
-
|
|
9000
|
+
if (runtime.enableCSSParsing) {
|
|
9001
|
+
this.style.visibility = 'hidden';
|
|
9002
|
+
} else {
|
|
9003
|
+
this.forEach(function (object) {
|
|
9004
|
+
object.style.visibility = 'hidden';
|
|
9005
|
+
});
|
|
9006
|
+
}
|
|
8992
9007
|
}
|
|
8993
9008
|
/**
|
|
8994
9009
|
* Use `childElementCount` instead.
|
|
@@ -10599,6 +10614,11 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
10599
10614
|
int: true,
|
|
10600
10615
|
d: '0'
|
|
10601
10616
|
}];
|
|
10617
|
+
var GEOMETRY_ATTRIBUTE_NAMES = BUILT_IN_PROPERTIES.filter(function (n) {
|
|
10618
|
+
return !!n.l;
|
|
10619
|
+
}).map(function (n) {
|
|
10620
|
+
return n.n;
|
|
10621
|
+
});
|
|
10602
10622
|
var propertyMetadataCache = {};
|
|
10603
10623
|
var unresolvedProperties = new WeakMap();
|
|
10604
10624
|
// const uniqueAttributeSet = new Set<string>();
|
|
@@ -10683,6 +10703,15 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
10683
10703
|
var oldClipPath = object.parsedStyle.clipPath;
|
|
10684
10704
|
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
10685
10705
|
object.parsedStyle = Object.assign(object.parsedStyle, attributes);
|
|
10706
|
+
var _needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
10707
|
+
if (!_needUpdateGeometry) {
|
|
10708
|
+
for (var i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
|
|
10709
|
+
if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
|
|
10710
|
+
_needUpdateGeometry = true;
|
|
10711
|
+
break;
|
|
10712
|
+
}
|
|
10713
|
+
}
|
|
10714
|
+
}
|
|
10686
10715
|
if (attributes.fill) {
|
|
10687
10716
|
object.parsedStyle.fill = parseColor(attributes.fill);
|
|
10688
10717
|
}
|
|
@@ -10820,7 +10849,10 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
10820
10849
|
if (attributes.transform) {
|
|
10821
10850
|
runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, _attributeNames);
|
|
10822
10851
|
}
|
|
10823
|
-
|
|
10852
|
+
if (_needUpdateGeometry) {
|
|
10853
|
+
object.geometry.dirty = true;
|
|
10854
|
+
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
10855
|
+
}
|
|
10824
10856
|
return;
|
|
10825
10857
|
}
|
|
10826
10858
|
var _options = options,
|
|
@@ -10885,7 +10917,8 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
10885
10917
|
// }
|
|
10886
10918
|
// update geometry
|
|
10887
10919
|
if (needUpdateGeometry) {
|
|
10888
|
-
|
|
10920
|
+
object.geometry.dirty = true;
|
|
10921
|
+
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
10889
10922
|
}
|
|
10890
10923
|
attributeNames.forEach(function (name) {
|
|
10891
10924
|
if (name in object.parsedStyle) {
|
|
@@ -11193,7 +11226,10 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
11193
11226
|
usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0] || 0) * geometry.contentBounds.halfExtents[0] * 2;
|
|
11194
11227
|
usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1] || 0) * geometry.contentBounds.halfExtents[1] * 2;
|
|
11195
11228
|
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
11196
|
-
|
|
11229
|
+
geometry.dirty = false;
|
|
11230
|
+
// console.log('calc geometry', object);
|
|
11231
|
+
// FIXME setOrigin may have already dirtified to root.
|
|
11232
|
+
// runtime.sceneGraphService.dirtifyToRoot(object);
|
|
11197
11233
|
}
|
|
11198
11234
|
};
|
|
11199
11235
|
_proto.isPropertyInheritable = function isPropertyInheritable(name) {
|
|
@@ -11872,6 +11908,9 @@ var Camera = /*#__PURE__*/function () {
|
|
|
11872
11908
|
_proto.gotoLandmark = function gotoLandmark(name, options) {
|
|
11873
11909
|
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
11874
11910
|
};
|
|
11911
|
+
_proto.cancelLandmarkAnimation = function cancelLandmarkAnimation() {
|
|
11912
|
+
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
11913
|
+
};
|
|
11875
11914
|
return Camera;
|
|
11876
11915
|
}();
|
|
11877
11916
|
|
|
@@ -12079,7 +12118,8 @@ var TextUpdater = /*#__PURE__*/function () {
|
|
|
12079
12118
|
} else if (textBaseline === 'top' || textBaseline === 'hanging') {
|
|
12080
12119
|
lineYOffset = halfExtents[1] * 2;
|
|
12081
12120
|
} else if (textBaseline === 'alphabetic') {
|
|
12082
|
-
|
|
12121
|
+
// prevent calling getImageData for ascent metrics
|
|
12122
|
+
lineYOffset = runtime.enableCSSParsing ? lineHeight - fontProperties.ascent : 0;
|
|
12083
12123
|
} else if (textBaseline === 'bottom' || textBaseline === 'ideographic') {
|
|
12084
12124
|
lineYOffset = 0;
|
|
12085
12125
|
}
|
|
@@ -14024,6 +14064,9 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14024
14064
|
render = false;
|
|
14025
14065
|
}
|
|
14026
14066
|
var geometry = element.geometry;
|
|
14067
|
+
if (geometry.dirty) {
|
|
14068
|
+
runtime.styleValueRegistry.updateGeometry(element);
|
|
14069
|
+
}
|
|
14027
14070
|
var bounds = render ? geometry.renderBounds : geometry.contentBounds || null;
|
|
14028
14071
|
// return (bounds && new AABB(bounds.center, bounds.halfExtents)) || new AABB();
|
|
14029
14072
|
return bounds || new AABB();
|
|
@@ -14341,12 +14384,19 @@ var TextService = /*#__PURE__*/function () {
|
|
|
14341
14384
|
_parsedStyle$leading = parsedStyle.leading,
|
|
14342
14385
|
leading = _parsedStyle$leading === void 0 ? 0 : _parsedStyle$leading;
|
|
14343
14386
|
var font = toFontString(parsedStyle);
|
|
14344
|
-
var fontProperties
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
fontProperties.
|
|
14387
|
+
var fontProperties;
|
|
14388
|
+
if (runtime.enableCSSParsing) {
|
|
14389
|
+
fontProperties = this.measureFont(font, offscreenCanvas);
|
|
14390
|
+
// fallback in case UA disallow canvas data extraction
|
|
14391
|
+
// (toDataURI, getImageData functions)
|
|
14392
|
+
if (fontProperties.fontSize === 0) {
|
|
14393
|
+
fontProperties.fontSize = fontSize;
|
|
14394
|
+
fontProperties.ascent = fontSize;
|
|
14395
|
+
}
|
|
14396
|
+
} else {
|
|
14397
|
+
fontProperties = {
|
|
14398
|
+
fontSize: fontSize
|
|
14399
|
+
};
|
|
14350
14400
|
}
|
|
14351
14401
|
var context = this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);
|
|
14352
14402
|
context.font = font;
|
|
@@ -15127,6 +15177,7 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
15127
15177
|
}
|
|
15128
15178
|
var _proto = PrepareRendererPlugin.prototype;
|
|
15129
15179
|
// private isFirstTimeRendering = true;
|
|
15180
|
+
// private syncing = false;
|
|
15130
15181
|
_proto.apply = function apply(context) {
|
|
15131
15182
|
var _this = this;
|
|
15132
15183
|
var renderingService = context.renderingService,
|
|
@@ -15201,17 +15252,24 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
15201
15252
|
});
|
|
15202
15253
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
15203
15254
|
// if (this.isFirstTimeRendering) {
|
|
15204
|
-
// // @see https://github.com/antvis/G/issues/1117
|
|
15205
|
-
// setTimeout(() => this.syncRTree());
|
|
15206
15255
|
// this.isFirstTimeRendering = false;
|
|
15256
|
+
// this.syncing = true;
|
|
15257
|
+
// // @see https://github.com/antvis/G/issues/1117
|
|
15258
|
+
// setTimeout(() => {
|
|
15259
|
+
// this.syncRTree();
|
|
15260
|
+
// console.log('fcp...');
|
|
15261
|
+
// });
|
|
15207
15262
|
// } else {
|
|
15208
|
-
//
|
|
15209
|
-
// }
|
|
15263
|
+
// console.log('next...');
|
|
15210
15264
|
_this.syncRTree();
|
|
15265
|
+
// }
|
|
15211
15266
|
});
|
|
15212
15267
|
};
|
|
15213
15268
|
_proto.syncRTree = function syncRTree() {
|
|
15214
15269
|
var _this2 = this;
|
|
15270
|
+
// if (this.syncing) {
|
|
15271
|
+
// return;
|
|
15272
|
+
// }
|
|
15215
15273
|
// bounds changed, need re-inserting its children
|
|
15216
15274
|
var bulk = [];
|
|
15217
15275
|
Array.from(this.toSync)
|
|
@@ -15254,6 +15312,7 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
15254
15312
|
this.rBush.load(bulk);
|
|
15255
15313
|
bulk.length = 0;
|
|
15256
15314
|
this.toSync.clear();
|
|
15315
|
+
// this.syncing = false;
|
|
15257
15316
|
};
|
|
15258
15317
|
return PrepareRendererPlugin;
|
|
15259
15318
|
}();
|
package/dist/index.umd.js
CHANGED
|
@@ -7390,8 +7390,8 @@
|
|
|
7390
7390
|
var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
7391
7391
|
|
|
7392
7392
|
function sortByZIndex(o1, o2) {
|
|
7393
|
-
var zIndex1 = Number(o1.
|
|
7394
|
-
var zIndex2 = Number(o2.
|
|
7393
|
+
var zIndex1 = Number(o1.parsedStyle.zIndex);
|
|
7394
|
+
var zIndex2 = Number(o2.parsedStyle.zIndex);
|
|
7395
7395
|
if (zIndex1 === zIndex2) {
|
|
7396
7396
|
// return o1.entity.getComponent(Sortable).lastSortedIndex - o2.entity.getComponent(Sortable).lastSortedIndex;
|
|
7397
7397
|
var parent = o1.parentNode;
|
|
@@ -7504,12 +7504,12 @@
|
|
|
7504
7504
|
if (z === void 0) {
|
|
7505
7505
|
z = 0;
|
|
7506
7506
|
}
|
|
7507
|
-
if (isNumber(x)) {
|
|
7508
|
-
return fromValues$2(x, y, z);
|
|
7509
|
-
}
|
|
7510
7507
|
if (Array.isArray(x) && x.length === 3) {
|
|
7511
7508
|
return clone$1(x);
|
|
7512
7509
|
}
|
|
7510
|
+
if (isNumber(x)) {
|
|
7511
|
+
return fromValues$2(x, y, z);
|
|
7512
|
+
}
|
|
7513
7513
|
return fromValues$2(x[0], x[1] || y, x[2] || z);
|
|
7514
7514
|
}
|
|
7515
7515
|
function deg2rad(deg) {
|
|
@@ -11155,10 +11155,10 @@
|
|
|
11155
11155
|
return !!object.type && !!object.value;
|
|
11156
11156
|
}
|
|
11157
11157
|
function isPattern(object) {
|
|
11158
|
-
return
|
|
11158
|
+
return object && !!object.image;
|
|
11159
11159
|
}
|
|
11160
11160
|
function isCSSRGB(object) {
|
|
11161
|
-
return
|
|
11161
|
+
return object && !isNil(object.r) && !isNil(object.g) && !isNil(object.b);
|
|
11162
11162
|
}
|
|
11163
11163
|
/**
|
|
11164
11164
|
* @see https://github.com/WebKit/WebKit/blob/main/Source/WebCore/css/parser/CSSParser.cpp#L97
|
|
@@ -11746,17 +11746,17 @@
|
|
|
11746
11746
|
}
|
|
11747
11747
|
function parseDimensionArrayFormat(string, size) {
|
|
11748
11748
|
var parsed;
|
|
11749
|
-
if (
|
|
11749
|
+
if (Array.isArray(string)) {
|
|
11750
|
+
// [1, '2px', 3]
|
|
11751
|
+
parsed = string.map(function (segment) {
|
|
11752
|
+
return Number(segment);
|
|
11753
|
+
});
|
|
11754
|
+
} else if (isString(string)) {
|
|
11750
11755
|
parsed = string.split(' ').map(function (segment) {
|
|
11751
11756
|
return Number(segment);
|
|
11752
11757
|
});
|
|
11753
11758
|
} else if (isNumber(string)) {
|
|
11754
11759
|
parsed = [string];
|
|
11755
|
-
} else {
|
|
11756
|
-
// [1, '2px', 3]
|
|
11757
|
-
parsed = string.map(function (segment) {
|
|
11758
|
-
return Number(segment);
|
|
11759
|
-
});
|
|
11760
11760
|
}
|
|
11761
11761
|
if (size === 2) {
|
|
11762
11762
|
if (parsed.length === 1) {
|
|
@@ -11810,7 +11810,9 @@
|
|
|
11810
11810
|
if (valueWithUnit.unit === exports.UnitType.kPixels) {
|
|
11811
11811
|
return Number(valueWithUnit.value);
|
|
11812
11812
|
} else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
|
|
11813
|
-
var bounds = target.nodeName === exports.Shape.GROUP ? target.getLocalBounds() :
|
|
11813
|
+
var bounds = target.nodeName === exports.Shape.GROUP ? target.getLocalBounds() :
|
|
11814
|
+
// : target.getGeometryBounds();
|
|
11815
|
+
target.geometry.contentBounds;
|
|
11814
11816
|
var size = 0;
|
|
11815
11817
|
if (!AABB.isEmpty(bounds)) {
|
|
11816
11818
|
size = bounds.halfExtents[vec3Index] * 2;
|
|
@@ -14614,6 +14616,7 @@
|
|
|
14614
14616
|
renderOrder: 0
|
|
14615
14617
|
};
|
|
14616
14618
|
_this.geometry = {
|
|
14619
|
+
dirty: false,
|
|
14617
14620
|
contentBounds: undefined,
|
|
14618
14621
|
renderBounds: undefined
|
|
14619
14622
|
};
|
|
@@ -15955,14 +15958,26 @@
|
|
|
15955
15958
|
* @deprecated
|
|
15956
15959
|
*/;
|
|
15957
15960
|
_proto.show = function show() {
|
|
15958
|
-
|
|
15961
|
+
if (runtime.enableCSSParsing) {
|
|
15962
|
+
this.style.visibility = 'visible';
|
|
15963
|
+
} else {
|
|
15964
|
+
this.forEach(function (object) {
|
|
15965
|
+
object.style.visibility = 'visible';
|
|
15966
|
+
});
|
|
15967
|
+
}
|
|
15959
15968
|
}
|
|
15960
15969
|
/**
|
|
15961
15970
|
* Use `visibility: hidden` instead.
|
|
15962
15971
|
* @deprecated
|
|
15963
15972
|
*/;
|
|
15964
15973
|
_proto.hide = function hide() {
|
|
15965
|
-
|
|
15974
|
+
if (runtime.enableCSSParsing) {
|
|
15975
|
+
this.style.visibility = 'hidden';
|
|
15976
|
+
} else {
|
|
15977
|
+
this.forEach(function (object) {
|
|
15978
|
+
object.style.visibility = 'hidden';
|
|
15979
|
+
});
|
|
15980
|
+
}
|
|
15966
15981
|
}
|
|
15967
15982
|
/**
|
|
15968
15983
|
* Use `childElementCount` instead.
|
|
@@ -17573,6 +17588,11 @@
|
|
|
17573
17588
|
int: true,
|
|
17574
17589
|
d: '0'
|
|
17575
17590
|
}];
|
|
17591
|
+
var GEOMETRY_ATTRIBUTE_NAMES = BUILT_IN_PROPERTIES.filter(function (n) {
|
|
17592
|
+
return !!n.l;
|
|
17593
|
+
}).map(function (n) {
|
|
17594
|
+
return n.n;
|
|
17595
|
+
});
|
|
17576
17596
|
var propertyMetadataCache = {};
|
|
17577
17597
|
var unresolvedProperties = new WeakMap();
|
|
17578
17598
|
// const uniqueAttributeSet = new Set<string>();
|
|
@@ -17657,6 +17677,15 @@
|
|
|
17657
17677
|
var oldClipPath = object.parsedStyle.clipPath;
|
|
17658
17678
|
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
17659
17679
|
object.parsedStyle = Object.assign(object.parsedStyle, attributes);
|
|
17680
|
+
var _needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
17681
|
+
if (!_needUpdateGeometry) {
|
|
17682
|
+
for (var i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
|
|
17683
|
+
if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
|
|
17684
|
+
_needUpdateGeometry = true;
|
|
17685
|
+
break;
|
|
17686
|
+
}
|
|
17687
|
+
}
|
|
17688
|
+
}
|
|
17660
17689
|
if (attributes.fill) {
|
|
17661
17690
|
object.parsedStyle.fill = parseColor(attributes.fill);
|
|
17662
17691
|
}
|
|
@@ -17794,7 +17823,10 @@
|
|
|
17794
17823
|
if (attributes.transform) {
|
|
17795
17824
|
runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, _attributeNames);
|
|
17796
17825
|
}
|
|
17797
|
-
|
|
17826
|
+
if (_needUpdateGeometry) {
|
|
17827
|
+
object.geometry.dirty = true;
|
|
17828
|
+
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
17829
|
+
}
|
|
17798
17830
|
return;
|
|
17799
17831
|
}
|
|
17800
17832
|
var _options = options,
|
|
@@ -17859,7 +17891,8 @@
|
|
|
17859
17891
|
// }
|
|
17860
17892
|
// update geometry
|
|
17861
17893
|
if (needUpdateGeometry) {
|
|
17862
|
-
|
|
17894
|
+
object.geometry.dirty = true;
|
|
17895
|
+
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
17863
17896
|
}
|
|
17864
17897
|
attributeNames.forEach(function (name) {
|
|
17865
17898
|
if (name in object.parsedStyle) {
|
|
@@ -18167,7 +18200,10 @@
|
|
|
18167
18200
|
usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0] || 0) * geometry.contentBounds.halfExtents[0] * 2;
|
|
18168
18201
|
usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1] || 0) * geometry.contentBounds.halfExtents[1] * 2;
|
|
18169
18202
|
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
18170
|
-
|
|
18203
|
+
geometry.dirty = false;
|
|
18204
|
+
// console.log('calc geometry', object);
|
|
18205
|
+
// FIXME setOrigin may have already dirtified to root.
|
|
18206
|
+
// runtime.sceneGraphService.dirtifyToRoot(object);
|
|
18171
18207
|
}
|
|
18172
18208
|
};
|
|
18173
18209
|
_proto.isPropertyInheritable = function isPropertyInheritable(name) {
|
|
@@ -18846,6 +18882,9 @@
|
|
|
18846
18882
|
_proto.gotoLandmark = function gotoLandmark(name, options) {
|
|
18847
18883
|
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
18848
18884
|
};
|
|
18885
|
+
_proto.cancelLandmarkAnimation = function cancelLandmarkAnimation() {
|
|
18886
|
+
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
18887
|
+
};
|
|
18849
18888
|
return Camera;
|
|
18850
18889
|
}();
|
|
18851
18890
|
|
|
@@ -19053,7 +19092,8 @@
|
|
|
19053
19092
|
} else if (textBaseline === 'top' || textBaseline === 'hanging') {
|
|
19054
19093
|
lineYOffset = halfExtents[1] * 2;
|
|
19055
19094
|
} else if (textBaseline === 'alphabetic') {
|
|
19056
|
-
|
|
19095
|
+
// prevent calling getImageData for ascent metrics
|
|
19096
|
+
lineYOffset = runtime.enableCSSParsing ? lineHeight - fontProperties.ascent : 0;
|
|
19057
19097
|
} else if (textBaseline === 'bottom' || textBaseline === 'ideographic') {
|
|
19058
19098
|
lineYOffset = 0;
|
|
19059
19099
|
}
|
|
@@ -20998,6 +21038,9 @@
|
|
|
20998
21038
|
render = false;
|
|
20999
21039
|
}
|
|
21000
21040
|
var geometry = element.geometry;
|
|
21041
|
+
if (geometry.dirty) {
|
|
21042
|
+
runtime.styleValueRegistry.updateGeometry(element);
|
|
21043
|
+
}
|
|
21001
21044
|
var bounds = render ? geometry.renderBounds : geometry.contentBounds || null;
|
|
21002
21045
|
// return (bounds && new AABB(bounds.center, bounds.halfExtents)) || new AABB();
|
|
21003
21046
|
return bounds || new AABB();
|
|
@@ -21315,12 +21358,19 @@
|
|
|
21315
21358
|
_parsedStyle$leading = parsedStyle.leading,
|
|
21316
21359
|
leading = _parsedStyle$leading === void 0 ? 0 : _parsedStyle$leading;
|
|
21317
21360
|
var font = toFontString(parsedStyle);
|
|
21318
|
-
var fontProperties
|
|
21319
|
-
|
|
21320
|
-
|
|
21321
|
-
|
|
21322
|
-
|
|
21323
|
-
fontProperties.
|
|
21361
|
+
var fontProperties;
|
|
21362
|
+
if (runtime.enableCSSParsing) {
|
|
21363
|
+
fontProperties = this.measureFont(font, offscreenCanvas);
|
|
21364
|
+
// fallback in case UA disallow canvas data extraction
|
|
21365
|
+
// (toDataURI, getImageData functions)
|
|
21366
|
+
if (fontProperties.fontSize === 0) {
|
|
21367
|
+
fontProperties.fontSize = fontSize;
|
|
21368
|
+
fontProperties.ascent = fontSize;
|
|
21369
|
+
}
|
|
21370
|
+
} else {
|
|
21371
|
+
fontProperties = {
|
|
21372
|
+
fontSize: fontSize
|
|
21373
|
+
};
|
|
21324
21374
|
}
|
|
21325
21375
|
var context = this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);
|
|
21326
21376
|
context.font = font;
|
|
@@ -22101,6 +22151,7 @@
|
|
|
22101
22151
|
}
|
|
22102
22152
|
var _proto = PrepareRendererPlugin.prototype;
|
|
22103
22153
|
// private isFirstTimeRendering = true;
|
|
22154
|
+
// private syncing = false;
|
|
22104
22155
|
_proto.apply = function apply(context) {
|
|
22105
22156
|
var _this = this;
|
|
22106
22157
|
var renderingService = context.renderingService,
|
|
@@ -22175,17 +22226,24 @@
|
|
|
22175
22226
|
});
|
|
22176
22227
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
22177
22228
|
// if (this.isFirstTimeRendering) {
|
|
22178
|
-
// // @see https://github.com/antvis/G/issues/1117
|
|
22179
|
-
// setTimeout(() => this.syncRTree());
|
|
22180
22229
|
// this.isFirstTimeRendering = false;
|
|
22230
|
+
// this.syncing = true;
|
|
22231
|
+
// // @see https://github.com/antvis/G/issues/1117
|
|
22232
|
+
// setTimeout(() => {
|
|
22233
|
+
// this.syncRTree();
|
|
22234
|
+
// console.log('fcp...');
|
|
22235
|
+
// });
|
|
22181
22236
|
// } else {
|
|
22182
|
-
//
|
|
22183
|
-
// }
|
|
22237
|
+
// console.log('next...');
|
|
22184
22238
|
_this.syncRTree();
|
|
22239
|
+
// }
|
|
22185
22240
|
});
|
|
22186
22241
|
};
|
|
22187
22242
|
_proto.syncRTree = function syncRTree() {
|
|
22188
22243
|
var _this2 = this;
|
|
22244
|
+
// if (this.syncing) {
|
|
22245
|
+
// return;
|
|
22246
|
+
// }
|
|
22189
22247
|
// bounds changed, need re-inserting its children
|
|
22190
22248
|
var bulk = [];
|
|
22191
22249
|
Array.from(this.toSync)
|
|
@@ -22228,6 +22286,7 @@
|
|
|
22228
22286
|
this.rBush.load(bulk);
|
|
22229
22287
|
bulk.length = 0;
|
|
22230
22288
|
this.toSync.clear();
|
|
22289
|
+
// this.syncing = false;
|
|
22231
22290
|
};
|
|
22232
22291
|
return PrepareRendererPlugin;
|
|
22233
22292
|
}();
|