@antv/g-lite 1.3.0-next.2 → 1.3.0-next.20
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/components/Geometry.d.ts +4 -0
- package/dist/css/StyleValueRegistry.d.ts +1 -1
- package/dist/css/cssom/CSSStyleValue.d.ts +1 -1
- 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/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 +1 -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/Rect.d.ts +1 -1
- package/dist/dom/Element.d.ts +1 -0
- package/dist/dom/Node.d.ts +1 -0
- package/dist/dom/interfaces.d.ts +1 -1
- package/dist/global-runtime.d.ts +6 -0
- package/dist/index.esm.js +613 -539
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +612 -537
- 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/SceneGraphService.d.ts +12 -12
- package/dist/services/aabb/GroupUpdater.d.ts +10 -0
- package/dist/services/aabb/index.d.ts +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/utils/path.d.ts +2 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -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
|
|
@@ -4128,19 +4128,17 @@ function parseDimensionArray(string) {
|
|
|
4128
4128
|
// },
|
|
4129
4129
|
// ];
|
|
4130
4130
|
// }
|
|
4131
|
-
function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
4132
|
-
if (
|
|
4133
|
-
return 0;
|
|
4134
|
-
}
|
|
4131
|
+
function convertPercentUnit(valueWithUnit, vec3Index, target, useMin) {
|
|
4132
|
+
if (useMin === void 0) { useMin = false; }
|
|
4135
4133
|
if (valueWithUnit.unit === exports.UnitType.kPixels) {
|
|
4136
4134
|
return Number(valueWithUnit.value);
|
|
4137
4135
|
}
|
|
4138
4136
|
else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
|
|
4139
4137
|
var bounds = target.nodeName === exports.Shape.GROUP
|
|
4140
4138
|
? target.getLocalBounds()
|
|
4141
|
-
:
|
|
4142
|
-
|
|
4143
|
-
|
|
4139
|
+
: target.getGeometryBounds();
|
|
4140
|
+
return ((useMin ? bounds.min[vec3Index] : 0) +
|
|
4141
|
+
(valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2);
|
|
4144
4142
|
}
|
|
4145
4143
|
return 0;
|
|
4146
4144
|
}
|
|
@@ -4243,10 +4241,16 @@ function mergeNumberLists(left, right) {
|
|
|
4243
4241
|
}
|
|
4244
4242
|
|
|
4245
4243
|
function getOrCalculatePathTotalLength(path) {
|
|
4246
|
-
if (path.parsedStyle.
|
|
4247
|
-
path.parsedStyle.
|
|
4244
|
+
if (path.parsedStyle.d.totalLength === 0) {
|
|
4245
|
+
path.parsedStyle.d.totalLength = util.getTotalLength(path.parsedStyle.d.absolutePath);
|
|
4246
|
+
}
|
|
4247
|
+
return path.parsedStyle.d.totalLength;
|
|
4248
|
+
}
|
|
4249
|
+
function getOrCalculatePolylineTotalLength(polyline) {
|
|
4250
|
+
if (polyline.parsedStyle.points.totalLength === 0) {
|
|
4251
|
+
polyline.parsedStyle.points.totalLength = gMath.polylineLength(polyline.parsedStyle.points.points);
|
|
4248
4252
|
}
|
|
4249
|
-
return
|
|
4253
|
+
return polyline.parsedStyle.points.totalLength;
|
|
4250
4254
|
}
|
|
4251
4255
|
function removeRedundantMCommand(path) {
|
|
4252
4256
|
for (var i = 0; i < path.length; i++) {
|
|
@@ -4956,7 +4960,7 @@ function convertToPath(object, transform) {
|
|
|
4956
4960
|
}));
|
|
4957
4961
|
break;
|
|
4958
4962
|
case exports.Shape.PATH:
|
|
4959
|
-
var absolutePath = object.parsedStyle.
|
|
4963
|
+
var absolutePath = object.parsedStyle.d.absolutePath;
|
|
4960
4964
|
commands = tslib.__spreadArray([], tslib.__read(absolutePath), false);
|
|
4961
4965
|
break;
|
|
4962
4966
|
}
|
|
@@ -5118,27 +5122,10 @@ function parsePoints(pointsOrStr, object) {
|
|
|
5118
5122
|
else {
|
|
5119
5123
|
points = pointsOrStr;
|
|
5120
5124
|
}
|
|
5121
|
-
var segments = [];
|
|
5122
|
-
var tempLength = 0;
|
|
5123
|
-
var segmentT;
|
|
5124
|
-
var segmentL;
|
|
5125
|
-
var totalLength = gMath.polylineLength(points);
|
|
5126
|
-
points.forEach(function (p, i) {
|
|
5127
|
-
if (points[i + 1]) {
|
|
5128
|
-
segmentT = [0, 0];
|
|
5129
|
-
segmentT[0] = tempLength / totalLength;
|
|
5130
|
-
segmentL = gMath.lineLength(p[0], p[1], points[i + 1][0], points[i + 1][1]);
|
|
5131
|
-
tempLength += segmentL;
|
|
5132
|
-
segmentT[1] = tempLength / totalLength;
|
|
5133
|
-
segments.push(segmentT);
|
|
5134
|
-
}
|
|
5135
|
-
});
|
|
5136
|
-
// const minX = Math.min(...points.map((point) => point[0]));
|
|
5137
|
-
// const minY = Math.min(...points.map((point) => point[1]));
|
|
5138
5125
|
return {
|
|
5139
5126
|
points: points,
|
|
5140
|
-
totalLength:
|
|
5141
|
-
segments:
|
|
5127
|
+
totalLength: 0,
|
|
5128
|
+
segments: [],
|
|
5142
5129
|
};
|
|
5143
5130
|
}
|
|
5144
5131
|
function mergePoints(left, right) {
|
|
@@ -5979,7 +5966,7 @@ function convertKeyword2Percent(keyword) {
|
|
|
5979
5966
|
return '50%';
|
|
5980
5967
|
}
|
|
5981
5968
|
else if (keyword === 'left' || keyword === 'top') {
|
|
5982
|
-
return '0';
|
|
5969
|
+
return '0%';
|
|
5983
5970
|
}
|
|
5984
5971
|
else if (keyword === 'right' || keyword === 'bottom') {
|
|
5985
5972
|
return '100%';
|
|
@@ -6247,16 +6234,17 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6247
6234
|
{
|
|
6248
6235
|
n: 'transformOrigin',
|
|
6249
6236
|
p: 100,
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6237
|
+
d: '0 0',
|
|
6238
|
+
// // int: true,
|
|
6239
|
+
// d: (nodeName: string) => {
|
|
6240
|
+
// if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
6241
|
+
// return 'center';
|
|
6242
|
+
// }
|
|
6243
|
+
// if (nodeName === Shape.TEXT) {
|
|
6244
|
+
// return 'text-anchor';
|
|
6245
|
+
// }
|
|
6246
|
+
// return 'left top';
|
|
6247
|
+
// },
|
|
6260
6248
|
l: true,
|
|
6261
6249
|
syntax: exports.PropertySyntax.TRANSFORM_ORIGIN,
|
|
6262
6250
|
},
|
|
@@ -6395,11 +6383,10 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6395
6383
|
},
|
|
6396
6384
|
// Path
|
|
6397
6385
|
{
|
|
6398
|
-
n: '
|
|
6386
|
+
n: 'd',
|
|
6399
6387
|
int: true,
|
|
6400
6388
|
l: true,
|
|
6401
6389
|
d: '',
|
|
6402
|
-
a: ['d'],
|
|
6403
6390
|
syntax: exports.PropertySyntax.PATH,
|
|
6404
6391
|
p: 50,
|
|
6405
6392
|
},
|
|
@@ -6623,16 +6610,16 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6623
6610
|
}; }
|
|
6624
6611
|
if (!this.runtime.enableCSSParsing) {
|
|
6625
6612
|
Object.assign(object.attributes, attributes);
|
|
6626
|
-
var
|
|
6613
|
+
var attributeNames = Object.keys(attributes);
|
|
6627
6614
|
// clipPath
|
|
6628
6615
|
var oldClipPath = object.parsedStyle.clipPath;
|
|
6629
6616
|
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
6630
6617
|
object.parsedStyle = Object.assign(object.parsedStyle, attributes);
|
|
6631
|
-
var
|
|
6632
|
-
if (!
|
|
6618
|
+
var needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
6619
|
+
if (!needUpdateGeometry) {
|
|
6633
6620
|
for (var i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
|
|
6634
6621
|
if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
|
|
6635
|
-
|
|
6622
|
+
needUpdateGeometry = true;
|
|
6636
6623
|
break;
|
|
6637
6624
|
}
|
|
6638
6625
|
}
|
|
@@ -6668,14 +6655,14 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6668
6655
|
}
|
|
6669
6656
|
// Path
|
|
6670
6657
|
// @ts-ignore
|
|
6671
|
-
if (attributes.
|
|
6672
|
-
object.parsedStyle.
|
|
6658
|
+
if (attributes.d === '') {
|
|
6659
|
+
object.parsedStyle.d = tslib.__assign({}, EMPTY_PARSED_PATH);
|
|
6673
6660
|
}
|
|
6674
6661
|
// @ts-ignore
|
|
6675
|
-
if (attributes.
|
|
6676
|
-
object.parsedStyle.
|
|
6662
|
+
if (attributes.d) {
|
|
6663
|
+
object.parsedStyle.d = parsePath(
|
|
6677
6664
|
// @ts-ignore
|
|
6678
|
-
attributes.
|
|
6665
|
+
attributes.d);
|
|
6679
6666
|
}
|
|
6680
6667
|
// Text
|
|
6681
6668
|
if (attributes.textTransform) {
|
|
@@ -6719,95 +6706,107 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6719
6706
|
attributes.markerMid, null, null);
|
|
6720
6707
|
}
|
|
6721
6708
|
if (!util.isNil(attributes.zIndex)) {
|
|
6722
|
-
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object,
|
|
6709
|
+
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames);
|
|
6723
6710
|
}
|
|
6724
6711
|
if (!util.isNil(attributes.offsetDistance)) {
|
|
6725
|
-
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object,
|
|
6712
|
+
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames);
|
|
6726
6713
|
}
|
|
6727
6714
|
if (attributes.transform) {
|
|
6728
|
-
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object,
|
|
6715
|
+
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
|
|
6729
6716
|
}
|
|
6730
|
-
if (
|
|
6731
|
-
this.
|
|
6717
|
+
if (attributes.transformOrigin) {
|
|
6718
|
+
this.runtime.CSSPropertySyntaxFactory['<transform-origin>'].postProcessor(object, attributeNames);
|
|
6719
|
+
}
|
|
6720
|
+
if (needUpdateGeometry) {
|
|
6721
|
+
object.geometry.dirty = true;
|
|
6722
|
+
object.renderable.boundsDirty = true;
|
|
6723
|
+
object.renderable.renderBoundsDirty = true;
|
|
6724
|
+
if (!options.forceUpdateGeometry) {
|
|
6725
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6726
|
+
}
|
|
6732
6727
|
}
|
|
6733
|
-
return;
|
|
6734
6728
|
}
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
if (!skipParse) {
|
|
6748
|
-
attributeNames.forEach(function (name) {
|
|
6749
|
-
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize);
|
|
6729
|
+
else {
|
|
6730
|
+
var skipUpdateAttribute_1 = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize_1 = options.memoize;
|
|
6731
|
+
var needUpdateGeometry_1 = forceUpdateGeometry;
|
|
6732
|
+
var attributeNames_1 = Object.keys(attributes);
|
|
6733
|
+
attributeNames_1.forEach(function (attributeName) {
|
|
6734
|
+
var _a;
|
|
6735
|
+
if (!skipUpdateAttribute_1) {
|
|
6736
|
+
object.attributes[attributeName] = attributes[attributeName];
|
|
6737
|
+
}
|
|
6738
|
+
if (!needUpdateGeometry_1 && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
|
|
6739
|
+
needUpdateGeometry_1 = true;
|
|
6740
|
+
}
|
|
6750
6741
|
});
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
// points 50
|
|
6756
|
-
// text 50
|
|
6757
|
-
// textTransform 51
|
|
6758
|
-
// transform 100
|
|
6759
|
-
// transformOrigin 100
|
|
6760
|
-
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
6761
|
-
// uniqueAttributeSet.clear();
|
|
6762
|
-
attributeNames = Array.from(new Set(attributeNames.concat(usedAttributes)));
|
|
6763
|
-
}
|
|
6764
|
-
// [
|
|
6765
|
-
// 'path',
|
|
6766
|
-
// 'points',
|
|
6767
|
-
// 'text',
|
|
6768
|
-
// 'textTransform',
|
|
6769
|
-
// 'transform',
|
|
6770
|
-
// 'transformOrigin',
|
|
6771
|
-
// ].forEach((name) => {
|
|
6772
|
-
// const index = attributeNames.indexOf(name);
|
|
6773
|
-
// if (index > -1) {
|
|
6774
|
-
// attributeNames.splice(index, 1);
|
|
6775
|
-
// attributeNames.push(name);
|
|
6776
|
-
// }
|
|
6777
|
-
// });
|
|
6778
|
-
attributeNames.forEach(function (name) {
|
|
6779
|
-
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6780
|
-
if (name in object.computedStyle) {
|
|
6781
|
-
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize);
|
|
6742
|
+
if (!skipParse) {
|
|
6743
|
+
attributeNames_1.forEach(function (name) {
|
|
6744
|
+
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize_1);
|
|
6745
|
+
});
|
|
6782
6746
|
}
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
//
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6747
|
+
// let hasUnresolvedProperties = false;
|
|
6748
|
+
// parse according to priority
|
|
6749
|
+
// path 50
|
|
6750
|
+
// points 50
|
|
6751
|
+
// text 50
|
|
6752
|
+
// textTransform 51
|
|
6753
|
+
// transform 100
|
|
6754
|
+
// transformOrigin 100
|
|
6755
|
+
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
6756
|
+
// uniqueAttributeSet.clear();
|
|
6757
|
+
attributeNames_1 = Array.from(new Set(attributeNames_1.concat(usedAttributes)));
|
|
6758
|
+
}
|
|
6759
|
+
// [
|
|
6760
|
+
// 'path',
|
|
6761
|
+
// 'points',
|
|
6762
|
+
// 'text',
|
|
6763
|
+
// 'textTransform',
|
|
6764
|
+
// 'transform',
|
|
6765
|
+
// 'transformOrigin',
|
|
6766
|
+
// ].forEach((name) => {
|
|
6767
|
+
// const index = attributeNames.indexOf(name);
|
|
6768
|
+
// if (index > -1) {
|
|
6769
|
+
// attributeNames.splice(index, 1);
|
|
6770
|
+
// attributeNames.push(name);
|
|
6771
|
+
// }
|
|
6772
|
+
// });
|
|
6773
|
+
attributeNames_1.forEach(function (name) {
|
|
6774
|
+
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6775
|
+
if (name in object.computedStyle) {
|
|
6776
|
+
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize_1);
|
|
6777
|
+
}
|
|
6778
|
+
});
|
|
6779
|
+
// if (hasUnresolvedProperties) {
|
|
6780
|
+
// this.dirty = true;
|
|
6781
|
+
// return;
|
|
6782
|
+
// }
|
|
6783
|
+
// update geometry
|
|
6784
|
+
if (needUpdateGeometry_1) {
|
|
6785
|
+
object.geometry.dirty = true;
|
|
6786
|
+
object.renderable.boundsDirty = true;
|
|
6787
|
+
object.renderable.renderBoundsDirty = true;
|
|
6788
|
+
if (!options.forceUpdateGeometry) {
|
|
6789
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6790
|
+
}
|
|
6797
6791
|
}
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
|
|
6802
|
-
// update children's inheritable
|
|
6803
|
-
object.children.forEach(function (child) {
|
|
6804
|
-
child.internalSetAttribute(name, null, {
|
|
6805
|
-
skipUpdateAttribute: true,
|
|
6806
|
-
skipParse: true,
|
|
6807
|
-
});
|
|
6808
|
-
});
|
|
6792
|
+
attributeNames_1.forEach(function (name) {
|
|
6793
|
+
if (name in object.parsedStyle) {
|
|
6794
|
+
_this.postProcessProperty(name, object, attributeNames_1);
|
|
6809
6795
|
}
|
|
6810
6796
|
});
|
|
6797
|
+
if (this.runtime.enableCSSParsing && object.children.length) {
|
|
6798
|
+
attributeNames_1.forEach(function (name) {
|
|
6799
|
+
if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
|
|
6800
|
+
// update children's inheritable
|
|
6801
|
+
object.children.forEach(function (child) {
|
|
6802
|
+
child.internalSetAttribute(name, null, {
|
|
6803
|
+
skipUpdateAttribute: true,
|
|
6804
|
+
skipParse: true,
|
|
6805
|
+
});
|
|
6806
|
+
});
|
|
6807
|
+
}
|
|
6808
|
+
});
|
|
6809
|
+
}
|
|
6811
6810
|
}
|
|
6812
6811
|
};
|
|
6813
6812
|
/**
|
|
@@ -7000,11 +6999,15 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7000
6999
|
// depth / 2,
|
|
7001
7000
|
// );
|
|
7002
7001
|
// anchor is center by default, don't account for lineWidth here
|
|
7003
|
-
var _h = parsedStyle, stroke = _h.stroke,
|
|
7002
|
+
var _h = parsedStyle, stroke = _h.stroke, _j = _h.lineWidth, lineWidth = _j === void 0 ? 1 : _j,
|
|
7003
|
+
// lineCap,
|
|
7004
|
+
// lineJoin,
|
|
7005
|
+
// miterLimit,
|
|
7006
|
+
_k = _h.increasedLineWidthForHitTesting,
|
|
7004
7007
|
// lineCap,
|
|
7005
7008
|
// lineJoin,
|
|
7006
7009
|
// miterLimit,
|
|
7007
|
-
increasedLineWidthForHitTesting =
|
|
7010
|
+
increasedLineWidthForHitTesting = _k === void 0 ? 0 : _k, shadowType = _h.shadowType, shadowColor = _h.shadowColor, _l = _h.filter, filter = _l === void 0 ? [] : _l, transformOrigin = _h.transformOrigin;
|
|
7008
7011
|
var center = [cx, cy, cz];
|
|
7009
7012
|
// update geometry's AABB
|
|
7010
7013
|
geometry_1.contentBounds.update(center, halfExtents);
|
|
@@ -7038,8 +7041,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7038
7041
|
geometry_1.renderBounds.update(center, halfExtents);
|
|
7039
7042
|
// account for shadow, only support constant value now
|
|
7040
7043
|
if (shadowColor && shadowType && shadowType !== 'inner') {
|
|
7041
|
-
var
|
|
7042
|
-
var
|
|
7044
|
+
var _m = geometry_1.renderBounds, min = _m.min, max = _m.max;
|
|
7045
|
+
var _o = parsedStyle, shadowBlur = _o.shadowBlur, shadowOffsetX = _o.shadowOffsetX, shadowOffsetY = _o.shadowOffsetY;
|
|
7043
7046
|
var shadowBlurInPixels = shadowBlur || 0;
|
|
7044
7047
|
var shadowOffsetXInPixels = shadowOffsetX || 0;
|
|
7045
7048
|
var shadowOffsetYInPixels = shadowOffsetY || 0;
|
|
@@ -7076,25 +7079,22 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7076
7079
|
geometry_1.renderBounds.setMinMax(min, max);
|
|
7077
7080
|
}
|
|
7078
7081
|
});
|
|
7079
|
-
|
|
7080
|
-
// account for negative width / height of Rect
|
|
7082
|
+
object.geometry.dirty = false;
|
|
7081
7083
|
// @see https://github.com/antvis/g/issues/957
|
|
7082
7084
|
var flipY = hwidth < 0;
|
|
7083
7085
|
var flipX = hheight < 0;
|
|
7084
|
-
// } else {
|
|
7085
|
-
// }
|
|
7086
7086
|
// set transform origin
|
|
7087
7087
|
var usedOriginXValue = (flipY ? -1 : 1) *
|
|
7088
7088
|
(transformOrigin
|
|
7089
|
-
? convertPercentUnit(transformOrigin[0], 0, object)
|
|
7089
|
+
? convertPercentUnit(transformOrigin[0], 0, object, true)
|
|
7090
7090
|
: 0);
|
|
7091
7091
|
var usedOriginYValue = (flipX ? -1 : 1) *
|
|
7092
7092
|
(transformOrigin
|
|
7093
|
-
? convertPercentUnit(transformOrigin[1], 1, object)
|
|
7093
|
+
? convertPercentUnit(transformOrigin[1], 1, object, true)
|
|
7094
7094
|
: 0);
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7095
|
+
if (usedOriginXValue || usedOriginYValue) {
|
|
7096
|
+
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
7097
|
+
}
|
|
7098
7098
|
}
|
|
7099
7099
|
};
|
|
7100
7100
|
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
@@ -7520,8 +7520,8 @@ function sortedIndex(array, value) {
|
|
|
7520
7520
|
return low;
|
|
7521
7521
|
}
|
|
7522
7522
|
function sortByZIndex(o1, o2) {
|
|
7523
|
-
var zIndex1 = Number(o1.parsedStyle.zIndex);
|
|
7524
|
-
var zIndex2 = Number(o2.parsedStyle.zIndex);
|
|
7523
|
+
var zIndex1 = Number(o1.parsedStyle.zIndex || 0);
|
|
7524
|
+
var zIndex2 = Number(o2.parsedStyle.zIndex || 0);
|
|
7525
7525
|
if (zIndex1 === zIndex2) {
|
|
7526
7526
|
var parent_1 = o1.parentNode;
|
|
7527
7527
|
if (parent_1) {
|
|
@@ -7585,6 +7585,7 @@ var clock = typeof performance === 'object' && performance.now ? performance : D
|
|
|
7585
7585
|
function isFillOrStrokeAffected(pointerEvents, fill, stroke) {
|
|
7586
7586
|
// account for pointerEvents
|
|
7587
7587
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
7588
|
+
if (pointerEvents === void 0) { pointerEvents = 'auto'; }
|
|
7588
7589
|
var hasFill = false;
|
|
7589
7590
|
var hasStroke = false;
|
|
7590
7591
|
var isFillOtherThanNone = !!fill && !fill.isNone;
|
|
@@ -7811,7 +7812,7 @@ var genericFontFamilies = [
|
|
|
7811
7812
|
];
|
|
7812
7813
|
var stringRegExp = /([\"\'])[^\'\"]+\1/;
|
|
7813
7814
|
function toFontString(attributes) {
|
|
7814
|
-
var
|
|
7815
|
+
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
7816
|
// build canvas api font setting from individual components. Convert a numeric this.fontSize to px
|
|
7816
7817
|
// const fontSizeString: string = isNumber(fontSize) ? `${fontSize}px` : fontSize.toString();
|
|
7817
7818
|
var fontSizeString = (util.isNumber(fontSize) && "".concat(fontSize, "px")) || '16px';
|
|
@@ -7831,92 +7832,126 @@ function toFontString(attributes) {
|
|
|
7831
7832
|
return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
|
|
7832
7833
|
}
|
|
7833
7834
|
|
|
7834
|
-
|
|
7835
|
+
function createSkewMatrix(skewMatrix, skewX, skewY) {
|
|
7836
|
+
// Create an identity matrix
|
|
7837
|
+
glMatrix.mat4.identity(skewMatrix);
|
|
7838
|
+
// Apply skew to the matrix
|
|
7839
|
+
skewMatrix[4] = Math.tan(skewX); // Skew Y axis in X direction
|
|
7840
|
+
skewMatrix[1] = Math.tan(skewY); // Skew X axis in Y direction
|
|
7841
|
+
return skewMatrix;
|
|
7842
|
+
}
|
|
7843
|
+
var SCALE_EPSILON = 0.00001;
|
|
7844
|
+
var tmpMat1 = glMatrix.mat4.create();
|
|
7845
|
+
var tmpMat2 = glMatrix.mat4.create();
|
|
7835
7846
|
function parsedTransformToMat4(transform, object) {
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7847
|
+
if (transform.length) {
|
|
7848
|
+
var m_1 = glMatrix.mat4.identity(tmpMat1);
|
|
7849
|
+
transform.forEach(function (parsed) {
|
|
7850
|
+
var t = parsed.t, d = parsed.d;
|
|
7851
|
+
if (t === 'scale') {
|
|
7852
|
+
// scale(1) scale(1, 1)
|
|
7853
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [
|
|
7854
|
+
1, 1,
|
|
7855
|
+
];
|
|
7856
|
+
glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], 1]);
|
|
7857
|
+
}
|
|
7858
|
+
else if (t === 'scalex') {
|
|
7859
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
|
|
7860
|
+
glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], 1, 1]);
|
|
7861
|
+
}
|
|
7862
|
+
else if (t === 'scaley') {
|
|
7863
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
|
|
7864
|
+
glMatrix.mat4.fromScaling(tmpMat2, [1, newScale[0], 1]);
|
|
7865
|
+
}
|
|
7866
|
+
else if (t === 'scalez') {
|
|
7867
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
|
|
7868
|
+
glMatrix.mat4.fromScaling(tmpMat2, [1, 1, newScale[0]]);
|
|
7869
|
+
}
|
|
7870
|
+
else if (t === 'scale3d') {
|
|
7871
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [
|
|
7872
|
+
1, 1, 1,
|
|
7873
|
+
];
|
|
7874
|
+
glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], newScale[2]]);
|
|
7875
|
+
}
|
|
7876
|
+
else if (t === 'translate') {
|
|
7877
|
+
var newTranslation = d || [Opx, Opx];
|
|
7878
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [
|
|
7879
|
+
newTranslation[0].value,
|
|
7880
|
+
newTranslation[1].value,
|
|
7881
|
+
0,
|
|
7882
|
+
]);
|
|
7883
|
+
}
|
|
7884
|
+
else if (t === 'translatex') {
|
|
7885
|
+
var newTranslation = d || [Opx];
|
|
7886
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [newTranslation[0].value, 0, 0]);
|
|
7887
|
+
}
|
|
7888
|
+
else if (t === 'translatey') {
|
|
7889
|
+
var newTranslation = d || [Opx];
|
|
7890
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [0, newTranslation[0].value, 0]);
|
|
7891
|
+
}
|
|
7892
|
+
else if (t === 'translatez') {
|
|
7893
|
+
var newTranslation = d || [Opx];
|
|
7894
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [0, 0, newTranslation[0].value]);
|
|
7895
|
+
}
|
|
7896
|
+
else if (t === 'translate3d') {
|
|
7897
|
+
var newTranslation = d || [Opx, Opx, Opx];
|
|
7898
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [
|
|
7899
|
+
newTranslation[0].value,
|
|
7900
|
+
newTranslation[1].value,
|
|
7901
|
+
newTranslation[2].value,
|
|
7902
|
+
]);
|
|
7903
|
+
}
|
|
7904
|
+
else if (t === 'rotate') {
|
|
7905
|
+
var newAngles = d || [Odeg];
|
|
7906
|
+
glMatrix.mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7907
|
+
}
|
|
7908
|
+
else if (t === 'rotatex') {
|
|
7909
|
+
var newAngles = d || [Odeg];
|
|
7910
|
+
glMatrix.mat4.fromXRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7911
|
+
}
|
|
7912
|
+
else if (t === 'rotatey') {
|
|
7913
|
+
var newAngles = d || [Odeg];
|
|
7914
|
+
glMatrix.mat4.fromYRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7915
|
+
}
|
|
7916
|
+
else if (t === 'rotatez') {
|
|
7917
|
+
var newAngles = d || [Odeg];
|
|
7918
|
+
glMatrix.mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7919
|
+
}
|
|
7920
|
+
else if (t === 'rotate3d') {
|
|
7921
|
+
var newAngles = d || [Opx, Opx, Opx, Odeg];
|
|
7922
|
+
glMatrix.mat4.fromRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[3])), [
|
|
7923
|
+
newAngles[0].value,
|
|
7924
|
+
newAngles[1].value,
|
|
7925
|
+
newAngles[2].value,
|
|
7926
|
+
]);
|
|
7927
|
+
}
|
|
7928
|
+
else if (t === 'skew') {
|
|
7929
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0, 0];
|
|
7930
|
+
createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), deg2rad(newSkew[1]));
|
|
7931
|
+
}
|
|
7932
|
+
else if (t === 'skewx') {
|
|
7933
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
|
|
7934
|
+
createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), 0);
|
|
7935
|
+
}
|
|
7936
|
+
else if (t === 'skewy') {
|
|
7937
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
|
|
7938
|
+
createSkewMatrix(tmpMat2, 0, deg2rad(newSkew[0]));
|
|
7939
|
+
}
|
|
7940
|
+
else if (t === 'matrix') {
|
|
7941
|
+
var _a = tslib.__read(d.map(function (s) { return s.value; }), 6), a = _a[0], b = _a[1], c = _a[2], dd = _a[3], tx = _a[4], ty = _a[5];
|
|
7942
|
+
glMatrix.mat4.set(tmpMat2, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1);
|
|
7943
|
+
}
|
|
7944
|
+
else if (t === 'matrix3d') {
|
|
7945
|
+
// @ts-ignore
|
|
7946
|
+
glMatrix.mat4.set.apply(glMatrix.mat4, tslib.__spreadArray([tmpMat2], tslib.__read(d.map(function (s) { return s.value; })), false));
|
|
7947
|
+
}
|
|
7948
|
+
glMatrix.mat4.mul(m_1, m_1, tmpMat2);
|
|
7949
|
+
});
|
|
7950
|
+
object.setLocalTransform(m_1);
|
|
7951
|
+
}
|
|
7952
|
+
else {
|
|
7953
|
+
object.resetLocalTransform();
|
|
7954
|
+
}
|
|
7920
7955
|
return object.getLocalTransform();
|
|
7921
7956
|
}
|
|
7922
7957
|
|
|
@@ -7980,17 +8015,18 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
|
7980
8015
|
function CSSPropertyTransformOrigin() {
|
|
7981
8016
|
this.parser = parseTransformOrigin;
|
|
7982
8017
|
this.parserUnmemoize = parseTransformOriginUnmemoize;
|
|
7983
|
-
// calculator(
|
|
7984
|
-
// name: string,
|
|
7985
|
-
// oldParsed: [CSSUnitValue, CSSUnitValue],
|
|
7986
|
-
// parsed: [CSSUnitValue, CSSUnitValue],
|
|
7987
|
-
// object: DisplayObject,
|
|
7988
|
-
// ): [number, number] {
|
|
7989
|
-
// console.log(object, parsed);
|
|
7990
|
-
// return [parsed[0].value, parsed[1].value];
|
|
7991
|
-
// // return [convertPercentUnit(parsed[0], 0, object), convertPercentUnit(parsed[1], 1, object)];
|
|
7992
|
-
// }
|
|
7993
8018
|
}
|
|
8019
|
+
CSSPropertyTransformOrigin.prototype.postProcessor = function (object) {
|
|
8020
|
+
var transformOrigin = object.parsedStyle.transformOrigin;
|
|
8021
|
+
if (transformOrigin[0].unit === exports.UnitType.kPixels &&
|
|
8022
|
+
transformOrigin[1].unit === exports.UnitType.kPixels) {
|
|
8023
|
+
object.setOrigin(transformOrigin[0].value, transformOrigin[1].value);
|
|
8024
|
+
}
|
|
8025
|
+
else {
|
|
8026
|
+
// Relative to geometry bounds, calculate later.
|
|
8027
|
+
object.getGeometryBounds();
|
|
8028
|
+
}
|
|
8029
|
+
};
|
|
7994
8030
|
return CSSPropertyTransformOrigin;
|
|
7995
8031
|
}());
|
|
7996
8032
|
|
|
@@ -8077,8 +8113,8 @@ var PathUpdater = /** @class */ (function () {
|
|
|
8077
8113
|
function PathUpdater() {
|
|
8078
8114
|
}
|
|
8079
8115
|
PathUpdater.prototype.update = function (parsedStyle) {
|
|
8080
|
-
var
|
|
8081
|
-
var _a =
|
|
8116
|
+
var d = parsedStyle.d;
|
|
8117
|
+
var _a = d.rect, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
8082
8118
|
var hwidth = width / 2;
|
|
8083
8119
|
var hheight = height / 2;
|
|
8084
8120
|
return {
|
|
@@ -8127,17 +8163,17 @@ var RectUpdater = /** @class */ (function () {
|
|
|
8127
8163
|
function RectUpdater() {
|
|
8128
8164
|
}
|
|
8129
8165
|
RectUpdater.prototype.update = function (parsedStyle, object) {
|
|
8130
|
-
var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b,
|
|
8166
|
+
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;
|
|
8131
8167
|
var contentWidth = width;
|
|
8132
8168
|
var contentHeight = height;
|
|
8133
8169
|
// resize with HTMLImageElement's size
|
|
8134
|
-
if (
|
|
8170
|
+
if (src && !util.isString(src)) {
|
|
8135
8171
|
if (!contentWidth) {
|
|
8136
|
-
contentWidth =
|
|
8172
|
+
contentWidth = src.width;
|
|
8137
8173
|
parsedStyle.width = contentWidth;
|
|
8138
8174
|
}
|
|
8139
8175
|
if (!contentHeight) {
|
|
8140
|
-
contentHeight =
|
|
8176
|
+
contentHeight = src.height;
|
|
8141
8177
|
parsedStyle.height = contentHeight;
|
|
8142
8178
|
}
|
|
8143
8179
|
}
|
|
@@ -8157,18 +8193,20 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8157
8193
|
}
|
|
8158
8194
|
TextUpdater.prototype.isReadyToMeasure = function (parsedStyle, object) {
|
|
8159
8195
|
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;
|
|
8160
|
-
return
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8196
|
+
return runtime.enableCSSParsing
|
|
8197
|
+
? text &&
|
|
8198
|
+
fontSize &&
|
|
8199
|
+
fontStyle &&
|
|
8200
|
+
fontWeight &&
|
|
8201
|
+
fontVariant &&
|
|
8202
|
+
textAlign &&
|
|
8203
|
+
textBaseline &&
|
|
8204
|
+
!util.isNil(lineWidth)
|
|
8205
|
+
: text;
|
|
8168
8206
|
};
|
|
8169
8207
|
TextUpdater.prototype.update = function (parsedStyle, object) {
|
|
8170
8208
|
var _a, _b;
|
|
8171
|
-
var text = parsedStyle.text,
|
|
8209
|
+
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;
|
|
8172
8210
|
if (!this.isReadyToMeasure(parsedStyle, object)) {
|
|
8173
8211
|
parsedStyle.metrics = {
|
|
8174
8212
|
font: '',
|
|
@@ -8240,6 +8278,20 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8240
8278
|
return TextUpdater;
|
|
8241
8279
|
}());
|
|
8242
8280
|
|
|
8281
|
+
var GroupUpdater = /** @class */ (function () {
|
|
8282
|
+
function GroupUpdater() {
|
|
8283
|
+
}
|
|
8284
|
+
GroupUpdater.prototype.update = function (parsedStyle, object) {
|
|
8285
|
+
return {
|
|
8286
|
+
cx: 0,
|
|
8287
|
+
cy: 0,
|
|
8288
|
+
hwidth: 0,
|
|
8289
|
+
hheight: 0,
|
|
8290
|
+
};
|
|
8291
|
+
};
|
|
8292
|
+
return GroupUpdater;
|
|
8293
|
+
}());
|
|
8294
|
+
|
|
8243
8295
|
function isFederatedEvent(value) {
|
|
8244
8296
|
return !!value.type;
|
|
8245
8297
|
}
|
|
@@ -8790,7 +8842,7 @@ var EventTarget = /** @class */ (function () {
|
|
|
8790
8842
|
var Node = /** @class */ (function (_super) {
|
|
8791
8843
|
tslib.__extends(Node, _super);
|
|
8792
8844
|
function Node() {
|
|
8793
|
-
var _this = _super.
|
|
8845
|
+
var _this = _super.call(this) || this;
|
|
8794
8846
|
_this.shadow = false;
|
|
8795
8847
|
/**
|
|
8796
8848
|
* points to canvas.document
|
|
@@ -10339,9 +10391,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10339
10391
|
*/
|
|
10340
10392
|
this.rotate = (function () {
|
|
10341
10393
|
var parentInvertRotation = glMatrix.quat.create();
|
|
10342
|
-
return function (element, degrees, y, z) {
|
|
10394
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10343
10395
|
if (y === void 0) { y = 0; }
|
|
10344
10396
|
if (z === void 0) { z = 0; }
|
|
10397
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10345
10398
|
if (typeof degrees === 'number') {
|
|
10346
10399
|
degrees = glMatrix.vec3.fromValues(degrees, y, z);
|
|
10347
10400
|
}
|
|
@@ -10360,7 +10413,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10360
10413
|
glMatrix.quat.multiply(rotation, parentInvertRotation, rotation);
|
|
10361
10414
|
glMatrix.quat.multiply(transform.localRotation, rotation, rot);
|
|
10362
10415
|
glMatrix.quat.normalize(transform.localRotation, transform.localRotation);
|
|
10363
|
-
|
|
10416
|
+
if (dirtify) {
|
|
10417
|
+
_this.dirtifyLocal(element, transform);
|
|
10418
|
+
}
|
|
10364
10419
|
}
|
|
10365
10420
|
};
|
|
10366
10421
|
})();
|
|
@@ -10370,16 +10425,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10370
10425
|
*/
|
|
10371
10426
|
this.rotateLocal = (function () {
|
|
10372
10427
|
var rotation = glMatrix.quat.create();
|
|
10373
|
-
return function (element, degrees, y, z) {
|
|
10428
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10374
10429
|
if (y === void 0) { y = 0; }
|
|
10375
10430
|
if (z === void 0) { z = 0; }
|
|
10431
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10376
10432
|
if (typeof degrees === 'number') {
|
|
10377
10433
|
degrees = glMatrix.vec3.fromValues(degrees, y, z);
|
|
10378
10434
|
}
|
|
10379
10435
|
var transform = element.transformable;
|
|
10380
10436
|
glMatrix.quat.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
|
|
10381
10437
|
glMatrix.quat.mul(transform.localRotation, transform.localRotation, rotation);
|
|
10382
|
-
|
|
10438
|
+
if (dirtify) {
|
|
10439
|
+
_this.dirtifyLocal(element, transform);
|
|
10440
|
+
}
|
|
10383
10441
|
};
|
|
10384
10442
|
})();
|
|
10385
10443
|
/**
|
|
@@ -10387,9 +10445,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10387
10445
|
*/
|
|
10388
10446
|
this.setEulerAngles = (function () {
|
|
10389
10447
|
var invParentRot = glMatrix.quat.create();
|
|
10390
|
-
return function (element, degrees, y, z) {
|
|
10448
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10391
10449
|
if (y === void 0) { y = 0; }
|
|
10392
10450
|
if (z === void 0) { z = 0; }
|
|
10451
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10393
10452
|
if (typeof degrees === 'number') {
|
|
10394
10453
|
degrees = glMatrix.vec3.fromValues(degrees, y, z);
|
|
10395
10454
|
}
|
|
@@ -10403,7 +10462,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10403
10462
|
var parentRotation = _this.getRotation(element.parentNode);
|
|
10404
10463
|
glMatrix.quat.copy(invParentRot, glMatrix.quat.invert(glMatrix.quat.create(), parentRotation));
|
|
10405
10464
|
glMatrix.quat.mul(transform.localRotation, transform.localRotation, invParentRot);
|
|
10406
|
-
|
|
10465
|
+
if (dirtify) {
|
|
10466
|
+
_this.dirtifyLocal(element, transform);
|
|
10467
|
+
}
|
|
10407
10468
|
}
|
|
10408
10469
|
};
|
|
10409
10470
|
})();
|
|
@@ -10417,9 +10478,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10417
10478
|
* ```
|
|
10418
10479
|
*/
|
|
10419
10480
|
this.translateLocal = (function () {
|
|
10420
|
-
return function (element, translation, y, z) {
|
|
10481
|
+
return function (element, translation, y, z, dirtify) {
|
|
10421
10482
|
if (y === void 0) { y = 0; }
|
|
10422
10483
|
if (z === void 0) { z = 0; }
|
|
10484
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10423
10485
|
if (typeof translation === 'number') {
|
|
10424
10486
|
translation = glMatrix.vec3.fromValues(translation, y, z);
|
|
10425
10487
|
}
|
|
@@ -10429,7 +10491,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10429
10491
|
}
|
|
10430
10492
|
glMatrix.vec3.transformQuat(translation, translation, transform.localRotation);
|
|
10431
10493
|
glMatrix.vec3.add(transform.localPosition, transform.localPosition, translation);
|
|
10432
|
-
|
|
10494
|
+
if (dirtify) {
|
|
10495
|
+
_this.dirtifyLocal(element, transform);
|
|
10496
|
+
}
|
|
10433
10497
|
};
|
|
10434
10498
|
})();
|
|
10435
10499
|
/**
|
|
@@ -10441,7 +10505,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10441
10505
|
this.setPosition = (function () {
|
|
10442
10506
|
var parentInvertMatrix = glMatrix.mat4.create();
|
|
10443
10507
|
var tmpPosition = glMatrix.vec3.create();
|
|
10444
|
-
return function (element, position) {
|
|
10508
|
+
return function (element, position, dirtify) {
|
|
10509
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10445
10510
|
var transform = element.transformable;
|
|
10446
10511
|
tmpPosition[0] = position[0];
|
|
10447
10512
|
tmpPosition[1] = position[1];
|
|
@@ -10460,7 +10525,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10460
10525
|
glMatrix.mat4.invert(parentInvertMatrix, parentInvertMatrix);
|
|
10461
10526
|
glMatrix.vec3.transformMat4(transform.localPosition, tmpPosition, parentInvertMatrix);
|
|
10462
10527
|
}
|
|
10463
|
-
|
|
10528
|
+
if (dirtify) {
|
|
10529
|
+
_this.dirtifyLocal(element, transform);
|
|
10530
|
+
}
|
|
10464
10531
|
};
|
|
10465
10532
|
})();
|
|
10466
10533
|
/**
|
|
@@ -10468,7 +10535,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10468
10535
|
*/
|
|
10469
10536
|
this.setLocalPosition = (function () {
|
|
10470
10537
|
var tmpPosition = glMatrix.vec3.create();
|
|
10471
|
-
return function (element, position) {
|
|
10538
|
+
return function (element, position, dirtify) {
|
|
10539
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10472
10540
|
var transform = element.transformable;
|
|
10473
10541
|
tmpPosition[0] = position[0];
|
|
10474
10542
|
tmpPosition[1] = position[1];
|
|
@@ -10477,7 +10545,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10477
10545
|
return;
|
|
10478
10546
|
}
|
|
10479
10547
|
glMatrix.vec3.copy(transform.localPosition, tmpPosition);
|
|
10480
|
-
|
|
10548
|
+
if (dirtify) {
|
|
10549
|
+
_this.dirtifyLocal(element, transform);
|
|
10550
|
+
}
|
|
10481
10551
|
};
|
|
10482
10552
|
})();
|
|
10483
10553
|
/**
|
|
@@ -10496,9 +10566,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10496
10566
|
var zeroVec3 = glMatrix.vec3.create();
|
|
10497
10567
|
var tmpVec3 = glMatrix.vec3.create();
|
|
10498
10568
|
var tr = glMatrix.vec3.create();
|
|
10499
|
-
return function (element, translation, y, z) {
|
|
10569
|
+
return function (element, translation, y, z, dirtify) {
|
|
10500
10570
|
if (y === void 0) { y = 0; }
|
|
10501
10571
|
if (z === void 0) { z = 0; }
|
|
10572
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10502
10573
|
if (typeof translation === 'number') {
|
|
10503
10574
|
translation = glMatrix.vec3.set(tmpVec3, translation, y, z);
|
|
10504
10575
|
}
|
|
@@ -10506,12 +10577,13 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10506
10577
|
return;
|
|
10507
10578
|
}
|
|
10508
10579
|
glMatrix.vec3.add(tr, _this.getPosition(element), translation);
|
|
10509
|
-
_this.setPosition(element, tr);
|
|
10580
|
+
_this.setPosition(element, tr, dirtify);
|
|
10510
10581
|
};
|
|
10511
10582
|
})();
|
|
10512
10583
|
this.setRotation = function () {
|
|
10513
10584
|
var parentInvertRotation = glMatrix.quat.create();
|
|
10514
|
-
return function (element, rotation, y, z, w) {
|
|
10585
|
+
return function (element, rotation, y, z, w, dirtify) {
|
|
10586
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10515
10587
|
var transform = element.transformable;
|
|
10516
10588
|
if (typeof rotation === 'number') {
|
|
10517
10589
|
rotation = glMatrix.quat.fromValues(rotation, y, z, w);
|
|
@@ -10526,7 +10598,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10526
10598
|
glMatrix.quat.invert(parentInvertRotation, parentInvertRotation);
|
|
10527
10599
|
glMatrix.quat.multiply(transform.localRotation, parentInvertRotation, rotation);
|
|
10528
10600
|
glMatrix.quat.normalize(transform.localRotation, transform.localRotation);
|
|
10529
|
-
|
|
10601
|
+
if (dirtify) {
|
|
10602
|
+
_this.dirtifyLocal(element, transform);
|
|
10603
|
+
}
|
|
10530
10604
|
}
|
|
10531
10605
|
};
|
|
10532
10606
|
};
|
|
@@ -10567,7 +10641,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10567
10641
|
// .filter((node) => !node.shadow);
|
|
10568
10642
|
};
|
|
10569
10643
|
DefaultSceneGraphService.prototype.attach = function (child, parent, index) {
|
|
10570
|
-
var _a
|
|
10644
|
+
var _a;
|
|
10571
10645
|
var detached = false;
|
|
10572
10646
|
if (child.parentNode) {
|
|
10573
10647
|
detached = child.parentNode !== parent;
|
|
@@ -10583,7 +10657,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10583
10657
|
// parent needs re-sort
|
|
10584
10658
|
var sortable = parent.sortable;
|
|
10585
10659
|
if (((_a = sortable === null || sortable === void 0 ? void 0 : sortable.sorted) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
10586
|
-
|
|
10660
|
+
child.parsedStyle.zIndex) {
|
|
10587
10661
|
if (sortable.dirtyChildren.indexOf(child) === -1) {
|
|
10588
10662
|
sortable.dirtyChildren.push(child);
|
|
10589
10663
|
}
|
|
@@ -10637,6 +10711,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10637
10711
|
}
|
|
10638
10712
|
};
|
|
10639
10713
|
DefaultSceneGraphService.prototype.getOrigin = function (element) {
|
|
10714
|
+
element.getGeometryBounds();
|
|
10640
10715
|
return element.transformable.origin;
|
|
10641
10716
|
};
|
|
10642
10717
|
/**
|
|
@@ -10668,40 +10743,52 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10668
10743
|
/**
|
|
10669
10744
|
* set euler angles(degrees) in local space
|
|
10670
10745
|
*/
|
|
10671
|
-
DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z) {
|
|
10746
|
+
DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z, dirtify) {
|
|
10672
10747
|
if (y === void 0) { y = 0; }
|
|
10673
10748
|
if (z === void 0) { z = 0; }
|
|
10749
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10674
10750
|
if (typeof degrees === 'number') {
|
|
10675
10751
|
degrees = glMatrix.vec3.fromValues(degrees, y, z);
|
|
10676
10752
|
}
|
|
10677
10753
|
var transform = element.transformable;
|
|
10678
10754
|
glMatrix.quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
10679
|
-
|
|
10755
|
+
if (dirtify) {
|
|
10756
|
+
this.dirtifyLocal(element, transform);
|
|
10757
|
+
}
|
|
10680
10758
|
};
|
|
10681
10759
|
/**
|
|
10682
10760
|
* scale in local space
|
|
10683
10761
|
*/
|
|
10684
|
-
DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling) {
|
|
10762
|
+
DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling, dirtify) {
|
|
10763
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10685
10764
|
var transform = element.transformable;
|
|
10686
10765
|
glMatrix.vec3.multiply(transform.localScale, transform.localScale, glMatrix.vec3.fromValues(scaling[0], scaling[1], scaling[2] || 1));
|
|
10687
|
-
|
|
10766
|
+
if (dirtify) {
|
|
10767
|
+
this.dirtifyLocal(element, transform);
|
|
10768
|
+
}
|
|
10688
10769
|
};
|
|
10689
|
-
DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling) {
|
|
10770
|
+
DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling, dirtify) {
|
|
10771
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10690
10772
|
var transform = element.transformable;
|
|
10691
10773
|
var updatedScaling = glMatrix.vec3.fromValues(scaling[0], scaling[1], scaling[2] || transform.localScale[2]);
|
|
10692
10774
|
if (glMatrix.vec3.equals(updatedScaling, transform.localScale)) {
|
|
10693
10775
|
return;
|
|
10694
10776
|
}
|
|
10695
10777
|
glMatrix.vec3.copy(transform.localScale, updatedScaling);
|
|
10696
|
-
|
|
10778
|
+
if (dirtify) {
|
|
10779
|
+
this.dirtifyLocal(element, transform);
|
|
10780
|
+
}
|
|
10697
10781
|
};
|
|
10698
|
-
DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w) {
|
|
10782
|
+
DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w, dirtify) {
|
|
10783
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10699
10784
|
if (typeof rotation === 'number') {
|
|
10700
10785
|
rotation = glMatrix.quat.fromValues(rotation, y, z, w);
|
|
10701
10786
|
}
|
|
10702
10787
|
var transform = element.transformable;
|
|
10703
10788
|
glMatrix.quat.copy(transform.localRotation, rotation);
|
|
10704
|
-
|
|
10789
|
+
if (dirtify) {
|
|
10790
|
+
this.dirtifyLocal(element, transform);
|
|
10791
|
+
}
|
|
10705
10792
|
};
|
|
10706
10793
|
DefaultSceneGraphService.prototype.setLocalSkew = function (element, skew, y) {
|
|
10707
10794
|
if (typeof skew === 'number') {
|
|
@@ -10865,9 +10952,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10865
10952
|
var t = glMatrix.mat4.getTranslation(glMatrix.vec3.create(), transform);
|
|
10866
10953
|
var r = glMatrix.mat4.getRotation(glMatrix.quat.create(), transform);
|
|
10867
10954
|
var s = glMatrix.mat4.getScaling(glMatrix.vec3.create(), transform);
|
|
10868
|
-
this.setLocalScale(element, s);
|
|
10869
|
-
this.setLocalPosition(element, t);
|
|
10870
|
-
this.setLocalRotation(element, r);
|
|
10955
|
+
this.setLocalScale(element, s, false);
|
|
10956
|
+
this.setLocalPosition(element, t, false);
|
|
10957
|
+
this.setLocalRotation(element, r, undefined, undefined, undefined, false);
|
|
10958
|
+
this.dirtifyLocal(element, element.transformable);
|
|
10871
10959
|
};
|
|
10872
10960
|
DefaultSceneGraphService.prototype.resetLocalTransform = function (element) {
|
|
10873
10961
|
this.setLocalScale(element, [1, 1, 1]);
|
|
@@ -10893,6 +10981,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10893
10981
|
DefaultSceneGraphService.prototype.getGeometryBounds = function (element, render) {
|
|
10894
10982
|
if (render === void 0) { render = false; }
|
|
10895
10983
|
var geometry = element.geometry;
|
|
10984
|
+
if (geometry.dirty) {
|
|
10985
|
+
runtime.styleValueRegistry.updateGeometry(element);
|
|
10986
|
+
}
|
|
10896
10987
|
var bounds = render
|
|
10897
10988
|
? geometry.renderBounds
|
|
10898
10989
|
: geometry.contentBounds || null;
|
|
@@ -11215,13 +11306,13 @@ var TextService = /** @class */ (function () {
|
|
|
11215
11306
|
return properties;
|
|
11216
11307
|
};
|
|
11217
11308
|
TextService.prototype.measureText = function (text, parsedStyle, offscreenCanvas) {
|
|
11218
|
-
var
|
|
11309
|
+
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;
|
|
11219
11310
|
var // dropShadow = 0,
|
|
11220
11311
|
// dropShadowDistance = 0,
|
|
11221
|
-
|
|
11312
|
+
_g = parsedStyle.leading,
|
|
11222
11313
|
// dropShadow = 0,
|
|
11223
11314
|
// dropShadowDistance = 0,
|
|
11224
|
-
leading =
|
|
11315
|
+
leading = _g === void 0 ? 0 : _g;
|
|
11225
11316
|
var font = toFontString(parsedStyle);
|
|
11226
11317
|
// if (runtime.enableCSSParsing) {
|
|
11227
11318
|
var fontProperties = this.measureFont(font, offscreenCanvas);
|
|
@@ -11333,7 +11424,7 @@ var TextService = /** @class */ (function () {
|
|
|
11333
11424
|
TextService.prototype.setGraphemeOnPath = function () { };
|
|
11334
11425
|
TextService.prototype.wordWrap = function (text, parsedStyle, offscreenCanvas) {
|
|
11335
11426
|
var _this = this;
|
|
11336
|
-
var _a = parsedStyle.wordWrapWidth, wordWrapWidth = _a === void 0 ? 0 : _a,
|
|
11427
|
+
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;
|
|
11337
11428
|
var context = this.runtime.offscreenCanvasCreator.getOrCreateContext(offscreenCanvas);
|
|
11338
11429
|
var maxWidth = wordWrapWidth + letterSpacing;
|
|
11339
11430
|
var ellipsis = '';
|
|
@@ -11483,7 +11574,7 @@ var geometryUpdaterFactory = (function () {
|
|
|
11483
11574
|
_a[exports.Shape.ELLIPSE] = new EllipseUpdater(),
|
|
11484
11575
|
_a[exports.Shape.RECT] = rectUpdater,
|
|
11485
11576
|
_a[exports.Shape.IMAGE] = rectUpdater,
|
|
11486
|
-
_a[exports.Shape.GROUP] =
|
|
11577
|
+
_a[exports.Shape.GROUP] = new GroupUpdater(),
|
|
11487
11578
|
_a[exports.Shape.LINE] = new LineUpdater(),
|
|
11488
11579
|
_a[exports.Shape.TEXT] = new TextUpdater(runtime),
|
|
11489
11580
|
_a[exports.Shape.POLYLINE] = polylineUpdater,
|
|
@@ -11560,6 +11651,7 @@ runtime.globalThis = getGlobalThis();
|
|
|
11560
11651
|
runtime.enableCSSParsing = true;
|
|
11561
11652
|
runtime.enableDataset = false;
|
|
11562
11653
|
runtime.enableStyleSyntax = true;
|
|
11654
|
+
runtime.enableAttributeDashCased = false;
|
|
11563
11655
|
|
|
11564
11656
|
var entityCounter = 0;
|
|
11565
11657
|
function resetEntityCounter() {
|
|
@@ -11577,7 +11669,7 @@ var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
|
|
|
11577
11669
|
var Element = /** @class */ (function (_super) {
|
|
11578
11670
|
tslib.__extends(Element, _super);
|
|
11579
11671
|
function Element() {
|
|
11580
|
-
var _this = _super.
|
|
11672
|
+
var _this = _super.call(this) || this;
|
|
11581
11673
|
/**
|
|
11582
11674
|
* Unique id.
|
|
11583
11675
|
*/
|
|
@@ -11621,6 +11713,7 @@ var Element = /** @class */ (function (_super) {
|
|
|
11621
11713
|
_this.geometry = {
|
|
11622
11714
|
contentBounds: undefined,
|
|
11623
11715
|
renderBounds: undefined,
|
|
11716
|
+
dirty: true,
|
|
11624
11717
|
};
|
|
11625
11718
|
_this.rBushNode = {
|
|
11626
11719
|
aabb: undefined,
|
|
@@ -11805,7 +11898,7 @@ var Element = /** @class */ (function (_super) {
|
|
|
11805
11898
|
this.ownerDocument.defaultView.mountChildren(child);
|
|
11806
11899
|
}
|
|
11807
11900
|
// @ts-ignore
|
|
11808
|
-
if (
|
|
11901
|
+
if (this.isMutationObserved) {
|
|
11809
11902
|
insertedEvent.relatedNode = this;
|
|
11810
11903
|
child.dispatchEvent(insertedEvent);
|
|
11811
11904
|
}
|
|
@@ -12081,8 +12174,10 @@ var Element = /** @class */ (function (_super) {
|
|
|
12081
12174
|
}
|
|
12082
12175
|
var value = this.attributes[name];
|
|
12083
12176
|
if (value === undefined) {
|
|
12084
|
-
|
|
12085
|
-
|
|
12177
|
+
if (runtime.enableAttributeDashCased) {
|
|
12178
|
+
var attributeName = formatAttributeName(name);
|
|
12179
|
+
value = this.attributes[attributeName];
|
|
12180
|
+
}
|
|
12086
12181
|
// if the given attribute does not exist, the value returned will either be null or ""
|
|
12087
12182
|
return runtime.enableCSSParsing ? (util.isNil(value) ? null : value) : value;
|
|
12088
12183
|
}
|
|
@@ -12152,6 +12247,9 @@ var Element = /** @class */ (function (_super) {
|
|
|
12152
12247
|
function isDisplayObject(value) {
|
|
12153
12248
|
return !!(value === null || value === void 0 ? void 0 : value.nodeName);
|
|
12154
12249
|
}
|
|
12250
|
+
var Proxy = runtime.globalThis.Proxy
|
|
12251
|
+
? runtime.globalThis.Proxy
|
|
12252
|
+
: function () { };
|
|
12155
12253
|
var mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
|
|
12156
12254
|
var DEFAULT_STYLE_PROPS = {
|
|
12157
12255
|
opacity: '',
|
|
@@ -12188,7 +12286,20 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
12188
12286
|
shadowType: 'outer',
|
|
12189
12287
|
miterLimit: 10,
|
|
12190
12288
|
};
|
|
12191
|
-
|
|
12289
|
+
// const DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = {
|
|
12290
|
+
// ...DEFAULT_PARSED_STYLE_PROPS,
|
|
12291
|
+
// opacity: 1,
|
|
12292
|
+
// fillOpacity: 1,
|
|
12293
|
+
// strokeOpacity: 1,
|
|
12294
|
+
// visibility: 'visible',
|
|
12295
|
+
// pointerEvents: 'auto',
|
|
12296
|
+
// lineWidth: 1,
|
|
12297
|
+
// lineCap: 'butt',
|
|
12298
|
+
// lineJoin: 'miter',
|
|
12299
|
+
// increasedLineWidthForHitTesting: 0,
|
|
12300
|
+
// fillRule: 'nonzero',
|
|
12301
|
+
// // TODO: transformOrigin
|
|
12302
|
+
// };
|
|
12192
12303
|
var INHERITABLE_BASE_STYLE_PROPS = [
|
|
12193
12304
|
'opacity',
|
|
12194
12305
|
'fillOpacity',
|
|
@@ -12240,18 +12351,9 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12240
12351
|
* push to active animations after calling `animate()`
|
|
12241
12352
|
*/
|
|
12242
12353
|
_this.activeAnimations = [];
|
|
12243
|
-
/**
|
|
12244
|
-
* Use `this.style.clipPath` instead.
|
|
12245
|
-
* @deprecated
|
|
12246
|
-
*/
|
|
12247
|
-
_this.getClip = function () {
|
|
12248
|
-
return this.style.clipPath || null;
|
|
12249
|
-
};
|
|
12250
12354
|
// assign name, id to config
|
|
12251
12355
|
// eg. group.get('name')
|
|
12252
12356
|
_this.config = config;
|
|
12253
|
-
// compatible with G 3.0
|
|
12254
|
-
// this.config.interactive = this.config.capture ?? this.config.interactive;
|
|
12255
12357
|
// init scene graph node
|
|
12256
12358
|
_this.id = _this.config.id || '';
|
|
12257
12359
|
_this.name = _this.config.name || '';
|
|
@@ -12259,35 +12361,17 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12259
12361
|
_this.className = _this.config.className || _this.config.class;
|
|
12260
12362
|
}
|
|
12261
12363
|
_this.nodeName = _this.config.type || exports.Shape.GROUP;
|
|
12262
|
-
// // compatible with G 3.0
|
|
12263
|
-
// this.config.style =
|
|
12264
|
-
// this.config.style || this.config.attrs || ({} as StyleProps);
|
|
12265
|
-
// // Object.assign(this.config.style, this.config.attrs);
|
|
12266
|
-
// // this.config.style = {
|
|
12267
|
-
// // // ...DEFAULT_STYLE_PROPS,
|
|
12268
|
-
// // ...this.config.style,
|
|
12269
|
-
// // ...this.config.attrs,
|
|
12270
|
-
// // };
|
|
12271
|
-
// if (this.config.visible != null) {
|
|
12272
|
-
// this.config.style.visibility =
|
|
12273
|
-
// this.config.visible === false ? 'hidden' : 'visible';
|
|
12274
|
-
// }
|
|
12275
|
-
// if (this.config.interactive != null) {
|
|
12276
|
-
// this.config.style.pointerEvents =
|
|
12277
|
-
// this.config.interactive === false ? 'none' : 'auto';
|
|
12278
|
-
// }
|
|
12279
|
-
// merge parsed value
|
|
12280
|
-
Object.assign(_this.parsedStyle, runtime.enableCSSParsing
|
|
12281
|
-
? DEFAULT_PARSED_STYLE_PROPS
|
|
12282
|
-
: DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED, _this.config.initialParsedStyle);
|
|
12283
12364
|
if (runtime.enableCSSParsing) {
|
|
12284
12365
|
Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
|
|
12366
|
+
Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
|
|
12367
|
+
}
|
|
12368
|
+
else if (_this.config.initialParsedStyle) {
|
|
12369
|
+
Object.assign(_this.parsedStyle,
|
|
12370
|
+
// DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED,
|
|
12371
|
+
_this.config.initialParsedStyle);
|
|
12285
12372
|
}
|
|
12286
12373
|
// start to process attributes
|
|
12287
12374
|
_this.initAttributes(_this.config.style);
|
|
12288
|
-
var Proxy = runtime.globalThis.Proxy
|
|
12289
|
-
? runtime.globalThis.Proxy
|
|
12290
|
-
: function () { };
|
|
12291
12375
|
if (runtime.enableDataset) {
|
|
12292
12376
|
_this.dataset = new Proxy({}, {
|
|
12293
12377
|
get: function (target, name) {
|
|
@@ -12405,10 +12489,14 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12405
12489
|
options.usedAttributes = INHERITABLE_STYLE_PROPS;
|
|
12406
12490
|
}
|
|
12407
12491
|
// account for FCP, process properties as less as possible
|
|
12408
|
-
var formattedAttributes =
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
formattedAttributes
|
|
12492
|
+
var formattedAttributes = attributes;
|
|
12493
|
+
if (runtime.enableAttributeDashCased) {
|
|
12494
|
+
// @ts-ignore
|
|
12495
|
+
formattedAttributes = {};
|
|
12496
|
+
for (var name_1 in attributes) {
|
|
12497
|
+
var attributeName = formatAttributeName(name_1);
|
|
12498
|
+
formattedAttributes[attributeName] = attributes[name_1];
|
|
12499
|
+
}
|
|
12412
12500
|
}
|
|
12413
12501
|
runtime.styleValueRegistry.processProperties(this, formattedAttributes, options);
|
|
12414
12502
|
// redraw at next frame
|
|
@@ -12417,14 +12505,16 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12417
12505
|
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12418
12506
|
if (force === void 0) { force = false; }
|
|
12419
12507
|
if (memoize === void 0) { memoize = true; }
|
|
12420
|
-
|
|
12508
|
+
if (runtime.enableAttributeDashCased) {
|
|
12509
|
+
name = formatAttributeName(name);
|
|
12510
|
+
}
|
|
12421
12511
|
// ignore undefined value
|
|
12422
12512
|
if (util.isUndefined(value)) {
|
|
12423
12513
|
return;
|
|
12424
12514
|
}
|
|
12425
|
-
if (force || value !== this.attributes[
|
|
12426
|
-
this.internalSetAttribute(
|
|
12427
|
-
_super.prototype.setAttribute.call(this,
|
|
12515
|
+
if (force || value !== this.attributes[name]) {
|
|
12516
|
+
this.internalSetAttribute(name, value, { memoize: memoize });
|
|
12517
|
+
_super.prototype.setAttribute.call(this, name, value);
|
|
12428
12518
|
}
|
|
12429
12519
|
};
|
|
12430
12520
|
/**
|
|
@@ -12678,8 +12768,10 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12678
12768
|
* shortcut for Used value of `visibility`
|
|
12679
12769
|
*/
|
|
12680
12770
|
DisplayObject.prototype.isVisible = function () {
|
|
12681
|
-
var _a;
|
|
12682
|
-
return
|
|
12771
|
+
var _a, _b;
|
|
12772
|
+
return runtime.enableCSSParsing
|
|
12773
|
+
? ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible'
|
|
12774
|
+
: ((_b = this.parsedStyle) === null || _b === void 0 ? void 0 : _b.visibility) !== 'hidden';
|
|
12683
12775
|
};
|
|
12684
12776
|
Object.defineProperty(DisplayObject.prototype, "interactive", {
|
|
12685
12777
|
get: function () {
|
|
@@ -12871,13 +12963,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12871
12963
|
DisplayObject.prototype.add = function (child, index) {
|
|
12872
12964
|
return this.appendChild(child, index);
|
|
12873
12965
|
};
|
|
12874
|
-
/**
|
|
12875
|
-
* Use `this.style.clipPath` instead.
|
|
12876
|
-
* @deprecated
|
|
12877
|
-
*/
|
|
12878
|
-
DisplayObject.prototype.setClip = function (clipPath) {
|
|
12879
|
-
this.style.clipPath = clipPath;
|
|
12880
|
-
};
|
|
12881
12966
|
/**
|
|
12882
12967
|
* @deprecated
|
|
12883
12968
|
*/
|
|
@@ -12922,124 +13007,11 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12922
13007
|
return DisplayObject;
|
|
12923
13008
|
}(Element));
|
|
12924
13009
|
|
|
12925
|
-
/**
|
|
12926
|
-
* holds useful CSS-related methods.
|
|
12927
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
12928
|
-
*
|
|
12929
|
-
* * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
|
|
12930
|
-
* * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
12931
|
-
* * CSS Layout API
|
|
12932
|
-
*/
|
|
12933
|
-
var CSS = {
|
|
12934
|
-
/**
|
|
12935
|
-
* <number>
|
|
12936
|
-
* @see https://drafts.csswg.org/css-values-4/#number-value
|
|
12937
|
-
*/
|
|
12938
|
-
number: function (n) {
|
|
12939
|
-
return new CSSUnitValue(n);
|
|
12940
|
-
},
|
|
12941
|
-
/**
|
|
12942
|
-
* <percentage>
|
|
12943
|
-
* @see https://drafts.csswg.org/css-values-4/#percentage-value
|
|
12944
|
-
*/
|
|
12945
|
-
percent: function (n) {
|
|
12946
|
-
return new CSSUnitValue(n, '%');
|
|
12947
|
-
},
|
|
12948
|
-
/**
|
|
12949
|
-
* <length>
|
|
12950
|
-
*/
|
|
12951
|
-
px: function (n) {
|
|
12952
|
-
return new CSSUnitValue(n, 'px');
|
|
12953
|
-
},
|
|
12954
|
-
/**
|
|
12955
|
-
* <length>
|
|
12956
|
-
*/
|
|
12957
|
-
em: function (n) {
|
|
12958
|
-
return new CSSUnitValue(n, 'em');
|
|
12959
|
-
},
|
|
12960
|
-
rem: function (n) {
|
|
12961
|
-
return new CSSUnitValue(n, 'rem');
|
|
12962
|
-
},
|
|
12963
|
-
/**
|
|
12964
|
-
* <angle>
|
|
12965
|
-
*/
|
|
12966
|
-
deg: function (n) {
|
|
12967
|
-
return new CSSUnitValue(n, 'deg');
|
|
12968
|
-
},
|
|
12969
|
-
/**
|
|
12970
|
-
* <angle>
|
|
12971
|
-
*/
|
|
12972
|
-
grad: function (n) {
|
|
12973
|
-
return new CSSUnitValue(n, 'grad');
|
|
12974
|
-
},
|
|
12975
|
-
/**
|
|
12976
|
-
* <angle>
|
|
12977
|
-
*/
|
|
12978
|
-
rad: function (n) {
|
|
12979
|
-
return new CSSUnitValue(n, 'rad');
|
|
12980
|
-
},
|
|
12981
|
-
/**
|
|
12982
|
-
* <angle>
|
|
12983
|
-
*/
|
|
12984
|
-
turn: function (n) {
|
|
12985
|
-
return new CSSUnitValue(n, 'turn');
|
|
12986
|
-
},
|
|
12987
|
-
/**
|
|
12988
|
-
* <time>
|
|
12989
|
-
*/
|
|
12990
|
-
s: function (n) {
|
|
12991
|
-
return new CSSUnitValue(n, 's');
|
|
12992
|
-
},
|
|
12993
|
-
/**
|
|
12994
|
-
* <time>
|
|
12995
|
-
*/
|
|
12996
|
-
ms: function (n) {
|
|
12997
|
-
return new CSSUnitValue(n, 'ms');
|
|
12998
|
-
},
|
|
12999
|
-
/**
|
|
13000
|
-
* CSS Properties & Values API
|
|
13001
|
-
*
|
|
13002
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
|
|
13003
|
-
* @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
|
|
13004
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13005
|
-
*/
|
|
13006
|
-
registerProperty: function (definition) {
|
|
13007
|
-
var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
|
|
13008
|
-
runtime.styleValueRegistry.registerMetadata({
|
|
13009
|
-
n: name,
|
|
13010
|
-
inh: inherits,
|
|
13011
|
-
int: interpolable,
|
|
13012
|
-
d: initialValue,
|
|
13013
|
-
syntax: syntax,
|
|
13014
|
-
});
|
|
13015
|
-
},
|
|
13016
|
-
/**
|
|
13017
|
-
* CSS Layout API
|
|
13018
|
-
* register layout
|
|
13019
|
-
*
|
|
13020
|
-
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
13021
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
13022
|
-
*/
|
|
13023
|
-
registerLayout: function (name, clazz) {
|
|
13024
|
-
runtime.layoutRegistry.registerLayout(name, clazz);
|
|
13025
|
-
},
|
|
13026
|
-
};
|
|
13027
|
-
|
|
13028
13010
|
var Circle = /** @class */ (function (_super) {
|
|
13029
13011
|
tslib.__extends(Circle, _super);
|
|
13030
|
-
|
|
13031
|
-
|
|
13032
|
-
|
|
13033
|
-
// }
|
|
13034
|
-
function Circle(_a) {
|
|
13035
|
-
if (_a === void 0) { _a = {}; }
|
|
13036
|
-
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13037
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE, style: runtime.enableCSSParsing
|
|
13038
|
-
? tslib.__assign({ cx: '', cy: '', r: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
|
|
13039
|
-
transformOrigin: runtime.enableCSSParsing
|
|
13040
|
-
? null
|
|
13041
|
-
: [PECENTAGE_50, PECENTAGE_50],
|
|
13042
|
-
} }, rest)) || this;
|
|
13012
|
+
function Circle(options) {
|
|
13013
|
+
if (options === void 0) { options = {}; }
|
|
13014
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE }, options)) || this;
|
|
13043
13015
|
}
|
|
13044
13016
|
return Circle;
|
|
13045
13017
|
}(DisplayObject));
|
|
@@ -13068,15 +13040,9 @@ var CustomElement = /** @class */ (function (_super) {
|
|
|
13068
13040
|
|
|
13069
13041
|
var Ellipse = /** @class */ (function (_super) {
|
|
13070
13042
|
tslib.__extends(Ellipse, _super);
|
|
13071
|
-
function Ellipse(
|
|
13072
|
-
if (
|
|
13073
|
-
|
|
13074
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE, style: runtime.enableCSSParsing
|
|
13075
|
-
? tslib.__assign({ cx: '', cy: '', rx: '', ry: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
|
|
13076
|
-
transformOrigin: runtime.enableCSSParsing
|
|
13077
|
-
? null
|
|
13078
|
-
: [PECENTAGE_50, PECENTAGE_50],
|
|
13079
|
-
} }, rest)) || this;
|
|
13043
|
+
function Ellipse(options) {
|
|
13044
|
+
if (options === void 0) { options = {}; }
|
|
13045
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE }, options)) || this;
|
|
13080
13046
|
}
|
|
13081
13047
|
return Ellipse;
|
|
13082
13048
|
}(DisplayObject));
|
|
@@ -13093,11 +13059,9 @@ var Ellipse = /** @class */ (function (_super) {
|
|
|
13093
13059
|
*/
|
|
13094
13060
|
var Group = /** @class */ (function (_super) {
|
|
13095
13061
|
tslib.__extends(Group, _super);
|
|
13096
|
-
function Group(
|
|
13097
|
-
if (
|
|
13098
|
-
|
|
13099
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.GROUP, style: runtime.enableCSSParsing
|
|
13100
|
-
? tslib.__assign({ width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
13062
|
+
function Group(options) {
|
|
13063
|
+
if (options === void 0) { options = {}; }
|
|
13064
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.GROUP }, options)) || this;
|
|
13101
13065
|
}
|
|
13102
13066
|
return Group;
|
|
13103
13067
|
}(DisplayObject));
|
|
@@ -13170,11 +13134,9 @@ var HTML = /** @class */ (function (_super) {
|
|
|
13170
13134
|
|
|
13171
13135
|
var Image = /** @class */ (function (_super) {
|
|
13172
13136
|
tslib.__extends(Image, _super);
|
|
13173
|
-
function Image(
|
|
13174
|
-
if (
|
|
13175
|
-
|
|
13176
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.IMAGE, style: runtime.enableCSSParsing
|
|
13177
|
-
? tslib.__assign({ x: '', y: '', img: '', width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
13137
|
+
function Image(options) {
|
|
13138
|
+
if (options === void 0) { options = {}; }
|
|
13139
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.IMAGE }, options)) || this;
|
|
13178
13140
|
}
|
|
13179
13141
|
return Image;
|
|
13180
13142
|
}(DisplayObject));
|
|
@@ -13303,11 +13265,11 @@ var Path = /** @class */ (function (_super) {
|
|
|
13303
13265
|
var _this = this;
|
|
13304
13266
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13305
13267
|
_this = _super.call(this, tslib.__assign({ type: exports.Shape.PATH, style: runtime.enableCSSParsing
|
|
13306
|
-
? tslib.__assign({
|
|
13268
|
+
? tslib.__assign({ d: '', miterLimit: '' }, style) : tslib.__assign({}, style), initialParsedStyle: runtime.enableCSSParsing
|
|
13307
13269
|
? null
|
|
13308
13270
|
: {
|
|
13309
13271
|
miterLimit: 4,
|
|
13310
|
-
|
|
13272
|
+
d: tslib.__assign({}, EMPTY_PARSED_PATH),
|
|
13311
13273
|
} }, rest)) || this;
|
|
13312
13274
|
_this.markerStartAngle = 0;
|
|
13313
13275
|
_this.markerEndAngle = 0;
|
|
@@ -13332,7 +13294,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13332
13294
|
return _this;
|
|
13333
13295
|
}
|
|
13334
13296
|
Path.prototype.attributeChangedCallback = function (attrName, oldValue, newValue, prevParsedValue, newParsedValue) {
|
|
13335
|
-
if (attrName === '
|
|
13297
|
+
if (attrName === 'd') {
|
|
13336
13298
|
// recalc markers
|
|
13337
13299
|
this.transformMarker(true);
|
|
13338
13300
|
this.transformMarker(false);
|
|
@@ -13407,7 +13369,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13407
13369
|
marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
|
|
13408
13370
|
};
|
|
13409
13371
|
Path.prototype.placeMarkerMid = function (marker) {
|
|
13410
|
-
var segments = this.parsedStyle.
|
|
13372
|
+
var segments = this.parsedStyle.d.segments;
|
|
13411
13373
|
// clear all existed markers
|
|
13412
13374
|
this.markerMidList.forEach(function (marker) {
|
|
13413
13375
|
marker.remove();
|
|
@@ -13436,7 +13398,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13436
13398
|
*/
|
|
13437
13399
|
Path.prototype.getPointAtLength = function (distance, inWorldSpace) {
|
|
13438
13400
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
13439
|
-
var absolutePath = this.parsedStyle.
|
|
13401
|
+
var absolutePath = this.parsedStyle.d.absolutePath;
|
|
13440
13402
|
var _a = util.getPointAtLength(absolutePath, distance), x = _a.x, y = _a.y;
|
|
13441
13403
|
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
|
|
13442
13404
|
// apply local transformation
|
|
@@ -13453,7 +13415,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13453
13415
|
* Get start tangent vector
|
|
13454
13416
|
*/
|
|
13455
13417
|
Path.prototype.getStartTangent = function () {
|
|
13456
|
-
var segments = this.parsedStyle.
|
|
13418
|
+
var segments = this.parsedStyle.d.segments;
|
|
13457
13419
|
var result = [];
|
|
13458
13420
|
if (segments.length > 1) {
|
|
13459
13421
|
var startPoint = segments[0].currentPoint;
|
|
@@ -13475,7 +13437,7 @@ var Path = /** @class */ (function (_super) {
|
|
|
13475
13437
|
* Get end tangent vector
|
|
13476
13438
|
*/
|
|
13477
13439
|
Path.prototype.getEndTangent = function () {
|
|
13478
|
-
var segments = this.parsedStyle.
|
|
13440
|
+
var segments = this.parsedStyle.d.segments;
|
|
13479
13441
|
var length = segments.length;
|
|
13480
13442
|
var result = [];
|
|
13481
13443
|
if (length > 1) {
|
|
@@ -13663,7 +13625,7 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13663
13625
|
} }, rest)) || this;
|
|
13664
13626
|
}
|
|
13665
13627
|
Polyline.prototype.getTotalLength = function () {
|
|
13666
|
-
return this
|
|
13628
|
+
return getOrCalculatePolylineTotalLength(this);
|
|
13667
13629
|
};
|
|
13668
13630
|
Polyline.prototype.getPointAtLength = function (distance, inWorldSpace) {
|
|
13669
13631
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
@@ -13671,16 +13633,34 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13671
13633
|
};
|
|
13672
13634
|
Polyline.prototype.getPoint = function (ratio, inWorldSpace) {
|
|
13673
13635
|
if (inWorldSpace === void 0) { inWorldSpace = false; }
|
|
13674
|
-
var
|
|
13636
|
+
var points = this.parsedStyle.points.points;
|
|
13637
|
+
if (this.parsedStyle.points.segments.length === 0) {
|
|
13638
|
+
var segments_1 = [];
|
|
13639
|
+
var tempLength_1 = 0;
|
|
13640
|
+
var segmentT_1;
|
|
13641
|
+
var segmentL_1;
|
|
13642
|
+
var totalLength_1 = this.getTotalLength();
|
|
13643
|
+
points.forEach(function (p, i) {
|
|
13644
|
+
if (points[i + 1]) {
|
|
13645
|
+
segmentT_1 = [0, 0];
|
|
13646
|
+
segmentT_1[0] = tempLength_1 / totalLength_1;
|
|
13647
|
+
segmentL_1 = gMath.lineLength(p[0], p[1], points[i + 1][0], points[i + 1][1]);
|
|
13648
|
+
tempLength_1 += segmentL_1;
|
|
13649
|
+
segmentT_1[1] = tempLength_1 / totalLength_1;
|
|
13650
|
+
segments_1.push(segmentT_1);
|
|
13651
|
+
}
|
|
13652
|
+
});
|
|
13653
|
+
this.parsedStyle.points.segments = segments_1;
|
|
13654
|
+
}
|
|
13675
13655
|
var subt = 0;
|
|
13676
13656
|
var index = 0;
|
|
13677
|
-
segments.forEach(function (v, i) {
|
|
13657
|
+
this.parsedStyle.points.segments.forEach(function (v, i) {
|
|
13678
13658
|
if (ratio >= v[0] && ratio <= v[1]) {
|
|
13679
13659
|
subt = (ratio - v[0]) / (v[1] - v[0]);
|
|
13680
13660
|
index = i;
|
|
13681
13661
|
}
|
|
13682
13662
|
});
|
|
13683
|
-
var
|
|
13663
|
+
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;
|
|
13684
13664
|
var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
|
|
13685
13665
|
// apply local transformation
|
|
13686
13666
|
return new Point(transformed[0], transformed[1]);
|
|
@@ -13705,11 +13685,9 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13705
13685
|
|
|
13706
13686
|
var Rect = /** @class */ (function (_super) {
|
|
13707
13687
|
tslib.__extends(Rect, _super);
|
|
13708
|
-
function Rect(
|
|
13709
|
-
if (
|
|
13710
|
-
|
|
13711
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.RECT, style: runtime.enableCSSParsing
|
|
13712
|
-
? tslib.__assign({ x: '', y: '', width: '', height: '', radius: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
13688
|
+
function Rect(options) {
|
|
13689
|
+
if (options === void 0) { options = {}; }
|
|
13690
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.RECT }, options)) || this;
|
|
13713
13691
|
}
|
|
13714
13692
|
return Rect;
|
|
13715
13693
|
}(DisplayObject));
|
|
@@ -13731,26 +13709,7 @@ var Text = /** @class */ (function (_super) {
|
|
|
13731
13709
|
return _super.call(this, tslib.__assign({ type: exports.Shape.TEXT, style: runtime.enableCSSParsing
|
|
13732
13710
|
? tslib.__assign({ x: '', y: '', text: '', fontSize: '', fontFamily: '', fontStyle: '', fontWeight: '', fontVariant: '', textAlign: '', textBaseline: '', textTransform: '', fill: 'black', letterSpacing: '', lineHeight: '', miterLimit: '',
|
|
13733
13711
|
// whiteSpace: 'pre',
|
|
13734
|
-
wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : tslib.__assign({ fill: 'black' }, style),
|
|
13735
|
-
? {}
|
|
13736
|
-
: {
|
|
13737
|
-
x: 0,
|
|
13738
|
-
y: 0,
|
|
13739
|
-
fontSize: 16,
|
|
13740
|
-
fontFamily: 'sans-serif',
|
|
13741
|
-
fontStyle: 'normal',
|
|
13742
|
-
fontWeight: 'normal',
|
|
13743
|
-
fontVariant: 'normal',
|
|
13744
|
-
lineHeight: 0,
|
|
13745
|
-
letterSpacing: 0,
|
|
13746
|
-
textBaseline: 'alphabetic',
|
|
13747
|
-
textAlign: 'start',
|
|
13748
|
-
wordWrap: false,
|
|
13749
|
-
wordWrapWidth: 0,
|
|
13750
|
-
leading: 0,
|
|
13751
|
-
dx: 0,
|
|
13752
|
-
dy: 0,
|
|
13753
|
-
} }, rest)) || this;
|
|
13712
|
+
wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : tslib.__assign({ fill: 'black' }, style) }, rest)) || this;
|
|
13754
13713
|
}
|
|
13755
13714
|
// lengthAdjust: SVGAnimatedEnumeration;
|
|
13756
13715
|
// textLength: SVGAnimatedLength;
|
|
@@ -13827,6 +13786,109 @@ var CustomElementRegistry = /** @class */ (function () {
|
|
|
13827
13786
|
return CustomElementRegistry;
|
|
13828
13787
|
}());
|
|
13829
13788
|
|
|
13789
|
+
/**
|
|
13790
|
+
* holds useful CSS-related methods.
|
|
13791
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
13792
|
+
*
|
|
13793
|
+
* * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
|
|
13794
|
+
* * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13795
|
+
* * CSS Layout API
|
|
13796
|
+
*/
|
|
13797
|
+
var CSS = {
|
|
13798
|
+
/**
|
|
13799
|
+
* <number>
|
|
13800
|
+
* @see https://drafts.csswg.org/css-values-4/#number-value
|
|
13801
|
+
*/
|
|
13802
|
+
number: function (n) {
|
|
13803
|
+
return new CSSUnitValue(n);
|
|
13804
|
+
},
|
|
13805
|
+
/**
|
|
13806
|
+
* <percentage>
|
|
13807
|
+
* @see https://drafts.csswg.org/css-values-4/#percentage-value
|
|
13808
|
+
*/
|
|
13809
|
+
percent: function (n) {
|
|
13810
|
+
return new CSSUnitValue(n, '%');
|
|
13811
|
+
},
|
|
13812
|
+
/**
|
|
13813
|
+
* <length>
|
|
13814
|
+
*/
|
|
13815
|
+
px: function (n) {
|
|
13816
|
+
return new CSSUnitValue(n, 'px');
|
|
13817
|
+
},
|
|
13818
|
+
/**
|
|
13819
|
+
* <length>
|
|
13820
|
+
*/
|
|
13821
|
+
em: function (n) {
|
|
13822
|
+
return new CSSUnitValue(n, 'em');
|
|
13823
|
+
},
|
|
13824
|
+
rem: function (n) {
|
|
13825
|
+
return new CSSUnitValue(n, 'rem');
|
|
13826
|
+
},
|
|
13827
|
+
/**
|
|
13828
|
+
* <angle>
|
|
13829
|
+
*/
|
|
13830
|
+
deg: function (n) {
|
|
13831
|
+
return new CSSUnitValue(n, 'deg');
|
|
13832
|
+
},
|
|
13833
|
+
/**
|
|
13834
|
+
* <angle>
|
|
13835
|
+
*/
|
|
13836
|
+
grad: function (n) {
|
|
13837
|
+
return new CSSUnitValue(n, 'grad');
|
|
13838
|
+
},
|
|
13839
|
+
/**
|
|
13840
|
+
* <angle>
|
|
13841
|
+
*/
|
|
13842
|
+
rad: function (n) {
|
|
13843
|
+
return new CSSUnitValue(n, 'rad');
|
|
13844
|
+
},
|
|
13845
|
+
/**
|
|
13846
|
+
* <angle>
|
|
13847
|
+
*/
|
|
13848
|
+
turn: function (n) {
|
|
13849
|
+
return new CSSUnitValue(n, 'turn');
|
|
13850
|
+
},
|
|
13851
|
+
/**
|
|
13852
|
+
* <time>
|
|
13853
|
+
*/
|
|
13854
|
+
s: function (n) {
|
|
13855
|
+
return new CSSUnitValue(n, 's');
|
|
13856
|
+
},
|
|
13857
|
+
/**
|
|
13858
|
+
* <time>
|
|
13859
|
+
*/
|
|
13860
|
+
ms: function (n) {
|
|
13861
|
+
return new CSSUnitValue(n, 'ms');
|
|
13862
|
+
},
|
|
13863
|
+
/**
|
|
13864
|
+
* CSS Properties & Values API
|
|
13865
|
+
*
|
|
13866
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
|
|
13867
|
+
* @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
|
|
13868
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13869
|
+
*/
|
|
13870
|
+
registerProperty: function (definition) {
|
|
13871
|
+
var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
|
|
13872
|
+
runtime.styleValueRegistry.registerMetadata({
|
|
13873
|
+
n: name,
|
|
13874
|
+
inh: inherits,
|
|
13875
|
+
int: interpolable,
|
|
13876
|
+
d: initialValue,
|
|
13877
|
+
syntax: syntax,
|
|
13878
|
+
});
|
|
13879
|
+
},
|
|
13880
|
+
/**
|
|
13881
|
+
* CSS Layout API
|
|
13882
|
+
* register layout
|
|
13883
|
+
*
|
|
13884
|
+
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
13885
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
13886
|
+
*/
|
|
13887
|
+
registerLayout: function (name, clazz) {
|
|
13888
|
+
runtime.layoutRegistry.registerLayout(name, clazz);
|
|
13889
|
+
},
|
|
13890
|
+
};
|
|
13891
|
+
|
|
13830
13892
|
/**
|
|
13831
13893
|
* the entry of DOM tree
|
|
13832
13894
|
* Document -> Node -> EventTarget
|
|
@@ -13938,7 +14000,7 @@ var Document = /** @class */ (function (_super) {
|
|
|
13938
14000
|
var hitTestList = [];
|
|
13939
14001
|
rBushNodes.forEach(function (_a) {
|
|
13940
14002
|
var displayObject = _a.displayObject;
|
|
13941
|
-
var
|
|
14003
|
+
var _b = displayObject.parsedStyle.pointerEvents, pointerEvents = _b === void 0 ? 'auto' : _b;
|
|
13942
14004
|
// account for `visibility`
|
|
13943
14005
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
13944
14006
|
var isVisibilityAffected = [
|
|
@@ -14667,11 +14729,13 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14667
14729
|
* sync to RBush later
|
|
14668
14730
|
*/
|
|
14669
14731
|
this.toSync = new Set();
|
|
14732
|
+
this.isFirstTimeRendering = true;
|
|
14733
|
+
this.syncing = false;
|
|
14734
|
+
this.isFirstTimeRenderingFinished = false;
|
|
14670
14735
|
}
|
|
14671
|
-
// private isFirstTimeRendering = true;
|
|
14672
|
-
// private syncing = false;
|
|
14673
14736
|
PrepareRendererPlugin.prototype.apply = function (context) {
|
|
14674
14737
|
var _this = this;
|
|
14738
|
+
var _a;
|
|
14675
14739
|
var renderingService = context.renderingService, renderingContext = context.renderingContext, rBushRoot = context.rBushRoot;
|
|
14676
14740
|
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
14677
14741
|
this.rBush = rBushRoot;
|
|
@@ -14730,26 +14794,28 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14730
14794
|
canvas.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
14731
14795
|
_this.toSync.clear();
|
|
14732
14796
|
});
|
|
14797
|
+
var ric = (_a = runtime.globalThis.requestIdleCallback) !== null && _a !== void 0 ? _a : raf.bind(runtime.globalThis);
|
|
14733
14798
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
// }
|
|
14799
|
+
if (_this.isFirstTimeRendering) {
|
|
14800
|
+
_this.isFirstTimeRendering = false;
|
|
14801
|
+
_this.syncing = true;
|
|
14802
|
+
ric(function () {
|
|
14803
|
+
_this.syncRTree(true);
|
|
14804
|
+
_this.isFirstTimeRenderingFinished = true;
|
|
14805
|
+
});
|
|
14806
|
+
}
|
|
14807
|
+
else {
|
|
14808
|
+
_this.syncRTree();
|
|
14809
|
+
}
|
|
14746
14810
|
});
|
|
14747
14811
|
};
|
|
14748
|
-
PrepareRendererPlugin.prototype.syncRTree = function () {
|
|
14749
|
-
// if (this.syncing) {
|
|
14750
|
-
// return;
|
|
14751
|
-
// }
|
|
14812
|
+
PrepareRendererPlugin.prototype.syncRTree = function (force) {
|
|
14752
14813
|
var _this = this;
|
|
14814
|
+
if (force === void 0) { force = false; }
|
|
14815
|
+
if (!force && (this.syncing || this.toSync.size === 0)) {
|
|
14816
|
+
return;
|
|
14817
|
+
}
|
|
14818
|
+
this.syncing = true;
|
|
14753
14819
|
// bounds changed, need re-inserting its children
|
|
14754
14820
|
var bulk = [];
|
|
14755
14821
|
Array.from(this.toSync)
|
|
@@ -14763,6 +14829,14 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14763
14829
|
}
|
|
14764
14830
|
var renderBounds = node.getRenderBounds();
|
|
14765
14831
|
if (renderBounds) {
|
|
14832
|
+
var renderable = node.renderable;
|
|
14833
|
+
if (force) {
|
|
14834
|
+
if (!renderable.dirtyRenderBounds) {
|
|
14835
|
+
renderable.dirtyRenderBounds = new AABB();
|
|
14836
|
+
}
|
|
14837
|
+
// save last dirty aabb
|
|
14838
|
+
renderable.dirtyRenderBounds.update(renderBounds.center, renderBounds.halfExtents);
|
|
14839
|
+
}
|
|
14766
14840
|
var _a = tslib.__read(renderBounds.getMin(), 2), minX = _a[0], minY = _a[1];
|
|
14767
14841
|
var _b = tslib.__read(renderBounds.getMax(), 2), maxX = _b[0], maxY = _b[1];
|
|
14768
14842
|
if (!rBushNode.aabb) {
|
|
@@ -14789,7 +14863,7 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14789
14863
|
this.rBush.load(bulk);
|
|
14790
14864
|
bulk.length = 0;
|
|
14791
14865
|
this.toSync.clear();
|
|
14792
|
-
|
|
14866
|
+
this.syncing = false;
|
|
14793
14867
|
};
|
|
14794
14868
|
PrepareRendererPlugin.tag = 'Prepare';
|
|
14795
14869
|
return PrepareRendererPlugin;
|
|
@@ -15330,6 +15404,7 @@ exports.FederatedPointerEvent = FederatedPointerEvent;
|
|
|
15330
15404
|
exports.FederatedWheelEvent = FederatedWheelEvent;
|
|
15331
15405
|
exports.Frustum = Frustum;
|
|
15332
15406
|
exports.Group = Group;
|
|
15407
|
+
exports.GroupUpdater = GroupUpdater;
|
|
15333
15408
|
exports.HTML = HTML;
|
|
15334
15409
|
exports.Image = Image;
|
|
15335
15410
|
exports.Line = Line;
|