@antv/g-lite 1.3.0-next.1 → 1.3.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/properties/CSSPropertyTransformOrigin.d.ts +3 -1
- package/dist/display-objects/Circle.d.ts +1 -1
- package/dist/display-objects/Ellipse.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 +494 -430
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +494 -429
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/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/utils/path.d.ts +1 -1
- package/package.json +1 -1
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
|
}
|
|
@@ -5979,7 +5977,7 @@ function convertKeyword2Percent(keyword) {
|
|
|
5979
5977
|
return '50%';
|
|
5980
5978
|
}
|
|
5981
5979
|
else if (keyword === 'left' || keyword === 'top') {
|
|
5982
|
-
return '0';
|
|
5980
|
+
return '0%';
|
|
5983
5981
|
}
|
|
5984
5982
|
else if (keyword === 'right' || keyword === 'bottom') {
|
|
5985
5983
|
return '100%';
|
|
@@ -6247,16 +6245,17 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6247
6245
|
{
|
|
6248
6246
|
n: 'transformOrigin',
|
|
6249
6247
|
p: 100,
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6248
|
+
d: '0 0',
|
|
6249
|
+
// // int: true,
|
|
6250
|
+
// d: (nodeName: string) => {
|
|
6251
|
+
// if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
6252
|
+
// return 'center';
|
|
6253
|
+
// }
|
|
6254
|
+
// if (nodeName === Shape.TEXT) {
|
|
6255
|
+
// return 'text-anchor';
|
|
6256
|
+
// }
|
|
6257
|
+
// return 'left top';
|
|
6258
|
+
// },
|
|
6260
6259
|
l: true,
|
|
6261
6260
|
syntax: exports.PropertySyntax.TRANSFORM_ORIGIN,
|
|
6262
6261
|
},
|
|
@@ -6566,7 +6565,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6566
6565
|
d: '0',
|
|
6567
6566
|
},
|
|
6568
6567
|
];
|
|
6569
|
-
|
|
6568
|
+
BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
|
|
6570
6569
|
var propertyMetadataCache = {};
|
|
6571
6570
|
var unresolvedProperties = new WeakMap();
|
|
6572
6571
|
// const uniqueAttributeSet = new Set<string>();
|
|
@@ -6623,20 +6622,20 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6623
6622
|
}; }
|
|
6624
6623
|
if (!this.runtime.enableCSSParsing) {
|
|
6625
6624
|
Object.assign(object.attributes, attributes);
|
|
6626
|
-
var
|
|
6625
|
+
var attributeNames = Object.keys(attributes);
|
|
6627
6626
|
// clipPath
|
|
6628
6627
|
var oldClipPath = object.parsedStyle.clipPath;
|
|
6629
6628
|
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
6630
6629
|
object.parsedStyle = Object.assign(object.parsedStyle, attributes);
|
|
6631
|
-
var
|
|
6632
|
-
if (!
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
}
|
|
6630
|
+
var needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
6631
|
+
// if (!needUpdateGeometry) {
|
|
6632
|
+
// for (let i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
|
|
6633
|
+
// if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
|
|
6634
|
+
// needUpdateGeometry = true;
|
|
6635
|
+
// break;
|
|
6636
|
+
// }
|
|
6637
|
+
// }
|
|
6638
|
+
// }
|
|
6640
6639
|
if (attributes.fill) {
|
|
6641
6640
|
object.parsedStyle.fill = parseColor(attributes.fill);
|
|
6642
6641
|
}
|
|
@@ -6719,95 +6718,98 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6719
6718
|
attributes.markerMid, null, null);
|
|
6720
6719
|
}
|
|
6721
6720
|
if (!util.isNil(attributes.zIndex)) {
|
|
6722
|
-
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object,
|
|
6721
|
+
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames);
|
|
6723
6722
|
}
|
|
6724
6723
|
if (!util.isNil(attributes.offsetDistance)) {
|
|
6725
|
-
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object,
|
|
6724
|
+
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames);
|
|
6726
6725
|
}
|
|
6727
6726
|
if (attributes.transform) {
|
|
6728
|
-
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object,
|
|
6727
|
+
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
|
|
6729
6728
|
}
|
|
6730
|
-
if (
|
|
6731
|
-
|
|
6729
|
+
if (needUpdateGeometry) {
|
|
6730
|
+
object.geometry.dirty = true;
|
|
6731
|
+
// FIXME setOrigin may have already dirtified to root.
|
|
6732
|
+
// this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6732
6733
|
}
|
|
6733
|
-
return;
|
|
6734
6734
|
}
|
|
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);
|
|
6735
|
+
else {
|
|
6736
|
+
var skipUpdateAttribute_1 = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize_1 = options.memoize;
|
|
6737
|
+
var needUpdateGeometry_1 = forceUpdateGeometry;
|
|
6738
|
+
var attributeNames_1 = Object.keys(attributes);
|
|
6739
|
+
attributeNames_1.forEach(function (attributeName) {
|
|
6740
|
+
var _a;
|
|
6741
|
+
if (!skipUpdateAttribute_1) {
|
|
6742
|
+
object.attributes[attributeName] = attributes[attributeName];
|
|
6743
|
+
}
|
|
6744
|
+
if (!needUpdateGeometry_1 && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
|
|
6745
|
+
needUpdateGeometry_1 = true;
|
|
6746
|
+
}
|
|
6750
6747
|
});
|
|
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);
|
|
6748
|
+
if (!skipParse) {
|
|
6749
|
+
attributeNames_1.forEach(function (name) {
|
|
6750
|
+
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize_1);
|
|
6751
|
+
});
|
|
6782
6752
|
}
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
//
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6753
|
+
// let hasUnresolvedProperties = false;
|
|
6754
|
+
// parse according to priority
|
|
6755
|
+
// path 50
|
|
6756
|
+
// points 50
|
|
6757
|
+
// text 50
|
|
6758
|
+
// textTransform 51
|
|
6759
|
+
// transform 100
|
|
6760
|
+
// transformOrigin 100
|
|
6761
|
+
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
6762
|
+
// uniqueAttributeSet.clear();
|
|
6763
|
+
attributeNames_1 = Array.from(new Set(attributeNames_1.concat(usedAttributes)));
|
|
6764
|
+
}
|
|
6765
|
+
// [
|
|
6766
|
+
// 'path',
|
|
6767
|
+
// 'points',
|
|
6768
|
+
// 'text',
|
|
6769
|
+
// 'textTransform',
|
|
6770
|
+
// 'transform',
|
|
6771
|
+
// 'transformOrigin',
|
|
6772
|
+
// ].forEach((name) => {
|
|
6773
|
+
// const index = attributeNames.indexOf(name);
|
|
6774
|
+
// if (index > -1) {
|
|
6775
|
+
// attributeNames.splice(index, 1);
|
|
6776
|
+
// attributeNames.push(name);
|
|
6777
|
+
// }
|
|
6778
|
+
// });
|
|
6779
|
+
attributeNames_1.forEach(function (name) {
|
|
6780
|
+
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6781
|
+
if (name in object.computedStyle) {
|
|
6782
|
+
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize_1);
|
|
6783
|
+
}
|
|
6784
|
+
});
|
|
6785
|
+
// if (hasUnresolvedProperties) {
|
|
6786
|
+
// this.dirty = true;
|
|
6787
|
+
// return;
|
|
6788
|
+
// }
|
|
6789
|
+
// update geometry
|
|
6790
|
+
if (needUpdateGeometry_1) {
|
|
6791
|
+
object.geometry.dirty = true;
|
|
6792
|
+
// FIXME setOrigin may have already dirtified to root.
|
|
6793
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6797
6794
|
}
|
|
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
|
-
});
|
|
6795
|
+
attributeNames_1.forEach(function (name) {
|
|
6796
|
+
if (name in object.parsedStyle) {
|
|
6797
|
+
_this.postProcessProperty(name, object, attributeNames_1);
|
|
6809
6798
|
}
|
|
6810
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
|
+
}
|
|
6811
6813
|
}
|
|
6812
6814
|
};
|
|
6813
6815
|
/**
|
|
@@ -7076,25 +7078,22 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7076
7078
|
geometry_1.renderBounds.setMinMax(min, max);
|
|
7077
7079
|
}
|
|
7078
7080
|
});
|
|
7079
|
-
|
|
7080
|
-
// account for negative width / height of Rect
|
|
7081
|
+
object.geometry.dirty = false;
|
|
7081
7082
|
// @see https://github.com/antvis/g/issues/957
|
|
7082
7083
|
var flipY = hwidth < 0;
|
|
7083
7084
|
var flipX = hheight < 0;
|
|
7084
|
-
// } else {
|
|
7085
|
-
// }
|
|
7086
7085
|
// set transform origin
|
|
7087
7086
|
var usedOriginXValue = (flipY ? -1 : 1) *
|
|
7088
7087
|
(transformOrigin
|
|
7089
|
-
? convertPercentUnit(transformOrigin[0], 0, object)
|
|
7088
|
+
? convertPercentUnit(transformOrigin[0], 0, object, true)
|
|
7090
7089
|
: 0);
|
|
7091
7090
|
var usedOriginYValue = (flipX ? -1 : 1) *
|
|
7092
7091
|
(transformOrigin
|
|
7093
|
-
? convertPercentUnit(transformOrigin[1], 1, object)
|
|
7092
|
+
? convertPercentUnit(transformOrigin[1], 1, object, true)
|
|
7094
7093
|
: 0);
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7094
|
+
if (usedOriginXValue || usedOriginYValue) {
|
|
7095
|
+
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
7096
|
+
}
|
|
7098
7097
|
}
|
|
7099
7098
|
};
|
|
7100
7099
|
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
@@ -7585,6 +7584,7 @@ var clock = typeof performance === 'object' && performance.now ? performance : D
|
|
|
7585
7584
|
function isFillOrStrokeAffected(pointerEvents, fill, stroke) {
|
|
7586
7585
|
// account for pointerEvents
|
|
7587
7586
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
7587
|
+
if (pointerEvents === void 0) { pointerEvents = 'auto'; }
|
|
7588
7588
|
var hasFill = false;
|
|
7589
7589
|
var hasStroke = false;
|
|
7590
7590
|
var isFillOtherThanNone = !!fill && !fill.isNone;
|
|
@@ -7831,92 +7831,121 @@ function toFontString(attributes) {
|
|
|
7831
7831
|
return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
|
|
7832
7832
|
}
|
|
7833
7833
|
|
|
7834
|
-
|
|
7834
|
+
function createSkewMatrix(skewMatrix, skewX, skewY) {
|
|
7835
|
+
// Create an identity matrix
|
|
7836
|
+
glMatrix.mat4.identity(skewMatrix);
|
|
7837
|
+
// Apply skew to the matrix
|
|
7838
|
+
skewMatrix[4] = Math.tan(skewX); // Skew Y axis in X direction
|
|
7839
|
+
skewMatrix[1] = Math.tan(skewY); // Skew X axis in Y direction
|
|
7840
|
+
return skewMatrix;
|
|
7841
|
+
}
|
|
7842
|
+
var tmpMat1 = glMatrix.mat4.create();
|
|
7843
|
+
var tmpMat2 = glMatrix.mat4.create();
|
|
7835
7844
|
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
|
-
|
|
7845
|
+
if (transform.length) {
|
|
7846
|
+
var m_1 = glMatrix.mat4.identity(tmpMat1);
|
|
7847
|
+
transform.forEach(function (parsed) {
|
|
7848
|
+
var t = parsed.t, d = parsed.d;
|
|
7849
|
+
if (t === 'scale') {
|
|
7850
|
+
// scale(1) scale(1, 1)
|
|
7851
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1];
|
|
7852
|
+
glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], 1]);
|
|
7853
|
+
}
|
|
7854
|
+
else if (t === 'scalex') {
|
|
7855
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7856
|
+
glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], 1, 1]);
|
|
7857
|
+
}
|
|
7858
|
+
else if (t === 'scaley') {
|
|
7859
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7860
|
+
glMatrix.mat4.fromScaling(tmpMat2, [1, newScale[0], 1]);
|
|
7861
|
+
}
|
|
7862
|
+
else if (t === 'scalez') {
|
|
7863
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7864
|
+
glMatrix.mat4.fromScaling(tmpMat2, [1, 1, newScale[0]]);
|
|
7865
|
+
}
|
|
7866
|
+
else if (t === 'scale3d') {
|
|
7867
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1, 1];
|
|
7868
|
+
glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], newScale[2]]);
|
|
7869
|
+
}
|
|
7870
|
+
else if (t === 'translate') {
|
|
7871
|
+
var newTranslation = d || [Opx, Opx];
|
|
7872
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [
|
|
7873
|
+
newTranslation[0].value,
|
|
7874
|
+
newTranslation[1].value,
|
|
7875
|
+
0,
|
|
7876
|
+
]);
|
|
7877
|
+
}
|
|
7878
|
+
else if (t === 'translatex') {
|
|
7879
|
+
var newTranslation = d || [Opx];
|
|
7880
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [newTranslation[0].value, 0, 0]);
|
|
7881
|
+
}
|
|
7882
|
+
else if (t === 'translatey') {
|
|
7883
|
+
var newTranslation = d || [Opx];
|
|
7884
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [0, newTranslation[0].value, 0]);
|
|
7885
|
+
}
|
|
7886
|
+
else if (t === 'translatez') {
|
|
7887
|
+
var newTranslation = d || [Opx];
|
|
7888
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [0, 0, newTranslation[0].value]);
|
|
7889
|
+
}
|
|
7890
|
+
else if (t === 'translate3d') {
|
|
7891
|
+
var newTranslation = d || [Opx, Opx, Opx];
|
|
7892
|
+
glMatrix.mat4.fromTranslation(tmpMat2, [
|
|
7893
|
+
newTranslation[0].value,
|
|
7894
|
+
newTranslation[1].value,
|
|
7895
|
+
newTranslation[2].value,
|
|
7896
|
+
]);
|
|
7897
|
+
}
|
|
7898
|
+
else if (t === 'rotate') {
|
|
7899
|
+
var newAngles = d || [Odeg];
|
|
7900
|
+
glMatrix.mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7901
|
+
}
|
|
7902
|
+
else if (t === 'rotatex') {
|
|
7903
|
+
var newAngles = d || [Odeg];
|
|
7904
|
+
glMatrix.mat4.fromXRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7905
|
+
}
|
|
7906
|
+
else if (t === 'rotatey') {
|
|
7907
|
+
var newAngles = d || [Odeg];
|
|
7908
|
+
glMatrix.mat4.fromYRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7909
|
+
}
|
|
7910
|
+
else if (t === 'rotatez') {
|
|
7911
|
+
var newAngles = d || [Odeg];
|
|
7912
|
+
glMatrix.mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7913
|
+
}
|
|
7914
|
+
else if (t === 'rotate3d') {
|
|
7915
|
+
var newAngles = d || [Opx, Opx, Opx, Odeg];
|
|
7916
|
+
glMatrix.mat4.fromRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[3])), [
|
|
7917
|
+
newAngles[0].value,
|
|
7918
|
+
newAngles[1].value,
|
|
7919
|
+
newAngles[2].value,
|
|
7920
|
+
]);
|
|
7921
|
+
}
|
|
7922
|
+
else if (t === 'skew') {
|
|
7923
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0, 0];
|
|
7924
|
+
createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), deg2rad(newSkew[1]));
|
|
7925
|
+
}
|
|
7926
|
+
else if (t === 'skewx') {
|
|
7927
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
|
|
7928
|
+
createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), 0);
|
|
7929
|
+
}
|
|
7930
|
+
else if (t === 'skewy') {
|
|
7931
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
|
|
7932
|
+
createSkewMatrix(tmpMat2, 0, deg2rad(newSkew[0]));
|
|
7933
|
+
}
|
|
7934
|
+
else if (t === 'matrix') {
|
|
7935
|
+
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];
|
|
7936
|
+
glMatrix.mat4.set(tmpMat2, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1);
|
|
7937
|
+
}
|
|
7938
|
+
else if (t === 'matrix3d') {
|
|
7939
|
+
// @ts-ignore
|
|
7940
|
+
glMatrix.mat4.set.apply(glMatrix.mat4, tslib.__spreadArray([tmpMat2], tslib.__read(d.map(function (s) { return s.value; })), false));
|
|
7941
|
+
}
|
|
7942
|
+
glMatrix.mat4.mul(m_1, m_1, tmpMat2);
|
|
7943
|
+
});
|
|
7944
|
+
object.setLocalTransform(m_1);
|
|
7945
|
+
}
|
|
7946
|
+
else {
|
|
7947
|
+
object.resetLocalTransform();
|
|
7948
|
+
}
|
|
7920
7949
|
return object.getLocalTransform();
|
|
7921
7950
|
}
|
|
7922
7951
|
|
|
@@ -7980,17 +8009,18 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
|
7980
8009
|
function CSSPropertyTransformOrigin() {
|
|
7981
8010
|
this.parser = parseTransformOrigin;
|
|
7982
8011
|
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
8012
|
}
|
|
8013
|
+
CSSPropertyTransformOrigin.prototype.postProcessor = function (object) {
|
|
8014
|
+
var transformOrigin = object.parsedStyle.transformOrigin;
|
|
8015
|
+
if (transformOrigin[0].unit === exports.UnitType.kPixels &&
|
|
8016
|
+
transformOrigin[1].unit === exports.UnitType.kPixels) {
|
|
8017
|
+
object.setOrigin(transformOrigin[0].value, transformOrigin[1].value);
|
|
8018
|
+
}
|
|
8019
|
+
else {
|
|
8020
|
+
// Relative to geometry bounds, calculate later.
|
|
8021
|
+
object.getGeometryBounds();
|
|
8022
|
+
}
|
|
8023
|
+
};
|
|
7994
8024
|
return CSSPropertyTransformOrigin;
|
|
7995
8025
|
}());
|
|
7996
8026
|
|
|
@@ -8240,6 +8270,20 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8240
8270
|
return TextUpdater;
|
|
8241
8271
|
}());
|
|
8242
8272
|
|
|
8273
|
+
var GroupUpdater = /** @class */ (function () {
|
|
8274
|
+
function GroupUpdater() {
|
|
8275
|
+
}
|
|
8276
|
+
GroupUpdater.prototype.update = function (parsedStyle, object) {
|
|
8277
|
+
return {
|
|
8278
|
+
cx: 0,
|
|
8279
|
+
cy: 0,
|
|
8280
|
+
hwidth: 0,
|
|
8281
|
+
hheight: 0,
|
|
8282
|
+
};
|
|
8283
|
+
};
|
|
8284
|
+
return GroupUpdater;
|
|
8285
|
+
}());
|
|
8286
|
+
|
|
8243
8287
|
function isFederatedEvent(value) {
|
|
8244
8288
|
return !!value.type;
|
|
8245
8289
|
}
|
|
@@ -8790,7 +8834,7 @@ var EventTarget = /** @class */ (function () {
|
|
|
8790
8834
|
var Node = /** @class */ (function (_super) {
|
|
8791
8835
|
tslib.__extends(Node, _super);
|
|
8792
8836
|
function Node() {
|
|
8793
|
-
var _this = _super.
|
|
8837
|
+
var _this = _super.call(this) || this;
|
|
8794
8838
|
_this.shadow = false;
|
|
8795
8839
|
/**
|
|
8796
8840
|
* points to canvas.document
|
|
@@ -10018,7 +10062,7 @@ var RenderingService = /** @class */ (function () {
|
|
|
10018
10062
|
this.zIndexCounter = 0;
|
|
10019
10063
|
var renderingContext = this.context.renderingContext;
|
|
10020
10064
|
this.globalRuntime.sceneGraphService.syncHierarchy(renderingContext.root);
|
|
10021
|
-
this.globalRuntime.sceneGraphService.triggerPendingEvents();
|
|
10065
|
+
// this.globalRuntime.sceneGraphService.triggerPendingEvents();
|
|
10022
10066
|
if (renderingContext.renderReasons.size && this.inited) {
|
|
10023
10067
|
// @ts-ignore
|
|
10024
10068
|
renderingContext.dirtyRectangleRenderingDisabled =
|
|
@@ -10339,9 +10383,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10339
10383
|
*/
|
|
10340
10384
|
this.rotate = (function () {
|
|
10341
10385
|
var parentInvertRotation = glMatrix.quat.create();
|
|
10342
|
-
return function (element, degrees, y, z) {
|
|
10386
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10343
10387
|
if (y === void 0) { y = 0; }
|
|
10344
10388
|
if (z === void 0) { z = 0; }
|
|
10389
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10345
10390
|
if (typeof degrees === 'number') {
|
|
10346
10391
|
degrees = glMatrix.vec3.fromValues(degrees, y, z);
|
|
10347
10392
|
}
|
|
@@ -10360,7 +10405,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10360
10405
|
glMatrix.quat.multiply(rotation, parentInvertRotation, rotation);
|
|
10361
10406
|
glMatrix.quat.multiply(transform.localRotation, rotation, rot);
|
|
10362
10407
|
glMatrix.quat.normalize(transform.localRotation, transform.localRotation);
|
|
10363
|
-
|
|
10408
|
+
if (dirtify) {
|
|
10409
|
+
_this.dirtifyLocal(element, transform);
|
|
10410
|
+
}
|
|
10364
10411
|
}
|
|
10365
10412
|
};
|
|
10366
10413
|
})();
|
|
@@ -10370,16 +10417,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10370
10417
|
*/
|
|
10371
10418
|
this.rotateLocal = (function () {
|
|
10372
10419
|
var rotation = glMatrix.quat.create();
|
|
10373
|
-
return function (element, degrees, y, z) {
|
|
10420
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10374
10421
|
if (y === void 0) { y = 0; }
|
|
10375
10422
|
if (z === void 0) { z = 0; }
|
|
10423
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10376
10424
|
if (typeof degrees === 'number') {
|
|
10377
10425
|
degrees = glMatrix.vec3.fromValues(degrees, y, z);
|
|
10378
10426
|
}
|
|
10379
10427
|
var transform = element.transformable;
|
|
10380
10428
|
glMatrix.quat.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
|
|
10381
10429
|
glMatrix.quat.mul(transform.localRotation, transform.localRotation, rotation);
|
|
10382
|
-
|
|
10430
|
+
if (dirtify) {
|
|
10431
|
+
_this.dirtifyLocal(element, transform);
|
|
10432
|
+
}
|
|
10383
10433
|
};
|
|
10384
10434
|
})();
|
|
10385
10435
|
/**
|
|
@@ -10387,9 +10437,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10387
10437
|
*/
|
|
10388
10438
|
this.setEulerAngles = (function () {
|
|
10389
10439
|
var invParentRot = glMatrix.quat.create();
|
|
10390
|
-
return function (element, degrees, y, z) {
|
|
10440
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10391
10441
|
if (y === void 0) { y = 0; }
|
|
10392
10442
|
if (z === void 0) { z = 0; }
|
|
10443
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10393
10444
|
if (typeof degrees === 'number') {
|
|
10394
10445
|
degrees = glMatrix.vec3.fromValues(degrees, y, z);
|
|
10395
10446
|
}
|
|
@@ -10403,7 +10454,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10403
10454
|
var parentRotation = _this.getRotation(element.parentNode);
|
|
10404
10455
|
glMatrix.quat.copy(invParentRot, glMatrix.quat.invert(glMatrix.quat.create(), parentRotation));
|
|
10405
10456
|
glMatrix.quat.mul(transform.localRotation, transform.localRotation, invParentRot);
|
|
10406
|
-
|
|
10457
|
+
if (dirtify) {
|
|
10458
|
+
_this.dirtifyLocal(element, transform);
|
|
10459
|
+
}
|
|
10407
10460
|
}
|
|
10408
10461
|
};
|
|
10409
10462
|
})();
|
|
@@ -10417,9 +10470,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10417
10470
|
* ```
|
|
10418
10471
|
*/
|
|
10419
10472
|
this.translateLocal = (function () {
|
|
10420
|
-
return function (element, translation, y, z) {
|
|
10473
|
+
return function (element, translation, y, z, dirtify) {
|
|
10421
10474
|
if (y === void 0) { y = 0; }
|
|
10422
10475
|
if (z === void 0) { z = 0; }
|
|
10476
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10423
10477
|
if (typeof translation === 'number') {
|
|
10424
10478
|
translation = glMatrix.vec3.fromValues(translation, y, z);
|
|
10425
10479
|
}
|
|
@@ -10429,7 +10483,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10429
10483
|
}
|
|
10430
10484
|
glMatrix.vec3.transformQuat(translation, translation, transform.localRotation);
|
|
10431
10485
|
glMatrix.vec3.add(transform.localPosition, transform.localPosition, translation);
|
|
10432
|
-
|
|
10486
|
+
if (dirtify) {
|
|
10487
|
+
_this.dirtifyLocal(element, transform);
|
|
10488
|
+
}
|
|
10433
10489
|
};
|
|
10434
10490
|
})();
|
|
10435
10491
|
/**
|
|
@@ -10441,7 +10497,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10441
10497
|
this.setPosition = (function () {
|
|
10442
10498
|
var parentInvertMatrix = glMatrix.mat4.create();
|
|
10443
10499
|
var tmpPosition = glMatrix.vec3.create();
|
|
10444
|
-
return function (element, position) {
|
|
10500
|
+
return function (element, position, dirtify) {
|
|
10501
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10445
10502
|
var transform = element.transformable;
|
|
10446
10503
|
tmpPosition[0] = position[0];
|
|
10447
10504
|
tmpPosition[1] = position[1];
|
|
@@ -10460,7 +10517,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10460
10517
|
glMatrix.mat4.invert(parentInvertMatrix, parentInvertMatrix);
|
|
10461
10518
|
glMatrix.vec3.transformMat4(transform.localPosition, tmpPosition, parentInvertMatrix);
|
|
10462
10519
|
}
|
|
10463
|
-
|
|
10520
|
+
if (dirtify) {
|
|
10521
|
+
_this.dirtifyLocal(element, transform);
|
|
10522
|
+
}
|
|
10464
10523
|
};
|
|
10465
10524
|
})();
|
|
10466
10525
|
/**
|
|
@@ -10468,7 +10527,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10468
10527
|
*/
|
|
10469
10528
|
this.setLocalPosition = (function () {
|
|
10470
10529
|
var tmpPosition = glMatrix.vec3.create();
|
|
10471
|
-
return function (element, position) {
|
|
10530
|
+
return function (element, position, dirtify) {
|
|
10531
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10472
10532
|
var transform = element.transformable;
|
|
10473
10533
|
tmpPosition[0] = position[0];
|
|
10474
10534
|
tmpPosition[1] = position[1];
|
|
@@ -10477,7 +10537,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10477
10537
|
return;
|
|
10478
10538
|
}
|
|
10479
10539
|
glMatrix.vec3.copy(transform.localPosition, tmpPosition);
|
|
10480
|
-
|
|
10540
|
+
if (dirtify) {
|
|
10541
|
+
_this.dirtifyLocal(element, transform);
|
|
10542
|
+
}
|
|
10481
10543
|
};
|
|
10482
10544
|
})();
|
|
10483
10545
|
/**
|
|
@@ -10496,9 +10558,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10496
10558
|
var zeroVec3 = glMatrix.vec3.create();
|
|
10497
10559
|
var tmpVec3 = glMatrix.vec3.create();
|
|
10498
10560
|
var tr = glMatrix.vec3.create();
|
|
10499
|
-
return function (element, translation, y, z) {
|
|
10561
|
+
return function (element, translation, y, z, dirtify) {
|
|
10500
10562
|
if (y === void 0) { y = 0; }
|
|
10501
10563
|
if (z === void 0) { z = 0; }
|
|
10564
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10502
10565
|
if (typeof translation === 'number') {
|
|
10503
10566
|
translation = glMatrix.vec3.set(tmpVec3, translation, y, z);
|
|
10504
10567
|
}
|
|
@@ -10506,12 +10569,13 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10506
10569
|
return;
|
|
10507
10570
|
}
|
|
10508
10571
|
glMatrix.vec3.add(tr, _this.getPosition(element), translation);
|
|
10509
|
-
_this.setPosition(element, tr);
|
|
10572
|
+
_this.setPosition(element, tr, dirtify);
|
|
10510
10573
|
};
|
|
10511
10574
|
})();
|
|
10512
10575
|
this.setRotation = function () {
|
|
10513
10576
|
var parentInvertRotation = glMatrix.quat.create();
|
|
10514
|
-
return function (element, rotation, y, z, w) {
|
|
10577
|
+
return function (element, rotation, y, z, w, dirtify) {
|
|
10578
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10515
10579
|
var transform = element.transformable;
|
|
10516
10580
|
if (typeof rotation === 'number') {
|
|
10517
10581
|
rotation = glMatrix.quat.fromValues(rotation, y, z, w);
|
|
@@ -10526,7 +10590,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10526
10590
|
glMatrix.quat.invert(parentInvertRotation, parentInvertRotation);
|
|
10527
10591
|
glMatrix.quat.multiply(transform.localRotation, parentInvertRotation, rotation);
|
|
10528
10592
|
glMatrix.quat.normalize(transform.localRotation, transform.localRotation);
|
|
10529
|
-
|
|
10593
|
+
if (dirtify) {
|
|
10594
|
+
_this.dirtifyLocal(element, transform);
|
|
10595
|
+
}
|
|
10530
10596
|
}
|
|
10531
10597
|
};
|
|
10532
10598
|
};
|
|
@@ -10567,7 +10633,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10567
10633
|
// .filter((node) => !node.shadow);
|
|
10568
10634
|
};
|
|
10569
10635
|
DefaultSceneGraphService.prototype.attach = function (child, parent, index) {
|
|
10570
|
-
var _a
|
|
10636
|
+
var _a;
|
|
10571
10637
|
var detached = false;
|
|
10572
10638
|
if (child.parentNode) {
|
|
10573
10639
|
detached = child.parentNode !== parent;
|
|
@@ -10583,7 +10649,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10583
10649
|
// parent needs re-sort
|
|
10584
10650
|
var sortable = parent.sortable;
|
|
10585
10651
|
if (((_a = sortable === null || sortable === void 0 ? void 0 : sortable.sorted) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
10586
|
-
|
|
10652
|
+
child.parsedStyle.zIndex) {
|
|
10587
10653
|
if (sortable.dirtyChildren.indexOf(child) === -1) {
|
|
10588
10654
|
sortable.dirtyChildren.push(child);
|
|
10589
10655
|
}
|
|
@@ -10637,6 +10703,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10637
10703
|
}
|
|
10638
10704
|
};
|
|
10639
10705
|
DefaultSceneGraphService.prototype.getOrigin = function (element) {
|
|
10706
|
+
element.getGeometryBounds();
|
|
10640
10707
|
return element.transformable.origin;
|
|
10641
10708
|
};
|
|
10642
10709
|
/**
|
|
@@ -10668,40 +10735,52 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10668
10735
|
/**
|
|
10669
10736
|
* set euler angles(degrees) in local space
|
|
10670
10737
|
*/
|
|
10671
|
-
DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z) {
|
|
10738
|
+
DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z, dirtify) {
|
|
10672
10739
|
if (y === void 0) { y = 0; }
|
|
10673
10740
|
if (z === void 0) { z = 0; }
|
|
10741
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10674
10742
|
if (typeof degrees === 'number') {
|
|
10675
10743
|
degrees = glMatrix.vec3.fromValues(degrees, y, z);
|
|
10676
10744
|
}
|
|
10677
10745
|
var transform = element.transformable;
|
|
10678
10746
|
glMatrix.quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
10679
|
-
|
|
10747
|
+
if (dirtify) {
|
|
10748
|
+
this.dirtifyLocal(element, transform);
|
|
10749
|
+
}
|
|
10680
10750
|
};
|
|
10681
10751
|
/**
|
|
10682
10752
|
* scale in local space
|
|
10683
10753
|
*/
|
|
10684
|
-
DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling) {
|
|
10754
|
+
DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling, dirtify) {
|
|
10755
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10685
10756
|
var transform = element.transformable;
|
|
10686
10757
|
glMatrix.vec3.multiply(transform.localScale, transform.localScale, glMatrix.vec3.fromValues(scaling[0], scaling[1], scaling[2] || 1));
|
|
10687
|
-
|
|
10758
|
+
if (dirtify) {
|
|
10759
|
+
this.dirtifyLocal(element, transform);
|
|
10760
|
+
}
|
|
10688
10761
|
};
|
|
10689
|
-
DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling) {
|
|
10762
|
+
DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling, dirtify) {
|
|
10763
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10690
10764
|
var transform = element.transformable;
|
|
10691
10765
|
var updatedScaling = glMatrix.vec3.fromValues(scaling[0], scaling[1], scaling[2] || transform.localScale[2]);
|
|
10692
10766
|
if (glMatrix.vec3.equals(updatedScaling, transform.localScale)) {
|
|
10693
10767
|
return;
|
|
10694
10768
|
}
|
|
10695
10769
|
glMatrix.vec3.copy(transform.localScale, updatedScaling);
|
|
10696
|
-
|
|
10770
|
+
if (dirtify) {
|
|
10771
|
+
this.dirtifyLocal(element, transform);
|
|
10772
|
+
}
|
|
10697
10773
|
};
|
|
10698
|
-
DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w) {
|
|
10774
|
+
DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w, dirtify) {
|
|
10775
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10699
10776
|
if (typeof rotation === 'number') {
|
|
10700
10777
|
rotation = glMatrix.quat.fromValues(rotation, y, z, w);
|
|
10701
10778
|
}
|
|
10702
10779
|
var transform = element.transformable;
|
|
10703
10780
|
glMatrix.quat.copy(transform.localRotation, rotation);
|
|
10704
|
-
|
|
10781
|
+
if (dirtify) {
|
|
10782
|
+
this.dirtifyLocal(element, transform);
|
|
10783
|
+
}
|
|
10705
10784
|
};
|
|
10706
10785
|
DefaultSceneGraphService.prototype.setLocalSkew = function (element, skew, y) {
|
|
10707
10786
|
if (typeof skew === 'number') {
|
|
@@ -10865,9 +10944,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10865
10944
|
var t = glMatrix.mat4.getTranslation(glMatrix.vec3.create(), transform);
|
|
10866
10945
|
var r = glMatrix.mat4.getRotation(glMatrix.quat.create(), transform);
|
|
10867
10946
|
var s = glMatrix.mat4.getScaling(glMatrix.vec3.create(), transform);
|
|
10868
|
-
this.setLocalScale(element, s);
|
|
10869
|
-
this.setLocalPosition(element, t);
|
|
10870
|
-
this.setLocalRotation(element, r);
|
|
10947
|
+
this.setLocalScale(element, s, false);
|
|
10948
|
+
this.setLocalPosition(element, t, false);
|
|
10949
|
+
this.setLocalRotation(element, r, undefined, undefined, undefined, false);
|
|
10950
|
+
this.dirtifyLocal(element, element.transformable);
|
|
10871
10951
|
};
|
|
10872
10952
|
DefaultSceneGraphService.prototype.resetLocalTransform = function (element) {
|
|
10873
10953
|
this.setLocalScale(element, [1, 1, 1]);
|
|
@@ -10893,6 +10973,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10893
10973
|
DefaultSceneGraphService.prototype.getGeometryBounds = function (element, render) {
|
|
10894
10974
|
if (render === void 0) { render = false; }
|
|
10895
10975
|
var geometry = element.geometry;
|
|
10976
|
+
if (geometry.dirty) {
|
|
10977
|
+
runtime.styleValueRegistry.updateGeometry(element);
|
|
10978
|
+
}
|
|
10896
10979
|
var bounds = render
|
|
10897
10980
|
? geometry.renderBounds
|
|
10898
10981
|
: geometry.contentBounds || null;
|
|
@@ -11483,7 +11566,7 @@ var geometryUpdaterFactory = (function () {
|
|
|
11483
11566
|
_a[exports.Shape.ELLIPSE] = new EllipseUpdater(),
|
|
11484
11567
|
_a[exports.Shape.RECT] = rectUpdater,
|
|
11485
11568
|
_a[exports.Shape.IMAGE] = rectUpdater,
|
|
11486
|
-
_a[exports.Shape.GROUP] =
|
|
11569
|
+
_a[exports.Shape.GROUP] = new GroupUpdater(),
|
|
11487
11570
|
_a[exports.Shape.LINE] = new LineUpdater(),
|
|
11488
11571
|
_a[exports.Shape.TEXT] = new TextUpdater(runtime),
|
|
11489
11572
|
_a[exports.Shape.POLYLINE] = polylineUpdater,
|
|
@@ -11560,12 +11643,13 @@ runtime.globalThis = getGlobalThis();
|
|
|
11560
11643
|
runtime.enableCSSParsing = true;
|
|
11561
11644
|
runtime.enableDataset = false;
|
|
11562
11645
|
runtime.enableStyleSyntax = true;
|
|
11646
|
+
runtime.enableAttributeDashCased = false;
|
|
11563
11647
|
|
|
11564
11648
|
var entityCounter = 0;
|
|
11565
11649
|
function resetEntityCounter() {
|
|
11566
11650
|
entityCounter = 0;
|
|
11567
11651
|
}
|
|
11568
|
-
|
|
11652
|
+
new MutationEvent(exports.ElementEvent.INSERTED, null, '', '', '', 0, '', '');
|
|
11569
11653
|
var removedEvent = new MutationEvent(exports.ElementEvent.REMOVED, null, '', '', '', 0, '', '');
|
|
11570
11654
|
var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
|
|
11571
11655
|
/**
|
|
@@ -11577,7 +11661,7 @@ var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
|
|
|
11577
11661
|
var Element = /** @class */ (function (_super) {
|
|
11578
11662
|
tslib.__extends(Element, _super);
|
|
11579
11663
|
function Element() {
|
|
11580
|
-
var _this = _super.
|
|
11664
|
+
var _this = _super.call(this) || this;
|
|
11581
11665
|
/**
|
|
11582
11666
|
* Unique id.
|
|
11583
11667
|
*/
|
|
@@ -11621,6 +11705,7 @@ var Element = /** @class */ (function (_super) {
|
|
|
11621
11705
|
_this.geometry = {
|
|
11622
11706
|
contentBounds: undefined,
|
|
11623
11707
|
renderBounds: undefined,
|
|
11708
|
+
dirty: true,
|
|
11624
11709
|
};
|
|
11625
11710
|
_this.rBushNode = {
|
|
11626
11711
|
aabb: undefined,
|
|
@@ -11804,11 +11889,8 @@ var Element = /** @class */ (function (_super) {
|
|
|
11804
11889
|
if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
|
|
11805
11890
|
this.ownerDocument.defaultView.mountChildren(child);
|
|
11806
11891
|
}
|
|
11807
|
-
//
|
|
11808
|
-
|
|
11809
|
-
insertedEvent.relatedNode = this;
|
|
11810
|
-
child.dispatchEvent(insertedEvent);
|
|
11811
|
-
}
|
|
11892
|
+
// insertedEvent.relatedNode = this as IElement;
|
|
11893
|
+
// child.dispatchEvent(insertedEvent);
|
|
11812
11894
|
return child;
|
|
11813
11895
|
};
|
|
11814
11896
|
Element.prototype.insertBefore = function (newChild, refChild) {
|
|
@@ -12081,8 +12163,10 @@ var Element = /** @class */ (function (_super) {
|
|
|
12081
12163
|
}
|
|
12082
12164
|
var value = this.attributes[name];
|
|
12083
12165
|
if (value === undefined) {
|
|
12084
|
-
|
|
12085
|
-
|
|
12166
|
+
if (runtime.enableAttributeDashCased) {
|
|
12167
|
+
var attributeName = formatAttributeName(name);
|
|
12168
|
+
value = this.attributes[attributeName];
|
|
12169
|
+
}
|
|
12086
12170
|
// if the given attribute does not exist, the value returned will either be null or ""
|
|
12087
12171
|
return runtime.enableCSSParsing ? (util.isNil(value) ? null : value) : value;
|
|
12088
12172
|
}
|
|
@@ -12188,7 +12272,20 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
12188
12272
|
shadowType: 'outer',
|
|
12189
12273
|
miterLimit: 10,
|
|
12190
12274
|
};
|
|
12191
|
-
|
|
12275
|
+
// const DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = {
|
|
12276
|
+
// ...DEFAULT_PARSED_STYLE_PROPS,
|
|
12277
|
+
// opacity: 1,
|
|
12278
|
+
// fillOpacity: 1,
|
|
12279
|
+
// strokeOpacity: 1,
|
|
12280
|
+
// visibility: 'visible',
|
|
12281
|
+
// pointerEvents: 'auto',
|
|
12282
|
+
// lineWidth: 1,
|
|
12283
|
+
// lineCap: 'butt',
|
|
12284
|
+
// lineJoin: 'miter',
|
|
12285
|
+
// increasedLineWidthForHitTesting: 0,
|
|
12286
|
+
// fillRule: 'nonzero',
|
|
12287
|
+
// // TODO: transformOrigin
|
|
12288
|
+
// };
|
|
12192
12289
|
var INHERITABLE_BASE_STYLE_PROPS = [
|
|
12193
12290
|
'opacity',
|
|
12194
12291
|
'fillOpacity',
|
|
@@ -12250,8 +12347,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12250
12347
|
// assign name, id to config
|
|
12251
12348
|
// eg. group.get('name')
|
|
12252
12349
|
_this.config = config;
|
|
12253
|
-
// compatible with G 3.0
|
|
12254
|
-
// this.config.interactive = this.config.capture ?? this.config.interactive;
|
|
12255
12350
|
// init scene graph node
|
|
12256
12351
|
_this.id = _this.config.id || '';
|
|
12257
12352
|
_this.name = _this.config.name || '';
|
|
@@ -12259,29 +12354,9 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12259
12354
|
_this.className = _this.config.className || _this.config.class;
|
|
12260
12355
|
}
|
|
12261
12356
|
_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
12357
|
if (runtime.enableCSSParsing) {
|
|
12284
12358
|
Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
|
|
12359
|
+
Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
|
|
12285
12360
|
}
|
|
12286
12361
|
// start to process attributes
|
|
12287
12362
|
_this.initAttributes(_this.config.style);
|
|
@@ -12405,10 +12480,14 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12405
12480
|
options.usedAttributes = INHERITABLE_STYLE_PROPS;
|
|
12406
12481
|
}
|
|
12407
12482
|
// account for FCP, process properties as less as possible
|
|
12408
|
-
var formattedAttributes =
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
formattedAttributes
|
|
12483
|
+
var formattedAttributes = attributes;
|
|
12484
|
+
if (runtime.enableAttributeDashCased) {
|
|
12485
|
+
// @ts-ignore
|
|
12486
|
+
formattedAttributes = {};
|
|
12487
|
+
for (var name_1 in attributes) {
|
|
12488
|
+
var attributeName = formatAttributeName(name_1);
|
|
12489
|
+
formattedAttributes[attributeName] = attributes[name_1];
|
|
12490
|
+
}
|
|
12412
12491
|
}
|
|
12413
12492
|
runtime.styleValueRegistry.processProperties(this, formattedAttributes, options);
|
|
12414
12493
|
// redraw at next frame
|
|
@@ -12417,14 +12496,16 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12417
12496
|
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12418
12497
|
if (force === void 0) { force = false; }
|
|
12419
12498
|
if (memoize === void 0) { memoize = true; }
|
|
12420
|
-
|
|
12499
|
+
if (runtime.enableAttributeDashCased) {
|
|
12500
|
+
name = formatAttributeName(name);
|
|
12501
|
+
}
|
|
12421
12502
|
// ignore undefined value
|
|
12422
12503
|
if (util.isUndefined(value)) {
|
|
12423
12504
|
return;
|
|
12424
12505
|
}
|
|
12425
|
-
if (force || value !== this.attributes[
|
|
12426
|
-
this.internalSetAttribute(
|
|
12427
|
-
_super.prototype.setAttribute.call(this,
|
|
12506
|
+
if (force || value !== this.attributes[name]) {
|
|
12507
|
+
this.internalSetAttribute(name, value, { memoize: memoize });
|
|
12508
|
+
_super.prototype.setAttribute.call(this, name, value);
|
|
12428
12509
|
}
|
|
12429
12510
|
};
|
|
12430
12511
|
/**
|
|
@@ -12678,8 +12759,10 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12678
12759
|
* shortcut for Used value of `visibility`
|
|
12679
12760
|
*/
|
|
12680
12761
|
DisplayObject.prototype.isVisible = function () {
|
|
12681
|
-
var _a;
|
|
12682
|
-
return
|
|
12762
|
+
var _a, _b;
|
|
12763
|
+
return runtime.enableCSSParsing
|
|
12764
|
+
? ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible'
|
|
12765
|
+
: ((_b = this.parsedStyle) === null || _b === void 0 ? void 0 : _b.visibility) !== 'hidden';
|
|
12683
12766
|
};
|
|
12684
12767
|
Object.defineProperty(DisplayObject.prototype, "interactive", {
|
|
12685
12768
|
get: function () {
|
|
@@ -12922,124 +13005,13 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12922
13005
|
return DisplayObject;
|
|
12923
13006
|
}(Element));
|
|
12924
13007
|
|
|
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
13008
|
var Circle = /** @class */ (function (_super) {
|
|
13029
13009
|
tslib.__extends(Circle, _super);
|
|
13030
|
-
|
|
13031
|
-
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
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;
|
|
13010
|
+
function Circle(options) {
|
|
13011
|
+
if (options === void 0) { options = {}; }
|
|
13012
|
+
var _this = _super.call(this, options) || this;
|
|
13013
|
+
_this.nodeName = exports.Shape.CIRCLE;
|
|
13014
|
+
return _this;
|
|
13043
13015
|
}
|
|
13044
13016
|
return Circle;
|
|
13045
13017
|
}(DisplayObject));
|
|
@@ -13068,15 +13040,11 @@ 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
|
-
var
|
|
13074
|
-
|
|
13075
|
-
|
|
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
|
+
var _this = _super.call(this, options) || this;
|
|
13046
|
+
_this.nodeName = exports.Shape.ELLIPSE;
|
|
13047
|
+
return _this;
|
|
13080
13048
|
}
|
|
13081
13049
|
return Ellipse;
|
|
13082
13050
|
}(DisplayObject));
|
|
@@ -13827,6 +13795,109 @@ var CustomElementRegistry = /** @class */ (function () {
|
|
|
13827
13795
|
return CustomElementRegistry;
|
|
13828
13796
|
}());
|
|
13829
13797
|
|
|
13798
|
+
/**
|
|
13799
|
+
* holds useful CSS-related methods.
|
|
13800
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
13801
|
+
*
|
|
13802
|
+
* * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
|
|
13803
|
+
* * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13804
|
+
* * CSS Layout API
|
|
13805
|
+
*/
|
|
13806
|
+
var CSS = {
|
|
13807
|
+
/**
|
|
13808
|
+
* <number>
|
|
13809
|
+
* @see https://drafts.csswg.org/css-values-4/#number-value
|
|
13810
|
+
*/
|
|
13811
|
+
number: function (n) {
|
|
13812
|
+
return new CSSUnitValue(n);
|
|
13813
|
+
},
|
|
13814
|
+
/**
|
|
13815
|
+
* <percentage>
|
|
13816
|
+
* @see https://drafts.csswg.org/css-values-4/#percentage-value
|
|
13817
|
+
*/
|
|
13818
|
+
percent: function (n) {
|
|
13819
|
+
return new CSSUnitValue(n, '%');
|
|
13820
|
+
},
|
|
13821
|
+
/**
|
|
13822
|
+
* <length>
|
|
13823
|
+
*/
|
|
13824
|
+
px: function (n) {
|
|
13825
|
+
return new CSSUnitValue(n, 'px');
|
|
13826
|
+
},
|
|
13827
|
+
/**
|
|
13828
|
+
* <length>
|
|
13829
|
+
*/
|
|
13830
|
+
em: function (n) {
|
|
13831
|
+
return new CSSUnitValue(n, 'em');
|
|
13832
|
+
},
|
|
13833
|
+
rem: function (n) {
|
|
13834
|
+
return new CSSUnitValue(n, 'rem');
|
|
13835
|
+
},
|
|
13836
|
+
/**
|
|
13837
|
+
* <angle>
|
|
13838
|
+
*/
|
|
13839
|
+
deg: function (n) {
|
|
13840
|
+
return new CSSUnitValue(n, 'deg');
|
|
13841
|
+
},
|
|
13842
|
+
/**
|
|
13843
|
+
* <angle>
|
|
13844
|
+
*/
|
|
13845
|
+
grad: function (n) {
|
|
13846
|
+
return new CSSUnitValue(n, 'grad');
|
|
13847
|
+
},
|
|
13848
|
+
/**
|
|
13849
|
+
* <angle>
|
|
13850
|
+
*/
|
|
13851
|
+
rad: function (n) {
|
|
13852
|
+
return new CSSUnitValue(n, 'rad');
|
|
13853
|
+
},
|
|
13854
|
+
/**
|
|
13855
|
+
* <angle>
|
|
13856
|
+
*/
|
|
13857
|
+
turn: function (n) {
|
|
13858
|
+
return new CSSUnitValue(n, 'turn');
|
|
13859
|
+
},
|
|
13860
|
+
/**
|
|
13861
|
+
* <time>
|
|
13862
|
+
*/
|
|
13863
|
+
s: function (n) {
|
|
13864
|
+
return new CSSUnitValue(n, 's');
|
|
13865
|
+
},
|
|
13866
|
+
/**
|
|
13867
|
+
* <time>
|
|
13868
|
+
*/
|
|
13869
|
+
ms: function (n) {
|
|
13870
|
+
return new CSSUnitValue(n, 'ms');
|
|
13871
|
+
},
|
|
13872
|
+
/**
|
|
13873
|
+
* CSS Properties & Values API
|
|
13874
|
+
*
|
|
13875
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
|
|
13876
|
+
* @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
|
|
13877
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13878
|
+
*/
|
|
13879
|
+
registerProperty: function (definition) {
|
|
13880
|
+
var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
|
|
13881
|
+
runtime.styleValueRegistry.registerMetadata({
|
|
13882
|
+
n: name,
|
|
13883
|
+
inh: inherits,
|
|
13884
|
+
int: interpolable,
|
|
13885
|
+
d: initialValue,
|
|
13886
|
+
syntax: syntax,
|
|
13887
|
+
});
|
|
13888
|
+
},
|
|
13889
|
+
/**
|
|
13890
|
+
* CSS Layout API
|
|
13891
|
+
* register layout
|
|
13892
|
+
*
|
|
13893
|
+
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
13894
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
13895
|
+
*/
|
|
13896
|
+
registerLayout: function (name, clazz) {
|
|
13897
|
+
runtime.layoutRegistry.registerLayout(name, clazz);
|
|
13898
|
+
},
|
|
13899
|
+
};
|
|
13900
|
+
|
|
13830
13901
|
/**
|
|
13831
13902
|
* the entry of DOM tree
|
|
13832
13903
|
* Document -> Node -> EventTarget
|
|
@@ -14667,9 +14738,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14667
14738
|
* sync to RBush later
|
|
14668
14739
|
*/
|
|
14669
14740
|
this.toSync = new Set();
|
|
14741
|
+
// private isFirstTimeRendering = true;
|
|
14742
|
+
this.syncing = false;
|
|
14670
14743
|
}
|
|
14671
|
-
// private isFirstTimeRendering = true;
|
|
14672
|
-
// private syncing = false;
|
|
14673
14744
|
PrepareRendererPlugin.prototype.apply = function (context) {
|
|
14674
14745
|
var _this = this;
|
|
14675
14746
|
var renderingService = context.renderingService, renderingContext = context.renderingContext, rBushRoot = context.rBushRoot;
|
|
@@ -14731,25 +14802,17 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14731
14802
|
_this.toSync.clear();
|
|
14732
14803
|
});
|
|
14733
14804
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
// // @see https://github.com/antvis/G/issues/1117
|
|
14738
|
-
// setTimeout(() => {
|
|
14739
|
-
// this.syncRTree();
|
|
14740
|
-
// console.log('fcp...');
|
|
14741
|
-
// });
|
|
14742
|
-
// } else {
|
|
14743
|
-
// console.log('next...');
|
|
14744
|
-
_this.syncRTree();
|
|
14745
|
-
// }
|
|
14805
|
+
requestIdleCallback(function () {
|
|
14806
|
+
_this.syncRTree();
|
|
14807
|
+
});
|
|
14746
14808
|
});
|
|
14747
14809
|
};
|
|
14748
14810
|
PrepareRendererPlugin.prototype.syncRTree = function () {
|
|
14749
|
-
// if (this.syncing) {
|
|
14750
|
-
// return;
|
|
14751
|
-
// }
|
|
14752
14811
|
var _this = this;
|
|
14812
|
+
if (this.syncing || this.toSync.size === 0) {
|
|
14813
|
+
return;
|
|
14814
|
+
}
|
|
14815
|
+
this.syncing = true;
|
|
14753
14816
|
// bounds changed, need re-inserting its children
|
|
14754
14817
|
var bulk = [];
|
|
14755
14818
|
Array.from(this.toSync)
|
|
@@ -14787,9 +14850,10 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14787
14850
|
// use bulk inserting, which is ~2-3 times faster
|
|
14788
14851
|
// @see https://github.com/mourner/rbush#bulk-inserting-data
|
|
14789
14852
|
this.rBush.load(bulk);
|
|
14853
|
+
console.log('sync...', Array.from(this.toSync));
|
|
14790
14854
|
bulk.length = 0;
|
|
14791
14855
|
this.toSync.clear();
|
|
14792
|
-
|
|
14856
|
+
this.syncing = false;
|
|
14793
14857
|
};
|
|
14794
14858
|
PrepareRendererPlugin.tag = 'Prepare';
|
|
14795
14859
|
return PrepareRendererPlugin;
|
|
@@ -15330,6 +15394,7 @@ exports.FederatedPointerEvent = FederatedPointerEvent;
|
|
|
15330
15394
|
exports.FederatedWheelEvent = FederatedWheelEvent;
|
|
15331
15395
|
exports.Frustum = Frustum;
|
|
15332
15396
|
exports.Group = Group;
|
|
15397
|
+
exports.GroupUpdater = GroupUpdater;
|
|
15333
15398
|
exports.HTML = HTML;
|
|
15334
15399
|
exports.Image = Image;
|
|
15335
15400
|
exports.Line = Line;
|