@antv/g-lite 1.3.0-next.8 → 2.0.0
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/Canvas.d.ts +2 -1
- package/dist/css/StyleValueRegistry.d.ts +1 -0
- package/dist/css/cssom/CSSStyleValue.d.ts +1 -1
- package/dist/css/interfaces.d.ts +1 -0
- package/dist/css/parser/dimension.d.ts +1 -1
- package/dist/css/parser/path.d.ts +2 -2
- package/dist/css/parser/points.d.ts +1 -1
- package/dist/css/properties/CSSPropertyOffsetDistance.d.ts +1 -1
- package/dist/css/properties/CSSPropertyPath.d.ts +2 -2
- package/dist/css/properties/CSSPropertyTransformOrigin.d.ts +3 -1
- package/dist/display-objects/Circle.d.ts +1 -1
- package/dist/display-objects/DisplayObject.d.ts +0 -10
- package/dist/display-objects/Ellipse.d.ts +3 -1
- package/dist/display-objects/Group.d.ts +1 -1
- package/dist/display-objects/Image.d.ts +1 -3
- package/dist/display-objects/Path.d.ts +1 -12
- package/dist/display-objects/Polygon.d.ts +2 -0
- package/dist/display-objects/Rect.d.ts +3 -1
- package/dist/global-runtime.d.ts +7 -0
- package/dist/index.esm.js +508 -446
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +506 -443
- 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 +3 -0
- package/dist/services/EventService.d.ts +2 -2
- package/dist/services/aabb/GroupUpdater.d.ts +10 -0
- package/dist/services/aabb/index.d.ts +1 -0
- package/dist/types.d.ts +5 -1
- package/dist/utils/path.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -662,7 +662,7 @@ var AbstractRenderer = /** @class */ (function () {
|
|
|
662
662
|
/**
|
|
663
663
|
* enable dirty rectangle rendering by default
|
|
664
664
|
*/
|
|
665
|
-
enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false }, config);
|
|
665
|
+
enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false, enableSizeAttenuation: true }, config);
|
|
666
666
|
}
|
|
667
667
|
AbstractRenderer.prototype.registerPlugin = function (plugin) {
|
|
668
668
|
var index = this.plugins.findIndex(function (p) { return p === plugin; });
|
|
@@ -3186,7 +3186,7 @@ var getOrCreateUnitValue = function (value, unitOrName) {
|
|
|
3186
3186
|
if (unitOrName === void 0) { unitOrName = exports.UnitType.kNumber; }
|
|
3187
3187
|
return new CSSUnitValue(value, unitOrName);
|
|
3188
3188
|
};
|
|
3189
|
-
|
|
3189
|
+
new CSSUnitValue(50, '%');
|
|
3190
3190
|
|
|
3191
3191
|
/**
|
|
3192
3192
|
* @see https://doc.babylonjs.com/how_to/optimizing_your_scene#changing-mesh-culling-strategy
|
|
@@ -3909,6 +3909,9 @@ var parseColor = memoize(function (colorStr) {
|
|
|
3909
3909
|
// @see https://github.com/adobe-webplatform/Snap.svg/issues/526
|
|
3910
3910
|
colorStr = 'black';
|
|
3911
3911
|
}
|
|
3912
|
+
else if (colorStr === 'none') {
|
|
3913
|
+
return noneColor;
|
|
3914
|
+
}
|
|
3912
3915
|
// support CSS gradient syntax
|
|
3913
3916
|
var g = parseGradient(colorStr);
|
|
3914
3917
|
if (g) {
|
|
@@ -4128,10 +4131,8 @@ function parseDimensionArray(string) {
|
|
|
4128
4131
|
// },
|
|
4129
4132
|
// ];
|
|
4130
4133
|
// }
|
|
4131
|
-
function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
4132
|
-
if (
|
|
4133
|
-
return 0;
|
|
4134
|
-
}
|
|
4134
|
+
function convertPercentUnit(valueWithUnit, vec3Index, target, useMin) {
|
|
4135
|
+
if (useMin === void 0) { useMin = false; }
|
|
4135
4136
|
if (valueWithUnit.unit === exports.UnitType.kPixels) {
|
|
4136
4137
|
return Number(valueWithUnit.value);
|
|
4137
4138
|
}
|
|
@@ -4139,7 +4140,8 @@ function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
|
4139
4140
|
var bounds = target.nodeName === exports.Shape.GROUP
|
|
4140
4141
|
? target.getLocalBounds()
|
|
4141
4142
|
: target.getGeometryBounds();
|
|
4142
|
-
return (
|
|
4143
|
+
return ((useMin ? bounds.min[vec3Index] : 0) +
|
|
4144
|
+
(valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2);
|
|
4143
4145
|
}
|
|
4144
4146
|
return 0;
|
|
4145
4147
|
}
|
|
@@ -4242,10 +4244,16 @@ function mergeNumberLists(left, right) {
|
|
|
4242
4244
|
}
|
|
4243
4245
|
|
|
4244
4246
|
function getOrCalculatePathTotalLength(path) {
|
|
4245
|
-
if (path.parsedStyle.
|
|
4246
|
-
path.parsedStyle.
|
|
4247
|
+
if (path.parsedStyle.d.totalLength === 0) {
|
|
4248
|
+
path.parsedStyle.d.totalLength = util.getTotalLength(path.parsedStyle.d.absolutePath);
|
|
4247
4249
|
}
|
|
4248
|
-
return path.parsedStyle.
|
|
4250
|
+
return path.parsedStyle.d.totalLength;
|
|
4251
|
+
}
|
|
4252
|
+
function getOrCalculatePolylineTotalLength(polyline) {
|
|
4253
|
+
if (polyline.parsedStyle.points.totalLength === 0) {
|
|
4254
|
+
polyline.parsedStyle.points.totalLength = gMath.polylineLength(polyline.parsedStyle.points.points);
|
|
4255
|
+
}
|
|
4256
|
+
return polyline.parsedStyle.points.totalLength;
|
|
4249
4257
|
}
|
|
4250
4258
|
function removeRedundantMCommand(path) {
|
|
4251
4259
|
for (var i = 0; i < path.length; i++) {
|
|
@@ -4955,7 +4963,7 @@ function convertToPath(object, transform) {
|
|
|
4955
4963
|
}));
|
|
4956
4964
|
break;
|
|
4957
4965
|
case exports.Shape.PATH:
|
|
4958
|
-
var absolutePath = object.parsedStyle.
|
|
4966
|
+
var absolutePath = object.parsedStyle.d.absolutePath;
|
|
4959
4967
|
commands = tslib.__spreadArray([], tslib.__read(absolutePath), false);
|
|
4960
4968
|
break;
|
|
4961
4969
|
}
|
|
@@ -5117,27 +5125,10 @@ function parsePoints(pointsOrStr, object) {
|
|
|
5117
5125
|
else {
|
|
5118
5126
|
points = pointsOrStr;
|
|
5119
5127
|
}
|
|
5120
|
-
var segments = [];
|
|
5121
|
-
var tempLength = 0;
|
|
5122
|
-
var segmentT;
|
|
5123
|
-
var segmentL;
|
|
5124
|
-
var totalLength = gMath.polylineLength(points);
|
|
5125
|
-
points.forEach(function (p, i) {
|
|
5126
|
-
if (points[i + 1]) {
|
|
5127
|
-
segmentT = [0, 0];
|
|
5128
|
-
segmentT[0] = tempLength / totalLength;
|
|
5129
|
-
segmentL = gMath.lineLength(p[0], p[1], points[i + 1][0], points[i + 1][1]);
|
|
5130
|
-
tempLength += segmentL;
|
|
5131
|
-
segmentT[1] = tempLength / totalLength;
|
|
5132
|
-
segments.push(segmentT);
|
|
5133
|
-
}
|
|
5134
|
-
});
|
|
5135
|
-
// const minX = Math.min(...points.map((point) => point[0]));
|
|
5136
|
-
// const minY = Math.min(...points.map((point) => point[1]));
|
|
5137
5128
|
return {
|
|
5138
5129
|
points: points,
|
|
5139
|
-
totalLength:
|
|
5140
|
-
segments:
|
|
5130
|
+
totalLength: 0,
|
|
5131
|
+
segments: [],
|
|
5141
5132
|
};
|
|
5142
5133
|
}
|
|
5143
5134
|
function mergePoints(left, right) {
|
|
@@ -5978,7 +5969,7 @@ function convertKeyword2Percent(keyword) {
|
|
|
5978
5969
|
return '50%';
|
|
5979
5970
|
}
|
|
5980
5971
|
else if (keyword === 'left' || keyword === 'top') {
|
|
5981
|
-
return '0';
|
|
5972
|
+
return '0%';
|
|
5982
5973
|
}
|
|
5983
5974
|
else if (keyword === 'right' || keyword === 'bottom') {
|
|
5984
5975
|
return '100%';
|
|
@@ -6246,16 +6237,17 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6246
6237
|
{
|
|
6247
6238
|
n: 'transformOrigin',
|
|
6248
6239
|
p: 100,
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6240
|
+
d: '0 0',
|
|
6241
|
+
// // int: true,
|
|
6242
|
+
// d: (nodeName: string) => {
|
|
6243
|
+
// if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
6244
|
+
// return 'center';
|
|
6245
|
+
// }
|
|
6246
|
+
// if (nodeName === Shape.TEXT) {
|
|
6247
|
+
// return 'text-anchor';
|
|
6248
|
+
// }
|
|
6249
|
+
// return 'left top';
|
|
6250
|
+
// },
|
|
6259
6251
|
l: true,
|
|
6260
6252
|
syntax: exports.PropertySyntax.TRANSFORM_ORIGIN,
|
|
6261
6253
|
},
|
|
@@ -6394,11 +6386,10 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6394
6386
|
},
|
|
6395
6387
|
// Path
|
|
6396
6388
|
{
|
|
6397
|
-
n: '
|
|
6389
|
+
n: 'd',
|
|
6398
6390
|
int: true,
|
|
6399
6391
|
l: true,
|
|
6400
6392
|
d: '',
|
|
6401
|
-
a: ['d'],
|
|
6402
6393
|
syntax: exports.PropertySyntax.PATH,
|
|
6403
6394
|
p: 50,
|
|
6404
6395
|
},
|
|
@@ -6622,16 +6613,16 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6622
6613
|
}; }
|
|
6623
6614
|
if (!this.runtime.enableCSSParsing) {
|
|
6624
6615
|
Object.assign(object.attributes, attributes);
|
|
6625
|
-
var
|
|
6616
|
+
var attributeNames = Object.keys(attributes);
|
|
6626
6617
|
// clipPath
|
|
6627
6618
|
var oldClipPath = object.parsedStyle.clipPath;
|
|
6628
6619
|
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
6629
6620
|
object.parsedStyle = Object.assign(object.parsedStyle, attributes);
|
|
6630
|
-
var
|
|
6631
|
-
if (!
|
|
6621
|
+
var needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
6622
|
+
if (!needUpdateGeometry) {
|
|
6632
6623
|
for (var i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
|
|
6633
6624
|
if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
|
|
6634
|
-
|
|
6625
|
+
needUpdateGeometry = true;
|
|
6635
6626
|
break;
|
|
6636
6627
|
}
|
|
6637
6628
|
}
|
|
@@ -6667,20 +6658,20 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6667
6658
|
}
|
|
6668
6659
|
// Path
|
|
6669
6660
|
// @ts-ignore
|
|
6670
|
-
if (attributes.
|
|
6671
|
-
object.parsedStyle.
|
|
6661
|
+
if (attributes.d === '') {
|
|
6662
|
+
object.parsedStyle.d = tslib.__assign({}, EMPTY_PARSED_PATH);
|
|
6672
6663
|
}
|
|
6673
6664
|
// @ts-ignore
|
|
6674
|
-
if (attributes.
|
|
6675
|
-
object.parsedStyle.
|
|
6665
|
+
if (attributes.d) {
|
|
6666
|
+
object.parsedStyle.d = parsePath(
|
|
6676
6667
|
// @ts-ignore
|
|
6677
|
-
attributes.
|
|
6668
|
+
attributes.d);
|
|
6678
6669
|
}
|
|
6679
6670
|
// Text
|
|
6680
6671
|
if (attributes.textTransform) {
|
|
6681
6672
|
this.runtime.CSSPropertySyntaxFactory['<text-transform>'].calculator(null, null, { value: attributes.textTransform }, object, null);
|
|
6682
6673
|
}
|
|
6683
|
-
if (attributes.clipPath) {
|
|
6674
|
+
if (!util.isUndefined(attributes.clipPath)) {
|
|
6684
6675
|
this.runtime.CSSPropertySyntaxFactory['<defined-path>'].calculator('clipPath', oldClipPath, attributes.clipPath, object, this.runtime);
|
|
6685
6676
|
}
|
|
6686
6677
|
if (attributes.offsetPath) {
|
|
@@ -6718,97 +6709,107 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6718
6709
|
attributes.markerMid, null, null);
|
|
6719
6710
|
}
|
|
6720
6711
|
if (!util.isNil(attributes.zIndex)) {
|
|
6721
|
-
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object,
|
|
6712
|
+
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames);
|
|
6722
6713
|
}
|
|
6723
6714
|
if (!util.isNil(attributes.offsetDistance)) {
|
|
6724
|
-
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object,
|
|
6715
|
+
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames);
|
|
6725
6716
|
}
|
|
6726
6717
|
if (attributes.transform) {
|
|
6727
|
-
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object,
|
|
6718
|
+
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
|
|
6728
6719
|
}
|
|
6729
|
-
if (
|
|
6720
|
+
if (attributes.transformOrigin) {
|
|
6721
|
+
this.runtime.CSSPropertySyntaxFactory['<transform-origin>'].postProcessor(object, attributeNames);
|
|
6722
|
+
}
|
|
6723
|
+
if (needUpdateGeometry) {
|
|
6730
6724
|
object.geometry.dirty = true;
|
|
6731
|
-
|
|
6732
|
-
|
|
6725
|
+
object.renderable.boundsDirty = true;
|
|
6726
|
+
object.renderable.renderBoundsDirty = true;
|
|
6727
|
+
if (!options.forceUpdateGeometry) {
|
|
6728
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6729
|
+
}
|
|
6733
6730
|
}
|
|
6734
|
-
return;
|
|
6735
6731
|
}
|
|
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);
|
|
6732
|
+
else {
|
|
6733
|
+
var skipUpdateAttribute_1 = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize_1 = options.memoize;
|
|
6734
|
+
var needUpdateGeometry_1 = forceUpdateGeometry;
|
|
6735
|
+
var attributeNames_1 = Object.keys(attributes);
|
|
6736
|
+
attributeNames_1.forEach(function (attributeName) {
|
|
6737
|
+
var _a;
|
|
6738
|
+
if (!skipUpdateAttribute_1) {
|
|
6739
|
+
object.attributes[attributeName] = attributes[attributeName];
|
|
6740
|
+
}
|
|
6741
|
+
if (!needUpdateGeometry_1 && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
|
|
6742
|
+
needUpdateGeometry_1 = true;
|
|
6743
|
+
}
|
|
6751
6744
|
});
|
|
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);
|
|
6745
|
+
if (!skipParse) {
|
|
6746
|
+
attributeNames_1.forEach(function (name) {
|
|
6747
|
+
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize_1);
|
|
6748
|
+
});
|
|
6783
6749
|
}
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6750
|
+
// let hasUnresolvedProperties = false;
|
|
6751
|
+
// parse according to priority
|
|
6752
|
+
// path 50
|
|
6753
|
+
// points 50
|
|
6754
|
+
// text 50
|
|
6755
|
+
// textTransform 51
|
|
6756
|
+
// transform 100
|
|
6757
|
+
// transformOrigin 100
|
|
6758
|
+
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
6759
|
+
// uniqueAttributeSet.clear();
|
|
6760
|
+
attributeNames_1 = Array.from(new Set(attributeNames_1.concat(usedAttributes)));
|
|
6761
|
+
}
|
|
6762
|
+
// [
|
|
6763
|
+
// 'path',
|
|
6764
|
+
// 'points',
|
|
6765
|
+
// 'text',
|
|
6766
|
+
// 'textTransform',
|
|
6767
|
+
// 'transform',
|
|
6768
|
+
// 'transformOrigin',
|
|
6769
|
+
// ].forEach((name) => {
|
|
6770
|
+
// const index = attributeNames.indexOf(name);
|
|
6771
|
+
// if (index > -1) {
|
|
6772
|
+
// attributeNames.splice(index, 1);
|
|
6773
|
+
// attributeNames.push(name);
|
|
6774
|
+
// }
|
|
6775
|
+
// });
|
|
6776
|
+
attributeNames_1.forEach(function (name) {
|
|
6777
|
+
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6778
|
+
if (name in object.computedStyle) {
|
|
6779
|
+
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize_1);
|
|
6780
|
+
}
|
|
6781
|
+
});
|
|
6782
|
+
// if (hasUnresolvedProperties) {
|
|
6783
|
+
// this.dirty = true;
|
|
6784
|
+
// return;
|
|
6785
|
+
// }
|
|
6786
|
+
// update geometry
|
|
6787
|
+
if (needUpdateGeometry_1) {
|
|
6788
|
+
object.geometry.dirty = true;
|
|
6789
|
+
object.renderable.boundsDirty = true;
|
|
6790
|
+
object.renderable.renderBoundsDirty = true;
|
|
6791
|
+
if (!options.forceUpdateGeometry) {
|
|
6792
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6793
|
+
}
|
|
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
|
/**
|
|
@@ -7001,11 +7002,15 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7001
7002
|
// depth / 2,
|
|
7002
7003
|
// );
|
|
7003
7004
|
// anchor is center by default, don't account for lineWidth here
|
|
7004
|
-
var _h = parsedStyle, stroke = _h.stroke,
|
|
7005
|
+
var _h = parsedStyle, stroke = _h.stroke, _j = _h.lineWidth, lineWidth = _j === void 0 ? 1 : _j,
|
|
7005
7006
|
// lineCap,
|
|
7006
7007
|
// lineJoin,
|
|
7007
7008
|
// miterLimit,
|
|
7008
|
-
|
|
7009
|
+
_k = _h.increasedLineWidthForHitTesting,
|
|
7010
|
+
// lineCap,
|
|
7011
|
+
// lineJoin,
|
|
7012
|
+
// miterLimit,
|
|
7013
|
+
increasedLineWidthForHitTesting = _k === void 0 ? 0 : _k, _l = _h.shadowType, shadowType = _l === void 0 ? 'outer' : _l, shadowColor = _h.shadowColor, _m = _h.filter, filter = _m === void 0 ? [] : _m, transformOrigin = _h.transformOrigin;
|
|
7009
7014
|
var center = [cx, cy, cz];
|
|
7010
7015
|
// update geometry's AABB
|
|
7011
7016
|
geometry_1.contentBounds.update(center, halfExtents);
|
|
@@ -7039,8 +7044,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7039
7044
|
geometry_1.renderBounds.update(center, halfExtents);
|
|
7040
7045
|
// account for shadow, only support constant value now
|
|
7041
7046
|
if (shadowColor && shadowType && shadowType !== 'inner') {
|
|
7042
|
-
var
|
|
7043
|
-
var
|
|
7047
|
+
var _o = geometry_1.renderBounds, min = _o.min, max = _o.max;
|
|
7048
|
+
var _p = parsedStyle, shadowBlur = _p.shadowBlur, shadowOffsetX = _p.shadowOffsetX, shadowOffsetY = _p.shadowOffsetY;
|
|
7044
7049
|
var shadowBlurInPixels = shadowBlur || 0;
|
|
7045
7050
|
var shadowOffsetXInPixels = shadowOffsetX || 0;
|
|
7046
7051
|
var shadowOffsetYInPixels = shadowOffsetY || 0;
|
|
@@ -7078,23 +7083,47 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7078
7083
|
}
|
|
7079
7084
|
});
|
|
7080
7085
|
object.geometry.dirty = false;
|
|
7081
|
-
// if (nodeName === Shape.RECT) {
|
|
7082
|
-
// account for negative width / height of Rect
|
|
7083
7086
|
// @see https://github.com/antvis/g/issues/957
|
|
7084
7087
|
var flipY = hwidth < 0;
|
|
7085
7088
|
var flipX = hheight < 0;
|
|
7086
|
-
// } else {
|
|
7087
|
-
// }
|
|
7088
7089
|
// set transform origin
|
|
7089
7090
|
var usedOriginXValue = (flipY ? -1 : 1) *
|
|
7090
7091
|
(transformOrigin
|
|
7091
|
-
? convertPercentUnit(transformOrigin[0], 0, object)
|
|
7092
|
+
? convertPercentUnit(transformOrigin[0], 0, object, true)
|
|
7092
7093
|
: 0);
|
|
7093
7094
|
var usedOriginYValue = (flipX ? -1 : 1) *
|
|
7094
7095
|
(transformOrigin
|
|
7095
|
-
? convertPercentUnit(transformOrigin[1], 1, object)
|
|
7096
|
+
? convertPercentUnit(transformOrigin[1], 1, object, true)
|
|
7096
7097
|
: 0);
|
|
7097
|
-
|
|
7098
|
+
if (usedOriginXValue || usedOriginYValue) {
|
|
7099
|
+
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
7100
|
+
}
|
|
7101
|
+
}
|
|
7102
|
+
};
|
|
7103
|
+
DefaultStyleValueRegistry.prototype.updateSizeAttenuation = function (node, zoom) {
|
|
7104
|
+
if (node.style.isSizeAttenuation) {
|
|
7105
|
+
if (!node.style.rawLineWidth) {
|
|
7106
|
+
node.style.rawLineWidth = node.style.lineWidth;
|
|
7107
|
+
}
|
|
7108
|
+
node.style.lineWidth = (node.style.rawLineWidth || 1) / zoom;
|
|
7109
|
+
if (node.nodeName === exports.Shape.CIRCLE) {
|
|
7110
|
+
if (!node.style.rawR) {
|
|
7111
|
+
node.style.rawR = node.style.r;
|
|
7112
|
+
}
|
|
7113
|
+
node.style.r = (node.style.rawR || 1) / zoom;
|
|
7114
|
+
}
|
|
7115
|
+
}
|
|
7116
|
+
else {
|
|
7117
|
+
if (node.style.rawLineWidth) {
|
|
7118
|
+
node.style.lineWidth = node.style.rawLineWidth;
|
|
7119
|
+
delete node.style.rawLineWidth;
|
|
7120
|
+
}
|
|
7121
|
+
if (node.nodeName === exports.Shape.CIRCLE) {
|
|
7122
|
+
if (node.style.rawR) {
|
|
7123
|
+
node.style.r = node.style.rawR;
|
|
7124
|
+
delete node.style.rawR;
|
|
7125
|
+
}
|
|
7126
|
+
}
|
|
7098
7127
|
}
|
|
7099
7128
|
};
|
|
7100
7129
|
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
@@ -7520,8 +7549,8 @@ function sortedIndex(array, value) {
|
|
|
7520
7549
|
return low;
|
|
7521
7550
|
}
|
|
7522
7551
|
function sortByZIndex(o1, o2) {
|
|
7523
|
-
var zIndex1 = Number(o1.parsedStyle.zIndex);
|
|
7524
|
-
var zIndex2 = Number(o2.parsedStyle.zIndex);
|
|
7552
|
+
var zIndex1 = Number(o1.parsedStyle.zIndex || 0);
|
|
7553
|
+
var zIndex2 = Number(o2.parsedStyle.zIndex || 0);
|
|
7525
7554
|
if (zIndex1 === zIndex2) {
|
|
7526
7555
|
var parent_1 = o1.parentNode;
|
|
7527
7556
|
if (parent_1) {
|
|
@@ -7585,6 +7614,7 @@ var clock = typeof performance === 'object' && performance.now ? performance : D
|
|
|
7585
7614
|
function isFillOrStrokeAffected(pointerEvents, fill, stroke) {
|
|
7586
7615
|
// account for pointerEvents
|
|
7587
7616
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
7617
|
+
if (pointerEvents === void 0) { pointerEvents = 'auto'; }
|
|
7588
7618
|
var hasFill = false;
|
|
7589
7619
|
var hasStroke = false;
|
|
7590
7620
|
var isFillOtherThanNone = !!fill && !fill.isNone;
|
|
@@ -7811,7 +7841,7 @@ var genericFontFamilies = [
|
|
|
7811
7841
|
];
|
|
7812
7842
|
var stringRegExp = /([\"\'])[^\'\"]+\1/;
|
|
7813
7843
|
function toFontString(attributes) {
|
|
7814
|
-
var
|
|
7844
|
+
var _a = attributes.fontSize, fontSize = _a === void 0 ? 16 : _a, _b = attributes.fontFamily, fontFamily = _b === void 0 ? 'sans-serif' : _b, _c = attributes.fontStyle, fontStyle = _c === void 0 ? 'normal' : _c, _d = attributes.fontVariant, fontVariant = _d === void 0 ? 'normal' : _d, _e = attributes.fontWeight, fontWeight = _e === void 0 ? 'normal' : _e;
|
|
7815
7845
|
// build canvas api font setting from individual components. Convert a numeric this.fontSize to px
|
|
7816
7846
|
// const fontSizeString: string = isNumber(fontSize) ? `${fontSize}px` : fontSize.toString();
|
|
7817
7847
|
var fontSizeString = (util.isNumber(fontSize) && "".concat(fontSize, "px")) || '16px';
|
|
@@ -7839,6 +7869,7 @@ function createSkewMatrix(skewMatrix, skewX, skewY) {
|
|
|
7839
7869
|
skewMatrix[1] = Math.tan(skewY); // Skew X axis in Y direction
|
|
7840
7870
|
return skewMatrix;
|
|
7841
7871
|
}
|
|
7872
|
+
var SCALE_EPSILON = 0.00001;
|
|
7842
7873
|
var tmpMat1 = glMatrix.mat4.create();
|
|
7843
7874
|
var tmpMat2 = glMatrix.mat4.create();
|
|
7844
7875
|
function parsedTransformToMat4(transform, object) {
|
|
@@ -7848,23 +7879,27 @@ function parsedTransformToMat4(transform, object) {
|
|
|
7848
7879
|
var t = parsed.t, d = parsed.d;
|
|
7849
7880
|
if (t === 'scale') {
|
|
7850
7881
|
// scale(1) scale(1, 1)
|
|
7851
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [
|
|
7882
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [
|
|
7883
|
+
1, 1,
|
|
7884
|
+
];
|
|
7852
7885
|
glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], 1]);
|
|
7853
7886
|
}
|
|
7854
7887
|
else if (t === 'scalex') {
|
|
7855
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7888
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
|
|
7856
7889
|
glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], 1, 1]);
|
|
7857
7890
|
}
|
|
7858
7891
|
else if (t === 'scaley') {
|
|
7859
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7892
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
|
|
7860
7893
|
glMatrix.mat4.fromScaling(tmpMat2, [1, newScale[0], 1]);
|
|
7861
7894
|
}
|
|
7862
7895
|
else if (t === 'scalez') {
|
|
7863
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7896
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
|
|
7864
7897
|
glMatrix.mat4.fromScaling(tmpMat2, [1, 1, newScale[0]]);
|
|
7865
7898
|
}
|
|
7866
7899
|
else if (t === 'scale3d') {
|
|
7867
|
-
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [
|
|
7900
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [
|
|
7901
|
+
1, 1, 1,
|
|
7902
|
+
];
|
|
7868
7903
|
glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], newScale[2]]);
|
|
7869
7904
|
}
|
|
7870
7905
|
else if (t === 'translate') {
|
|
@@ -7943,6 +7978,9 @@ function parsedTransformToMat4(transform, object) {
|
|
|
7943
7978
|
});
|
|
7944
7979
|
object.setLocalTransform(m_1);
|
|
7945
7980
|
}
|
|
7981
|
+
else {
|
|
7982
|
+
object.resetLocalTransform();
|
|
7983
|
+
}
|
|
7946
7984
|
return object.getLocalTransform();
|
|
7947
7985
|
}
|
|
7948
7986
|
|
|
@@ -8006,17 +8044,18 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
|
8006
8044
|
function CSSPropertyTransformOrigin() {
|
|
8007
8045
|
this.parser = parseTransformOrigin;
|
|
8008
8046
|
this.parserUnmemoize = parseTransformOriginUnmemoize;
|
|
8009
|
-
// calculator(
|
|
8010
|
-
// name: string,
|
|
8011
|
-
// oldParsed: [CSSUnitValue, CSSUnitValue],
|
|
8012
|
-
// parsed: [CSSUnitValue, CSSUnitValue],
|
|
8013
|
-
// object: DisplayObject,
|
|
8014
|
-
// ): [number, number] {
|
|
8015
|
-
// console.log(object, parsed);
|
|
8016
|
-
// return [parsed[0].value, parsed[1].value];
|
|
8017
|
-
// // return [convertPercentUnit(parsed[0], 0, object), convertPercentUnit(parsed[1], 1, object)];
|
|
8018
|
-
// }
|
|
8019
8047
|
}
|
|
8048
|
+
CSSPropertyTransformOrigin.prototype.postProcessor = function (object) {
|
|
8049
|
+
var transformOrigin = object.parsedStyle.transformOrigin;
|
|
8050
|
+
if (transformOrigin[0].unit === exports.UnitType.kPixels &&
|
|
8051
|
+
transformOrigin[1].unit === exports.UnitType.kPixels) {
|
|
8052
|
+
object.setOrigin(transformOrigin[0].value, transformOrigin[1].value);
|
|
8053
|
+
}
|
|
8054
|
+
else {
|
|
8055
|
+
// Relative to geometry bounds, calculate later.
|
|
8056
|
+
object.getGeometryBounds();
|
|
8057
|
+
}
|
|
8058
|
+
};
|
|
8020
8059
|
return CSSPropertyTransformOrigin;
|
|
8021
8060
|
}());
|
|
8022
8061
|
|
|
@@ -8103,8 +8142,8 @@ var PathUpdater = /** @class */ (function () {
|
|
|
8103
8142
|
function PathUpdater() {
|
|
8104
8143
|
}
|
|
8105
8144
|
PathUpdater.prototype.update = function (parsedStyle) {
|
|
8106
|
-
var
|
|
8107
|
-
var _a =
|
|
8145
|
+
var d = parsedStyle.d;
|
|
8146
|
+
var _a = d.rect, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
8108
8147
|
var hwidth = width / 2;
|
|
8109
8148
|
var hheight = height / 2;
|
|
8110
8149
|
return {
|
|
@@ -8153,17 +8192,17 @@ var RectUpdater = /** @class */ (function () {
|
|
|
8153
8192
|
function RectUpdater() {
|
|
8154
8193
|
}
|
|
8155
8194
|
RectUpdater.prototype.update = function (parsedStyle, object) {
|
|
8156
|
-
var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b,
|
|
8195
|
+
var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b, src = parsedStyle.src, _c = parsedStyle.width, width = _c === void 0 ? 0 : _c, _d = parsedStyle.height, height = _d === void 0 ? 0 : _d;
|
|
8157
8196
|
var contentWidth = width;
|
|
8158
8197
|
var contentHeight = height;
|
|
8159
8198
|
// resize with HTMLImageElement's size
|
|
8160
|
-
if (
|
|
8199
|
+
if (src && !util.isString(src)) {
|
|
8161
8200
|
if (!contentWidth) {
|
|
8162
|
-
contentWidth =
|
|
8201
|
+
contentWidth = src.width;
|
|
8163
8202
|
parsedStyle.width = contentWidth;
|
|
8164
8203
|
}
|
|
8165
8204
|
if (!contentHeight) {
|
|
8166
|
-
contentHeight =
|
|
8205
|
+
contentHeight = src.height;
|
|
8167
8206
|
parsedStyle.height = contentHeight;
|
|
8168
8207
|
}
|
|
8169
8208
|
}
|
|
@@ -8183,18 +8222,20 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8183
8222
|
}
|
|
8184
8223
|
TextUpdater.prototype.isReadyToMeasure = function (parsedStyle, object) {
|
|
8185
8224
|
var text = parsedStyle.text, textAlign = parsedStyle.textAlign, textBaseline = parsedStyle.textBaseline, fontSize = parsedStyle.fontSize, fontStyle = parsedStyle.fontStyle, fontWeight = parsedStyle.fontWeight, fontVariant = parsedStyle.fontVariant, lineWidth = parsedStyle.lineWidth;
|
|
8186
|
-
return
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8225
|
+
return runtime.enableCSSParsing
|
|
8226
|
+
? text &&
|
|
8227
|
+
fontSize &&
|
|
8228
|
+
fontStyle &&
|
|
8229
|
+
fontWeight &&
|
|
8230
|
+
fontVariant &&
|
|
8231
|
+
textAlign &&
|
|
8232
|
+
textBaseline &&
|
|
8233
|
+
!util.isNil(lineWidth)
|
|
8234
|
+
: text;
|
|
8194
8235
|
};
|
|
8195
8236
|
TextUpdater.prototype.update = function (parsedStyle, object) {
|
|
8196
8237
|
var _a, _b;
|
|
8197
|
-
var text = parsedStyle.text,
|
|
8238
|
+
var text = parsedStyle.text, _c = parsedStyle.textAlign, textAlign = _c === void 0 ? 'start' : _c, _d = parsedStyle.lineWidth, lineWidth = _d === void 0 ? 1 : _d, _e = parsedStyle.textBaseline, textBaseline = _e === void 0 ? 'alphabetic' : _e, _f = parsedStyle.dx, dx = _f === void 0 ? 0 : _f, _g = parsedStyle.dy, dy = _g === void 0 ? 0 : _g, _h = parsedStyle.x, x = _h === void 0 ? 0 : _h, _j = parsedStyle.y, y = _j === void 0 ? 0 : _j;
|
|
8198
8239
|
if (!this.isReadyToMeasure(parsedStyle, object)) {
|
|
8199
8240
|
parsedStyle.metrics = {
|
|
8200
8241
|
font: '',
|
|
@@ -8266,6 +8307,20 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8266
8307
|
return TextUpdater;
|
|
8267
8308
|
}());
|
|
8268
8309
|
|
|
8310
|
+
var GroupUpdater = /** @class */ (function () {
|
|
8311
|
+
function GroupUpdater() {
|
|
8312
|
+
}
|
|
8313
|
+
GroupUpdater.prototype.update = function (parsedStyle, object) {
|
|
8314
|
+
return {
|
|
8315
|
+
cx: 0,
|
|
8316
|
+
cy: 0,
|
|
8317
|
+
hwidth: 0,
|
|
8318
|
+
hheight: 0,
|
|
8319
|
+
};
|
|
8320
|
+
};
|
|
8321
|
+
return GroupUpdater;
|
|
8322
|
+
}());
|
|
8323
|
+
|
|
8269
8324
|
function isFederatedEvent(value) {
|
|
8270
8325
|
return !!value.type;
|
|
8271
8326
|
}
|
|
@@ -9603,10 +9658,13 @@ var EventService = /** @class */ (function () {
|
|
|
9603
9658
|
* whether the native event trigger came from Canvas,
|
|
9604
9659
|
* should account for HTML shape
|
|
9605
9660
|
*/
|
|
9606
|
-
EventService.prototype.isNativeEventFromCanvas = function (
|
|
9607
|
-
var
|
|
9608
|
-
|
|
9609
|
-
|
|
9661
|
+
EventService.prototype.isNativeEventFromCanvas = function ($el, nativeEvent) {
|
|
9662
|
+
var target = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.target;
|
|
9663
|
+
// Get event target inside a web component.
|
|
9664
|
+
// @see https://stackoverflow.com/questions/57963312/get-event-target-inside-a-web-component
|
|
9665
|
+
if (target === null || target === void 0 ? void 0 : target.shadowRoot) {
|
|
9666
|
+
target = nativeEvent.composedPath()[0];
|
|
9667
|
+
}
|
|
9610
9668
|
if (target) {
|
|
9611
9669
|
// from <canvas>
|
|
9612
9670
|
if (target === $el) {
|
|
@@ -9617,8 +9675,8 @@ var EventService = /** @class */ (function () {
|
|
|
9617
9675
|
return $el.contains(target);
|
|
9618
9676
|
}
|
|
9619
9677
|
}
|
|
9620
|
-
if (
|
|
9621
|
-
return
|
|
9678
|
+
if (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.composedPath) {
|
|
9679
|
+
return nativeEvent.composedPath().indexOf($el) > -1;
|
|
9622
9680
|
}
|
|
9623
9681
|
// account for Touch
|
|
9624
9682
|
return false;
|
|
@@ -9666,9 +9724,11 @@ var EventService = /** @class */ (function () {
|
|
|
9666
9724
|
event.nativeEvent = from.nativeEvent;
|
|
9667
9725
|
event.originalEvent = from;
|
|
9668
9726
|
var existedHTML = this.getExistedHTML(event);
|
|
9727
|
+
var $el = this.context.contextService.getDomElement();
|
|
9669
9728
|
event.target =
|
|
9670
9729
|
target !== null && target !== void 0 ? target : (existedHTML ||
|
|
9671
|
-
(this.isNativeEventFromCanvas(event) &&
|
|
9730
|
+
(this.isNativeEventFromCanvas($el, event.nativeEvent) &&
|
|
9731
|
+
this.pickTarget(event)) ||
|
|
9672
9732
|
fallbackTarget);
|
|
9673
9733
|
if (typeof type === 'string') {
|
|
9674
9734
|
event.type = type;
|
|
@@ -9683,9 +9743,11 @@ var EventService = /** @class */ (function () {
|
|
|
9683
9743
|
event.nativeEvent = from.nativeEvent;
|
|
9684
9744
|
event.originalEvent = from;
|
|
9685
9745
|
var existedHTML = this.getExistedHTML(event);
|
|
9746
|
+
var $el = this.context.contextService.getDomElement();
|
|
9686
9747
|
event.target =
|
|
9687
9748
|
existedHTML ||
|
|
9688
|
-
(this.isNativeEventFromCanvas(event) &&
|
|
9749
|
+
(this.isNativeEventFromCanvas($el, event.nativeEvent) &&
|
|
9750
|
+
this.pickTarget(event));
|
|
9689
9751
|
return event;
|
|
9690
9752
|
};
|
|
9691
9753
|
EventService.prototype.trackingData = function (id) {
|
|
@@ -10685,6 +10747,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10685
10747
|
}
|
|
10686
10748
|
};
|
|
10687
10749
|
DefaultSceneGraphService.prototype.getOrigin = function (element) {
|
|
10750
|
+
element.getGeometryBounds();
|
|
10688
10751
|
return element.transformable.origin;
|
|
10689
10752
|
};
|
|
10690
10753
|
/**
|
|
@@ -10994,6 +11057,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10994
11057
|
}
|
|
10995
11058
|
}
|
|
10996
11059
|
});
|
|
11060
|
+
if (!aabb) {
|
|
11061
|
+
aabb = new AABB();
|
|
11062
|
+
}
|
|
10997
11063
|
if (render) {
|
|
10998
11064
|
// FIXME: account for clip path
|
|
10999
11065
|
var clipped = findClosestClipPathTarget(element);
|
|
@@ -11001,28 +11067,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
11001
11067
|
// use bounds under world space
|
|
11002
11068
|
var clipPathBounds = clipped.parsedStyle.clipPath.getBounds(render);
|
|
11003
11069
|
if (!aabb) {
|
|
11004
|
-
aabb
|
|
11070
|
+
aabb.update(clipPathBounds.center, clipPathBounds.halfExtents);
|
|
11005
11071
|
}
|
|
11006
11072
|
else if (clipPathBounds) {
|
|
11007
11073
|
aabb = clipPathBounds.intersection(aabb);
|
|
11008
11074
|
}
|
|
11009
11075
|
}
|
|
11010
11076
|
}
|
|
11011
|
-
if (!aabb) {
|
|
11012
|
-
aabb = new AABB();
|
|
11013
|
-
}
|
|
11014
|
-
if (aabb) {
|
|
11015
|
-
if (render) {
|
|
11016
|
-
renderable.renderBounds = aabb;
|
|
11017
|
-
}
|
|
11018
|
-
else {
|
|
11019
|
-
renderable.bounds = aabb;
|
|
11020
|
-
}
|
|
11021
|
-
}
|
|
11022
11077
|
if (render) {
|
|
11078
|
+
renderable.renderBounds = aabb;
|
|
11023
11079
|
renderable.renderBoundsDirty = false;
|
|
11024
11080
|
}
|
|
11025
11081
|
else {
|
|
11082
|
+
renderable.bounds = aabb;
|
|
11026
11083
|
renderable.boundsDirty = false;
|
|
11027
11084
|
}
|
|
11028
11085
|
return aabb;
|
|
@@ -11279,13 +11336,13 @@ var TextService = /** @class */ (function () {
|
|
|
11279
11336
|
return properties;
|
|
11280
11337
|
};
|
|
11281
11338
|
TextService.prototype.measureText = function (text, parsedStyle, offscreenCanvas) {
|
|
11282
|
-
var
|
|
11339
|
+
var _a = parsedStyle.fontSize, fontSize = _a === void 0 ? 16 : _a, _b = parsedStyle.wordWrap, wordWrap = _b === void 0 ? false : _b, strokeHeight = parsedStyle.lineHeight, _c = parsedStyle.lineWidth, lineWidth = _c === void 0 ? 1 : _c, _d = parsedStyle.textBaseline, textBaseline = _d === void 0 ? 'alphabetic' : _d, _e = parsedStyle.textAlign, textAlign = _e === void 0 ? 'start' : _e, _f = parsedStyle.letterSpacing, letterSpacing = _f === void 0 ? 0 : _f, textPath = parsedStyle.textPath; parsedStyle.textPathSide; parsedStyle.textPathStartOffset;
|
|
11283
11340
|
var // dropShadow = 0,
|
|
11284
11341
|
// dropShadowDistance = 0,
|
|
11285
|
-
|
|
11342
|
+
_g = parsedStyle.leading,
|
|
11286
11343
|
// dropShadow = 0,
|
|
11287
11344
|
// dropShadowDistance = 0,
|
|
11288
|
-
leading =
|
|
11345
|
+
leading = _g === void 0 ? 0 : _g;
|
|
11289
11346
|
var font = toFontString(parsedStyle);
|
|
11290
11347
|
// if (runtime.enableCSSParsing) {
|
|
11291
11348
|
var fontProperties = this.measureFont(font, offscreenCanvas);
|
|
@@ -11397,7 +11454,7 @@ var TextService = /** @class */ (function () {
|
|
|
11397
11454
|
TextService.prototype.setGraphemeOnPath = function () { };
|
|
11398
11455
|
TextService.prototype.wordWrap = function (text, parsedStyle, offscreenCanvas) {
|
|
11399
11456
|
var _this = this;
|
|
11400
|
-
var _a = parsedStyle.wordWrapWidth, wordWrapWidth = _a === void 0 ? 0 : _a,
|
|
11457
|
+
var _a = parsedStyle.wordWrapWidth, wordWrapWidth = _a === void 0 ? 0 : _a, _b = parsedStyle.letterSpacing, letterSpacing = _b === void 0 ? 0 : _b, _c = parsedStyle.maxLines, maxLines = _c === void 0 ? Infinity : _c, textOverflow = parsedStyle.textOverflow;
|
|
11401
11458
|
var context = this.runtime.offscreenCanvasCreator.getOrCreateContext(offscreenCanvas);
|
|
11402
11459
|
var maxWidth = wordWrapWidth + letterSpacing;
|
|
11403
11460
|
var ellipsis = '';
|
|
@@ -11547,7 +11604,7 @@ var geometryUpdaterFactory = (function () {
|
|
|
11547
11604
|
_a[exports.Shape.ELLIPSE] = new EllipseUpdater(),
|
|
11548
11605
|
_a[exports.Shape.RECT] = rectUpdater,
|
|
11549
11606
|
_a[exports.Shape.IMAGE] = rectUpdater,
|
|
11550
|
-
_a[exports.Shape.GROUP] =
|
|
11607
|
+
_a[exports.Shape.GROUP] = new GroupUpdater(),
|
|
11551
11608
|
_a[exports.Shape.LINE] = new LineUpdater(),
|
|
11552
11609
|
_a[exports.Shape.TEXT] = new TextUpdater(runtime),
|
|
11553
11610
|
_a[exports.Shape.POLYLINE] = polylineUpdater,
|
|
@@ -11621,9 +11678,11 @@ runtime.CSSPropertySyntaxFactory = CSSPropertySyntaxFactory;
|
|
|
11621
11678
|
runtime.styleValueRegistry = new DefaultStyleValueRegistry(runtime);
|
|
11622
11679
|
runtime.layoutRegistry = null;
|
|
11623
11680
|
runtime.globalThis = getGlobalThis();
|
|
11624
|
-
runtime.enableCSSParsing =
|
|
11681
|
+
runtime.enableCSSParsing = false;
|
|
11625
11682
|
runtime.enableDataset = false;
|
|
11626
11683
|
runtime.enableStyleSyntax = true;
|
|
11684
|
+
runtime.enableAttributeDashCased = false;
|
|
11685
|
+
runtime.enableSizeAttenuation = false;
|
|
11627
11686
|
|
|
11628
11687
|
var entityCounter = 0;
|
|
11629
11688
|
function resetEntityCounter() {
|
|
@@ -11869,8 +11928,11 @@ var Element = /** @class */ (function (_super) {
|
|
|
11869
11928
|
if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
|
|
11870
11929
|
this.ownerDocument.defaultView.mountChildren(child);
|
|
11871
11930
|
}
|
|
11872
|
-
|
|
11873
|
-
|
|
11931
|
+
// @ts-ignore
|
|
11932
|
+
if (this.isMutationObserved) {
|
|
11933
|
+
insertedEvent.relatedNode = this;
|
|
11934
|
+
child.dispatchEvent(insertedEvent);
|
|
11935
|
+
}
|
|
11874
11936
|
return child;
|
|
11875
11937
|
};
|
|
11876
11938
|
Element.prototype.insertBefore = function (newChild, refChild) {
|
|
@@ -12143,8 +12205,10 @@ var Element = /** @class */ (function (_super) {
|
|
|
12143
12205
|
}
|
|
12144
12206
|
var value = this.attributes[name];
|
|
12145
12207
|
if (value === undefined) {
|
|
12146
|
-
|
|
12147
|
-
|
|
12208
|
+
if (runtime.enableAttributeDashCased) {
|
|
12209
|
+
var attributeName = formatAttributeName(name);
|
|
12210
|
+
value = this.attributes[attributeName];
|
|
12211
|
+
}
|
|
12148
12212
|
// if the given attribute does not exist, the value returned will either be null or ""
|
|
12149
12213
|
return runtime.enableCSSParsing ? (util.isNil(value) ? null : value) : value;
|
|
12150
12214
|
}
|
|
@@ -12214,6 +12278,9 @@ var Element = /** @class */ (function (_super) {
|
|
|
12214
12278
|
function isDisplayObject(value) {
|
|
12215
12279
|
return !!(value === null || value === void 0 ? void 0 : value.nodeName);
|
|
12216
12280
|
}
|
|
12281
|
+
var Proxy = runtime.globalThis.Proxy
|
|
12282
|
+
? runtime.globalThis.Proxy
|
|
12283
|
+
: function () { };
|
|
12217
12284
|
var mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
|
|
12218
12285
|
var DEFAULT_STYLE_PROPS = {
|
|
12219
12286
|
opacity: '',
|
|
@@ -12250,7 +12317,20 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
12250
12317
|
shadowType: 'outer',
|
|
12251
12318
|
miterLimit: 10,
|
|
12252
12319
|
};
|
|
12253
|
-
|
|
12320
|
+
// const DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = {
|
|
12321
|
+
// ...DEFAULT_PARSED_STYLE_PROPS,
|
|
12322
|
+
// opacity: 1,
|
|
12323
|
+
// fillOpacity: 1,
|
|
12324
|
+
// strokeOpacity: 1,
|
|
12325
|
+
// visibility: 'visible',
|
|
12326
|
+
// pointerEvents: 'auto',
|
|
12327
|
+
// lineWidth: 1,
|
|
12328
|
+
// lineCap: 'butt',
|
|
12329
|
+
// lineJoin: 'miter',
|
|
12330
|
+
// increasedLineWidthForHitTesting: 0,
|
|
12331
|
+
// fillRule: 'nonzero',
|
|
12332
|
+
// // TODO: transformOrigin
|
|
12333
|
+
// };
|
|
12254
12334
|
var INHERITABLE_BASE_STYLE_PROPS = [
|
|
12255
12335
|
'opacity',
|
|
12256
12336
|
'fillOpacity',
|
|
@@ -12302,13 +12382,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12302
12382
|
* push to active animations after calling `animate()`
|
|
12303
12383
|
*/
|
|
12304
12384
|
_this.activeAnimations = [];
|
|
12305
|
-
/**
|
|
12306
|
-
* Use `this.style.clipPath` instead.
|
|
12307
|
-
* @deprecated
|
|
12308
|
-
*/
|
|
12309
|
-
_this.getClip = function () {
|
|
12310
|
-
return this.style.clipPath || null;
|
|
12311
|
-
};
|
|
12312
12385
|
// assign name, id to config
|
|
12313
12386
|
// eg. group.get('name')
|
|
12314
12387
|
_this.config = config;
|
|
@@ -12319,18 +12392,17 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12319
12392
|
_this.className = _this.config.className || _this.config.class;
|
|
12320
12393
|
}
|
|
12321
12394
|
_this.nodeName = _this.config.type || exports.Shape.GROUP;
|
|
12322
|
-
// merge parsed value
|
|
12323
|
-
Object.assign(_this.parsedStyle, runtime.enableCSSParsing
|
|
12324
|
-
? DEFAULT_PARSED_STYLE_PROPS
|
|
12325
|
-
: DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED, _this.config.initialParsedStyle);
|
|
12326
12395
|
if (runtime.enableCSSParsing) {
|
|
12327
12396
|
Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
|
|
12397
|
+
Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
|
|
12398
|
+
}
|
|
12399
|
+
else if (_this.config.initialParsedStyle) {
|
|
12400
|
+
Object.assign(_this.parsedStyle,
|
|
12401
|
+
// DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED,
|
|
12402
|
+
_this.config.initialParsedStyle);
|
|
12328
12403
|
}
|
|
12329
12404
|
// start to process attributes
|
|
12330
12405
|
_this.initAttributes(_this.config.style);
|
|
12331
|
-
var Proxy = runtime.globalThis.Proxy
|
|
12332
|
-
? runtime.globalThis.Proxy
|
|
12333
|
-
: function () { };
|
|
12334
12406
|
if (runtime.enableDataset) {
|
|
12335
12407
|
_this.dataset = new Proxy({}, {
|
|
12336
12408
|
get: function (target, name) {
|
|
@@ -12448,10 +12520,14 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12448
12520
|
options.usedAttributes = INHERITABLE_STYLE_PROPS;
|
|
12449
12521
|
}
|
|
12450
12522
|
// account for FCP, process properties as less as possible
|
|
12451
|
-
var formattedAttributes =
|
|
12452
|
-
|
|
12453
|
-
|
|
12454
|
-
formattedAttributes
|
|
12523
|
+
var formattedAttributes = attributes;
|
|
12524
|
+
if (runtime.enableAttributeDashCased) {
|
|
12525
|
+
// @ts-ignore
|
|
12526
|
+
formattedAttributes = {};
|
|
12527
|
+
for (var name_1 in attributes) {
|
|
12528
|
+
var attributeName = formatAttributeName(name_1);
|
|
12529
|
+
formattedAttributes[attributeName] = attributes[name_1];
|
|
12530
|
+
}
|
|
12455
12531
|
}
|
|
12456
12532
|
runtime.styleValueRegistry.processProperties(this, formattedAttributes, options);
|
|
12457
12533
|
// redraw at next frame
|
|
@@ -12460,14 +12536,16 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12460
12536
|
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12461
12537
|
if (force === void 0) { force = false; }
|
|
12462
12538
|
if (memoize === void 0) { memoize = true; }
|
|
12463
|
-
|
|
12539
|
+
if (runtime.enableAttributeDashCased) {
|
|
12540
|
+
name = formatAttributeName(name);
|
|
12541
|
+
}
|
|
12464
12542
|
// ignore undefined value
|
|
12465
12543
|
if (util.isUndefined(value)) {
|
|
12466
12544
|
return;
|
|
12467
12545
|
}
|
|
12468
|
-
if (force || value !== this.attributes[
|
|
12469
|
-
this.internalSetAttribute(
|
|
12470
|
-
_super.prototype.setAttribute.call(this,
|
|
12546
|
+
if (force || value !== this.attributes[name]) {
|
|
12547
|
+
this.internalSetAttribute(name, value, { memoize: memoize });
|
|
12548
|
+
_super.prototype.setAttribute.call(this, name, value);
|
|
12471
12549
|
}
|
|
12472
12550
|
};
|
|
12473
12551
|
/**
|
|
@@ -12721,8 +12799,10 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12721
12799
|
* shortcut for Used value of `visibility`
|
|
12722
12800
|
*/
|
|
12723
12801
|
DisplayObject.prototype.isVisible = function () {
|
|
12724
|
-
var _a;
|
|
12725
|
-
return
|
|
12802
|
+
var _a, _b;
|
|
12803
|
+
return runtime.enableCSSParsing
|
|
12804
|
+
? ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible'
|
|
12805
|
+
: ((_b = this.parsedStyle) === null || _b === void 0 ? void 0 : _b.visibility) !== 'hidden';
|
|
12726
12806
|
};
|
|
12727
12807
|
Object.defineProperty(DisplayObject.prototype, "interactive", {
|
|
12728
12808
|
get: function () {
|
|
@@ -12914,13 +12994,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12914
12994
|
DisplayObject.prototype.add = function (child, index) {
|
|
12915
12995
|
return this.appendChild(child, index);
|
|
12916
12996
|
};
|
|
12917
|
-
/**
|
|
12918
|
-
* Use `this.style.clipPath` instead.
|
|
12919
|
-
* @deprecated
|
|
12920
|
-
*/
|
|
12921
|
-
DisplayObject.prototype.setClip = function (clipPath) {
|
|
12922
|
-
this.style.clipPath = clipPath;
|
|
12923
|
-
};
|
|
12924
12997
|
/**
|
|
12925
12998
|
* @deprecated
|
|
12926
12999
|
*/
|
|
@@ -12965,124 +13038,11 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12965
13038
|
return DisplayObject;
|
|
12966
13039
|
}(Element));
|
|
12967
13040
|
|
|
12968
|
-
/**
|
|
12969
|
-
* holds useful CSS-related methods.
|
|
12970
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
12971
|
-
*
|
|
12972
|
-
* * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
|
|
12973
|
-
* * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
12974
|
-
* * CSS Layout API
|
|
12975
|
-
*/
|
|
12976
|
-
var CSS = {
|
|
12977
|
-
/**
|
|
12978
|
-
* <number>
|
|
12979
|
-
* @see https://drafts.csswg.org/css-values-4/#number-value
|
|
12980
|
-
*/
|
|
12981
|
-
number: function (n) {
|
|
12982
|
-
return new CSSUnitValue(n);
|
|
12983
|
-
},
|
|
12984
|
-
/**
|
|
12985
|
-
* <percentage>
|
|
12986
|
-
* @see https://drafts.csswg.org/css-values-4/#percentage-value
|
|
12987
|
-
*/
|
|
12988
|
-
percent: function (n) {
|
|
12989
|
-
return new CSSUnitValue(n, '%');
|
|
12990
|
-
},
|
|
12991
|
-
/**
|
|
12992
|
-
* <length>
|
|
12993
|
-
*/
|
|
12994
|
-
px: function (n) {
|
|
12995
|
-
return new CSSUnitValue(n, 'px');
|
|
12996
|
-
},
|
|
12997
|
-
/**
|
|
12998
|
-
* <length>
|
|
12999
|
-
*/
|
|
13000
|
-
em: function (n) {
|
|
13001
|
-
return new CSSUnitValue(n, 'em');
|
|
13002
|
-
},
|
|
13003
|
-
rem: function (n) {
|
|
13004
|
-
return new CSSUnitValue(n, 'rem');
|
|
13005
|
-
},
|
|
13006
|
-
/**
|
|
13007
|
-
* <angle>
|
|
13008
|
-
*/
|
|
13009
|
-
deg: function (n) {
|
|
13010
|
-
return new CSSUnitValue(n, 'deg');
|
|
13011
|
-
},
|
|
13012
|
-
/**
|
|
13013
|
-
* <angle>
|
|
13014
|
-
*/
|
|
13015
|
-
grad: function (n) {
|
|
13016
|
-
return new CSSUnitValue(n, 'grad');
|
|
13017
|
-
},
|
|
13018
|
-
/**
|
|
13019
|
-
* <angle>
|
|
13020
|
-
*/
|
|
13021
|
-
rad: function (n) {
|
|
13022
|
-
return new CSSUnitValue(n, 'rad');
|
|
13023
|
-
},
|
|
13024
|
-
/**
|
|
13025
|
-
* <angle>
|
|
13026
|
-
*/
|
|
13027
|
-
turn: function (n) {
|
|
13028
|
-
return new CSSUnitValue(n, 'turn');
|
|
13029
|
-
},
|
|
13030
|
-
/**
|
|
13031
|
-
* <time>
|
|
13032
|
-
*/
|
|
13033
|
-
s: function (n) {
|
|
13034
|
-
return new CSSUnitValue(n, 's');
|
|
13035
|
-
},
|
|
13036
|
-
/**
|
|
13037
|
-
* <time>
|
|
13038
|
-
*/
|
|
13039
|
-
ms: function (n) {
|
|
13040
|
-
return new CSSUnitValue(n, 'ms');
|
|
13041
|
-
},
|
|
13042
|
-
/**
|
|
13043
|
-
* CSS Properties & Values API
|
|
13044
|
-
*
|
|
13045
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
|
|
13046
|
-
* @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
|
|
13047
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13048
|
-
*/
|
|
13049
|
-
registerProperty: function (definition) {
|
|
13050
|
-
var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
|
|
13051
|
-
runtime.styleValueRegistry.registerMetadata({
|
|
13052
|
-
n: name,
|
|
13053
|
-
inh: inherits,
|
|
13054
|
-
int: interpolable,
|
|
13055
|
-
d: initialValue,
|
|
13056
|
-
syntax: syntax,
|
|
13057
|
-
});
|
|
13058
|
-
},
|
|
13059
|
-
/**
|
|
13060
|
-
* CSS Layout API
|
|
13061
|
-
* register layout
|
|
13062
|
-
*
|
|
13063
|
-
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
13064
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
13065
|
-
*/
|
|
13066
|
-
registerLayout: function (name, clazz) {
|
|
13067
|
-
runtime.layoutRegistry.registerLayout(name, clazz);
|
|
13068
|
-
},
|
|
13069
|
-
};
|
|
13070
|
-
|
|
13071
13041
|
var Circle = /** @class */ (function (_super) {
|
|
13072
13042
|
tslib.__extends(Circle, _super);
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
// }
|
|
13077
|
-
function Circle(_a) {
|
|
13078
|
-
if (_a === void 0) { _a = {}; }
|
|
13079
|
-
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13080
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE, style: runtime.enableCSSParsing
|
|
13081
|
-
? tslib.__assign({ cx: '', cy: '', r: '' }, style) : style, initialParsedStyle: {
|
|
13082
|
-
transformOrigin: runtime.enableCSSParsing
|
|
13083
|
-
? null
|
|
13084
|
-
: [PECENTAGE_50, PECENTAGE_50],
|
|
13085
|
-
} }, rest)) || this;
|
|
13043
|
+
function Circle(options) {
|
|
13044
|
+
if (options === void 0) { options = {}; }
|
|
13045
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE }, options)) || this;
|
|
13086
13046
|
}
|
|
13087
13047
|
return Circle;
|
|
13088
13048
|
}(DisplayObject));
|
|
@@ -13111,15 +13071,9 @@ var CustomElement = /** @class */ (function (_super) {
|
|
|
13111
13071
|
|
|
13112
13072
|
var Ellipse = /** @class */ (function (_super) {
|
|
13113
13073
|
tslib.__extends(Ellipse, _super);
|
|
13114
|
-
function Ellipse(
|
|
13115
|
-
if (
|
|
13116
|
-
|
|
13117
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE, style: runtime.enableCSSParsing
|
|
13118
|
-
? tslib.__assign({ cx: '', cy: '', rx: '', ry: '' }, style) : style, initialParsedStyle: {
|
|
13119
|
-
transformOrigin: runtime.enableCSSParsing
|
|
13120
|
-
? null
|
|
13121
|
-
: [PECENTAGE_50, PECENTAGE_50],
|
|
13122
|
-
} }, rest)) || this;
|
|
13074
|
+
function Ellipse(options) {
|
|
13075
|
+
if (options === void 0) { options = {}; }
|
|
13076
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE }, options)) || this;
|
|
13123
13077
|
}
|
|
13124
13078
|
return Ellipse;
|
|
13125
13079
|
}(DisplayObject));
|
|
@@ -13136,11 +13090,9 @@ var Ellipse = /** @class */ (function (_super) {
|
|
|
13136
13090
|
*/
|
|
13137
13091
|
var Group = /** @class */ (function (_super) {
|
|
13138
13092
|
tslib.__extends(Group, _super);
|
|
13139
|
-
function Group(
|
|
13140
|
-
if (
|
|
13141
|
-
|
|
13142
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.GROUP, style: runtime.enableCSSParsing
|
|
13143
|
-
? tslib.__assign({ width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
13093
|
+
function Group(options) {
|
|
13094
|
+
if (options === void 0) { options = {}; }
|
|
13095
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.GROUP }, options)) || this;
|
|
13144
13096
|
}
|
|
13145
13097
|
return Group;
|
|
13146
13098
|
}(DisplayObject));
|
|
@@ -13213,11 +13165,9 @@ var HTML = /** @class */ (function (_super) {
|
|
|
13213
13165
|
|
|
13214
13166
|
var Image = /** @class */ (function (_super) {
|
|
13215
13167
|
tslib.__extends(Image, _super);
|
|
13216
|
-
function Image(
|
|
13217
|
-
if (
|
|
13218
|
-
|
|
13219
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.IMAGE, style: runtime.enableCSSParsing
|
|
13220
|
-
? tslib.__assign({ x: '', y: '', img: '', width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
13168
|
+
function Image(options) {
|
|
13169
|
+
if (options === void 0) { options = {}; }
|
|
13170
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.IMAGE }, options)) || this;
|
|
13221
13171
|
}
|
|
13222
13172
|
return Image;
|
|
13223
13173
|
}(DisplayObject));
|
|
@@ -13346,11 +13296,11 @@ var Path = /** @class */ (function (_super) {
|
|
|
13346
13296
|
var _this = this;
|
|
13347
13297
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13348
13298
|
_this = _super.call(this, tslib.__assign({ type: exports.Shape.PATH, style: runtime.enableCSSParsing
|
|
13349
|
-
? tslib.__assign({
|
|
13299
|
+
? tslib.__assign({ d: '', miterLimit: '' }, style) : tslib.__assign({}, style), initialParsedStyle: runtime.enableCSSParsing
|
|
13350
13300
|
? null
|
|
13351
13301
|
: {
|
|
13352
13302
|
miterLimit: 4,
|
|
13353
|
-
|
|
13303
|
+
d: tslib.__assign({}, EMPTY_PARSED_PATH),
|
|
13354
13304
|
} }, rest)) || this;
|
|
13355
13305
|
_this.markerStartAngle = 0;
|
|
13356
13306
|
_this.markerEndAngle = 0;
|
|
@@ -13375,7 +13325,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13375
13325
|
return _this;
|
|
13376
13326
|
}
|
|
13377
13327
|
Path.prototype.attributeChangedCallback = function (attrName, oldValue, newValue, prevParsedValue, newParsedValue) {
|
|
13378
|
-
if (attrName === '
|
|
13328
|
+
if (attrName === 'd') {
|
|
13379
13329
|
// recalc markers
|
|
13380
13330
|
this.transformMarker(true);
|
|
13381
13331
|
this.transformMarker(false);
|
|
@@ -13450,7 +13400,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13450
13400
|
marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
|
|
13451
13401
|
};
|
|
13452
13402
|
Path.prototype.placeMarkerMid = function (marker) {
|
|
13453
|
-
var segments = this.parsedStyle.
|
|
13403
|
+
var segments = this.parsedStyle.d.segments;
|
|
13454
13404
|
// clear all existed markers
|
|
13455
13405
|
this.markerMidList.forEach(function (marker) {
|
|
13456
13406
|
marker.remove();
|
|
@@ -13479,7 +13429,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13479
13429
|
*/
|
|
13480
13430
|
Path.prototype.getPointAtLength = function (distance, inWorldSpace) {
|
|
13481
13431
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
13482
|
-
var absolutePath = this.parsedStyle.
|
|
13432
|
+
var absolutePath = this.parsedStyle.d.absolutePath;
|
|
13483
13433
|
var _a = util.getPointAtLength(absolutePath, distance), x = _a.x, y = _a.y;
|
|
13484
13434
|
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
|
|
13485
13435
|
// apply local transformation
|
|
@@ -13496,7 +13446,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13496
13446
|
* Get start tangent vector
|
|
13497
13447
|
*/
|
|
13498
13448
|
Path.prototype.getStartTangent = function () {
|
|
13499
|
-
var segments = this.parsedStyle.
|
|
13449
|
+
var segments = this.parsedStyle.d.segments;
|
|
13500
13450
|
var result = [];
|
|
13501
13451
|
if (segments.length > 1) {
|
|
13502
13452
|
var startPoint = segments[0].currentPoint;
|
|
@@ -13518,7 +13468,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13518
13468
|
* Get end tangent vector
|
|
13519
13469
|
*/
|
|
13520
13470
|
Path.prototype.getEndTangent = function () {
|
|
13521
|
-
var segments = this.parsedStyle.
|
|
13471
|
+
var segments = this.parsedStyle.d.segments;
|
|
13522
13472
|
var length = segments.length;
|
|
13523
13473
|
var result = [];
|
|
13524
13474
|
if (length > 1) {
|
|
@@ -13706,7 +13656,7 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13706
13656
|
} }, rest)) || this;
|
|
13707
13657
|
}
|
|
13708
13658
|
Polyline.prototype.getTotalLength = function () {
|
|
13709
|
-
return this
|
|
13659
|
+
return getOrCalculatePolylineTotalLength(this);
|
|
13710
13660
|
};
|
|
13711
13661
|
Polyline.prototype.getPointAtLength = function (distance, inWorldSpace) {
|
|
13712
13662
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
@@ -13714,16 +13664,34 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13714
13664
|
};
|
|
13715
13665
|
Polyline.prototype.getPoint = function (ratio, inWorldSpace) {
|
|
13716
13666
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
13717
|
-
var
|
|
13667
|
+
var points = this.parsedStyle.points.points;
|
|
13668
|
+
if (this.parsedStyle.points.segments.length === 0) {
|
|
13669
|
+
var segments_1 = [];
|
|
13670
|
+
var tempLength_1 = 0;
|
|
13671
|
+
var segmentT_1;
|
|
13672
|
+
var segmentL_1;
|
|
13673
|
+
var totalLength_1 = this.getTotalLength();
|
|
13674
|
+
points.forEach(function (p, i) {
|
|
13675
|
+
if (points[i + 1]) {
|
|
13676
|
+
segmentT_1 = [0, 0];
|
|
13677
|
+
segmentT_1[0] = tempLength_1 / totalLength_1;
|
|
13678
|
+
segmentL_1 = gMath.lineLength(p[0], p[1], points[i + 1][0], points[i + 1][1]);
|
|
13679
|
+
tempLength_1 += segmentL_1;
|
|
13680
|
+
segmentT_1[1] = tempLength_1 / totalLength_1;
|
|
13681
|
+
segments_1.push(segmentT_1);
|
|
13682
|
+
}
|
|
13683
|
+
});
|
|
13684
|
+
this.parsedStyle.points.segments = segments_1;
|
|
13685
|
+
}
|
|
13718
13686
|
var subt = 0;
|
|
13719
13687
|
var index = 0;
|
|
13720
|
-
segments.forEach(function (v, i) {
|
|
13688
|
+
this.parsedStyle.points.segments.forEach(function (v, i) {
|
|
13721
13689
|
if (ratio >= v[0] && ratio <= v[1]) {
|
|
13722
13690
|
subt = (ratio - v[0]) / (v[1] - v[0]);
|
|
13723
13691
|
index = i;
|
|
13724
13692
|
}
|
|
13725
13693
|
});
|
|
13726
|
-
var
|
|
13694
|
+
var _a = gMath.linePointAt(points[index][0], points[index][1], points[index + 1][0], points[index + 1][1], subt), x = _a.x, y = _a.y;
|
|
13727
13695
|
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
|
|
13728
13696
|
// apply local transformation
|
|
13729
13697
|
return new Point(transformed[0], transformed[1]);
|
|
@@ -13748,11 +13716,9 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13748
13716
|
|
|
13749
13717
|
var Rect = /** @class */ (function (_super) {
|
|
13750
13718
|
tslib.__extends(Rect, _super);
|
|
13751
|
-
function Rect(
|
|
13752
|
-
if (
|
|
13753
|
-
|
|
13754
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.RECT, style: runtime.enableCSSParsing
|
|
13755
|
-
? tslib.__assign({ x: '', y: '', width: '', height: '', radius: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
13719
|
+
function Rect(options) {
|
|
13720
|
+
if (options === void 0) { options = {}; }
|
|
13721
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.RECT }, options)) || this;
|
|
13756
13722
|
}
|
|
13757
13723
|
return Rect;
|
|
13758
13724
|
}(DisplayObject));
|
|
@@ -13774,26 +13740,7 @@ var Text = /** @class */ (function (_super) {
|
|
|
13774
13740
|
return _super.call(this, tslib.__assign({ type: exports.Shape.TEXT, style: runtime.enableCSSParsing
|
|
13775
13741
|
? tslib.__assign({ x: '', y: '', text: '', fontSize: '', fontFamily: '', fontStyle: '', fontWeight: '', fontVariant: '', textAlign: '', textBaseline: '', textTransform: '', fill: 'black', letterSpacing: '', lineHeight: '', miterLimit: '',
|
|
13776
13742
|
// whiteSpace: 'pre',
|
|
13777
|
-
wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : tslib.__assign({ fill: 'black' }, style),
|
|
13778
|
-
? {}
|
|
13779
|
-
: {
|
|
13780
|
-
x: 0,
|
|
13781
|
-
y: 0,
|
|
13782
|
-
fontSize: 16,
|
|
13783
|
-
fontFamily: 'sans-serif',
|
|
13784
|
-
fontStyle: 'normal',
|
|
13785
|
-
fontWeight: 'normal',
|
|
13786
|
-
fontVariant: 'normal',
|
|
13787
|
-
lineHeight: 0,
|
|
13788
|
-
letterSpacing: 0,
|
|
13789
|
-
textBaseline: 'alphabetic',
|
|
13790
|
-
textAlign: 'start',
|
|
13791
|
-
wordWrap: false,
|
|
13792
|
-
wordWrapWidth: 0,
|
|
13793
|
-
leading: 0,
|
|
13794
|
-
dx: 0,
|
|
13795
|
-
dy: 0,
|
|
13796
|
-
} }, rest)) || this;
|
|
13743
|
+
wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : tslib.__assign({ fill: 'black' }, style) }, rest)) || this;
|
|
13797
13744
|
}
|
|
13798
13745
|
// lengthAdjust: SVGAnimatedEnumeration;
|
|
13799
13746
|
// textLength: SVGAnimatedLength;
|
|
@@ -13870,6 +13817,109 @@ var CustomElementRegistry = /** @class */ (function () {
|
|
|
13870
13817
|
return CustomElementRegistry;
|
|
13871
13818
|
}());
|
|
13872
13819
|
|
|
13820
|
+
/**
|
|
13821
|
+
* holds useful CSS-related methods.
|
|
13822
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
13823
|
+
*
|
|
13824
|
+
* * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
|
|
13825
|
+
* * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13826
|
+
* * CSS Layout API
|
|
13827
|
+
*/
|
|
13828
|
+
var CSS = {
|
|
13829
|
+
/**
|
|
13830
|
+
* <number>
|
|
13831
|
+
* @see https://drafts.csswg.org/css-values-4/#number-value
|
|
13832
|
+
*/
|
|
13833
|
+
number: function (n) {
|
|
13834
|
+
return new CSSUnitValue(n);
|
|
13835
|
+
},
|
|
13836
|
+
/**
|
|
13837
|
+
* <percentage>
|
|
13838
|
+
* @see https://drafts.csswg.org/css-values-4/#percentage-value
|
|
13839
|
+
*/
|
|
13840
|
+
percent: function (n) {
|
|
13841
|
+
return new CSSUnitValue(n, '%');
|
|
13842
|
+
},
|
|
13843
|
+
/**
|
|
13844
|
+
* <length>
|
|
13845
|
+
*/
|
|
13846
|
+
px: function (n) {
|
|
13847
|
+
return new CSSUnitValue(n, 'px');
|
|
13848
|
+
},
|
|
13849
|
+
/**
|
|
13850
|
+
* <length>
|
|
13851
|
+
*/
|
|
13852
|
+
em: function (n) {
|
|
13853
|
+
return new CSSUnitValue(n, 'em');
|
|
13854
|
+
},
|
|
13855
|
+
rem: function (n) {
|
|
13856
|
+
return new CSSUnitValue(n, 'rem');
|
|
13857
|
+
},
|
|
13858
|
+
/**
|
|
13859
|
+
* <angle>
|
|
13860
|
+
*/
|
|
13861
|
+
deg: function (n) {
|
|
13862
|
+
return new CSSUnitValue(n, 'deg');
|
|
13863
|
+
},
|
|
13864
|
+
/**
|
|
13865
|
+
* <angle>
|
|
13866
|
+
*/
|
|
13867
|
+
grad: function (n) {
|
|
13868
|
+
return new CSSUnitValue(n, 'grad');
|
|
13869
|
+
},
|
|
13870
|
+
/**
|
|
13871
|
+
* <angle>
|
|
13872
|
+
*/
|
|
13873
|
+
rad: function (n) {
|
|
13874
|
+
return new CSSUnitValue(n, 'rad');
|
|
13875
|
+
},
|
|
13876
|
+
/**
|
|
13877
|
+
* <angle>
|
|
13878
|
+
*/
|
|
13879
|
+
turn: function (n) {
|
|
13880
|
+
return new CSSUnitValue(n, 'turn');
|
|
13881
|
+
},
|
|
13882
|
+
/**
|
|
13883
|
+
* <time>
|
|
13884
|
+
*/
|
|
13885
|
+
s: function (n) {
|
|
13886
|
+
return new CSSUnitValue(n, 's');
|
|
13887
|
+
},
|
|
13888
|
+
/**
|
|
13889
|
+
* <time>
|
|
13890
|
+
*/
|
|
13891
|
+
ms: function (n) {
|
|
13892
|
+
return new CSSUnitValue(n, 'ms');
|
|
13893
|
+
},
|
|
13894
|
+
/**
|
|
13895
|
+
* CSS Properties & Values API
|
|
13896
|
+
*
|
|
13897
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
|
|
13898
|
+
* @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
|
|
13899
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13900
|
+
*/
|
|
13901
|
+
registerProperty: function (definition) {
|
|
13902
|
+
var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
|
|
13903
|
+
runtime.styleValueRegistry.registerMetadata({
|
|
13904
|
+
n: name,
|
|
13905
|
+
inh: inherits,
|
|
13906
|
+
int: interpolable,
|
|
13907
|
+
d: initialValue,
|
|
13908
|
+
syntax: syntax,
|
|
13909
|
+
});
|
|
13910
|
+
},
|
|
13911
|
+
/**
|
|
13912
|
+
* CSS Layout API
|
|
13913
|
+
* register layout
|
|
13914
|
+
*
|
|
13915
|
+
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
13916
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
13917
|
+
*/
|
|
13918
|
+
registerLayout: function (name, clazz) {
|
|
13919
|
+
runtime.layoutRegistry.registerLayout(name, clazz);
|
|
13920
|
+
},
|
|
13921
|
+
};
|
|
13922
|
+
|
|
13873
13923
|
/**
|
|
13874
13924
|
* the entry of DOM tree
|
|
13875
13925
|
* Document -> Node -> EventTarget
|
|
@@ -13981,7 +14031,7 @@ var Document = /** @class */ (function (_super) {
|
|
|
13981
14031
|
var hitTestList = [];
|
|
13982
14032
|
rBushNodes.forEach(function (_a) {
|
|
13983
14033
|
var displayObject = _a.displayObject;
|
|
13984
|
-
var
|
|
14034
|
+
var _b = displayObject.parsedStyle.pointerEvents, pointerEvents = _b === void 0 ? 'auto' : _b;
|
|
13985
14035
|
// account for `visibility`
|
|
13986
14036
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
13987
14037
|
var isVisibilityAffected = [
|
|
@@ -14383,21 +14433,8 @@ var EventPlugin = /** @class */ (function () {
|
|
|
14383
14433
|
return;
|
|
14384
14434
|
// account for element in SVG
|
|
14385
14435
|
var $element = _this.context.contextService.getDomElement();
|
|
14386
|
-
var
|
|
14387
|
-
|
|
14388
|
-
outside =
|
|
14389
|
-
$element &&
|
|
14390
|
-
nativeEvent.target &&
|
|
14391
|
-
nativeEvent.target !== $element &&
|
|
14392
|
-
$element.contains &&
|
|
14393
|
-
!$element.contains(nativeEvent.target)
|
|
14394
|
-
? 'outside'
|
|
14395
|
-
: '';
|
|
14396
|
-
}
|
|
14397
|
-
catch (e) {
|
|
14398
|
-
// nativeEvent.target maybe not Node, such as Window
|
|
14399
|
-
// @see https://github.com/antvis/G/issues/1235
|
|
14400
|
-
}
|
|
14436
|
+
var isNativeEventFromCanvas = _this.context.eventService.isNativeEventFromCanvas($element, nativeEvent);
|
|
14437
|
+
var outside = !isNativeEventFromCanvas ? 'outside' : '';
|
|
14401
14438
|
var normalizedEvents = _this.normalizeToPointerEvent(nativeEvent, canvas);
|
|
14402
14439
|
try {
|
|
14403
14440
|
for (var normalizedEvents_3 = tslib.__values(normalizedEvents), normalizedEvents_3_1 = normalizedEvents_3.next(); !normalizedEvents_3_1.done; normalizedEvents_3_1 = normalizedEvents_3.next()) {
|
|
@@ -14710,11 +14747,13 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14710
14747
|
* sync to RBush later
|
|
14711
14748
|
*/
|
|
14712
14749
|
this.toSync = new Set();
|
|
14750
|
+
this.isFirstTimeRendering = true;
|
|
14751
|
+
this.syncing = false;
|
|
14752
|
+
this.isFirstTimeRenderingFinished = false;
|
|
14713
14753
|
}
|
|
14714
|
-
// private isFirstTimeRendering = true;
|
|
14715
|
-
// private syncing = false;
|
|
14716
14754
|
PrepareRendererPlugin.prototype.apply = function (context) {
|
|
14717
14755
|
var _this = this;
|
|
14756
|
+
var _a;
|
|
14718
14757
|
var renderingService = context.renderingService, renderingContext = context.renderingContext, rBushRoot = context.rBushRoot;
|
|
14719
14758
|
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
14720
14759
|
this.rBush = rBushRoot;
|
|
@@ -14743,6 +14782,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14743
14782
|
};
|
|
14744
14783
|
var handleMounted = function (e) {
|
|
14745
14784
|
var object = e.target;
|
|
14785
|
+
if (runtime.enableSizeAttenuation) {
|
|
14786
|
+
runtime.styleValueRegistry.updateSizeAttenuation(object, canvas.getCamera().getZoom());
|
|
14787
|
+
}
|
|
14746
14788
|
if (runtime.enableCSSParsing) {
|
|
14747
14789
|
// recalc style values
|
|
14748
14790
|
runtime.styleValueRegistry.recalc(object);
|
|
@@ -14773,26 +14815,28 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14773
14815
|
canvas.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
14774
14816
|
_this.toSync.clear();
|
|
14775
14817
|
});
|
|
14818
|
+
var ric = (_a = runtime.globalThis.requestIdleCallback) !== null && _a !== void 0 ? _a : raf.bind(runtime.globalThis);
|
|
14776
14819
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
// }
|
|
14820
|
+
if (_this.isFirstTimeRendering) {
|
|
14821
|
+
_this.isFirstTimeRendering = false;
|
|
14822
|
+
_this.syncing = true;
|
|
14823
|
+
ric(function () {
|
|
14824
|
+
_this.syncRTree(true);
|
|
14825
|
+
_this.isFirstTimeRenderingFinished = true;
|
|
14826
|
+
});
|
|
14827
|
+
}
|
|
14828
|
+
else {
|
|
14829
|
+
_this.syncRTree();
|
|
14830
|
+
}
|
|
14789
14831
|
});
|
|
14790
14832
|
};
|
|
14791
|
-
PrepareRendererPlugin.prototype.syncRTree = function () {
|
|
14792
|
-
// if (this.syncing) {
|
|
14793
|
-
// return;
|
|
14794
|
-
// }
|
|
14833
|
+
PrepareRendererPlugin.prototype.syncRTree = function (force) {
|
|
14795
14834
|
var _this = this;
|
|
14835
|
+
if (force === void 0) { force = false; }
|
|
14836
|
+
if (!force && (this.syncing || this.toSync.size === 0)) {
|
|
14837
|
+
return;
|
|
14838
|
+
}
|
|
14839
|
+
this.syncing = true;
|
|
14796
14840
|
// bounds changed, need re-inserting its children
|
|
14797
14841
|
var bulk = [];
|
|
14798
14842
|
Array.from(this.toSync)
|
|
@@ -14806,6 +14850,14 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14806
14850
|
}
|
|
14807
14851
|
var renderBounds = node.getRenderBounds();
|
|
14808
14852
|
if (renderBounds) {
|
|
14853
|
+
var renderable = node.renderable;
|
|
14854
|
+
if (force) {
|
|
14855
|
+
if (!renderable.dirtyRenderBounds) {
|
|
14856
|
+
renderable.dirtyRenderBounds = new AABB();
|
|
14857
|
+
}
|
|
14858
|
+
// save last dirty aabb
|
|
14859
|
+
renderable.dirtyRenderBounds.update(renderBounds.center, renderBounds.halfExtents);
|
|
14860
|
+
}
|
|
14809
14861
|
var _a = tslib.__read(renderBounds.getMin(), 2), minX = _a[0], minY = _a[1];
|
|
14810
14862
|
var _b = tslib.__read(renderBounds.getMax(), 2), maxX = _b[0], maxY = _b[1];
|
|
14811
14863
|
if (!rBushNode.aabb) {
|
|
@@ -14832,7 +14884,7 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14832
14884
|
this.rBush.load(bulk);
|
|
14833
14885
|
bulk.length = 0;
|
|
14834
14886
|
this.toSync.clear();
|
|
14835
|
-
|
|
14887
|
+
this.syncing = false;
|
|
14836
14888
|
};
|
|
14837
14889
|
PrepareRendererPlugin.tag = 'Prepare';
|
|
14838
14890
|
return PrepareRendererPlugin;
|
|
@@ -14985,10 +15037,20 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
14985
15037
|
// redraw when camera changed
|
|
14986
15038
|
camera.eventEmitter.on(CameraEvent.UPDATED, function () {
|
|
14987
15039
|
_this.context.renderingContext.renderReasons.add(exports.RenderReason.CAMERA_CHANGED);
|
|
15040
|
+
if (runtime.enableSizeAttenuation &&
|
|
15041
|
+
_this.getConfig().renderer.getConfig().enableSizeAttenuation) {
|
|
15042
|
+
_this.updateSizeAttenuation();
|
|
15043
|
+
}
|
|
14988
15044
|
});
|
|
14989
15045
|
// bind camera
|
|
14990
15046
|
this.context.camera = camera;
|
|
14991
15047
|
};
|
|
15048
|
+
Canvas.prototype.updateSizeAttenuation = function () {
|
|
15049
|
+
var zoom = this.getCamera().getZoom();
|
|
15050
|
+
this.document.documentElement.forEach(function (node) {
|
|
15051
|
+
runtime.styleValueRegistry.updateSizeAttenuation(node, zoom);
|
|
15052
|
+
});
|
|
15053
|
+
};
|
|
14992
15054
|
Canvas.prototype.getConfig = function () {
|
|
14993
15055
|
return this.context.config;
|
|
14994
15056
|
};
|
|
@@ -15373,6 +15435,7 @@ exports.FederatedPointerEvent = FederatedPointerEvent;
|
|
|
15373
15435
|
exports.FederatedWheelEvent = FederatedWheelEvent;
|
|
15374
15436
|
exports.Frustum = Frustum;
|
|
15375
15437
|
exports.Group = Group;
|
|
15438
|
+
exports.GroupUpdater = GroupUpdater;
|
|
15376
15439
|
exports.HTML = HTML;
|
|
15377
15440
|
exports.Image = Image;
|
|
15378
15441
|
exports.Line = Line;
|