@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.esm.js
CHANGED
|
@@ -3165,7 +3165,7 @@ var getOrCreateUnitValue = function (value, unitOrName) {
|
|
|
3165
3165
|
if (unitOrName === void 0) { unitOrName = UnitType.kNumber; }
|
|
3166
3166
|
return new CSSUnitValue(value, unitOrName);
|
|
3167
3167
|
};
|
|
3168
|
-
|
|
3168
|
+
new CSSUnitValue(50, '%');
|
|
3169
3169
|
|
|
3170
3170
|
/**
|
|
3171
3171
|
* @see https://doc.babylonjs.com/how_to/optimizing_your_scene#changing-mesh-culling-strategy
|
|
@@ -4107,19 +4107,17 @@ function parseDimensionArray(string) {
|
|
|
4107
4107
|
// },
|
|
4108
4108
|
// ];
|
|
4109
4109
|
// }
|
|
4110
|
-
function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
4111
|
-
if (
|
|
4112
|
-
return 0;
|
|
4113
|
-
}
|
|
4110
|
+
function convertPercentUnit(valueWithUnit, vec3Index, target, useMin) {
|
|
4111
|
+
if (useMin === void 0) { useMin = false; }
|
|
4114
4112
|
if (valueWithUnit.unit === UnitType.kPixels) {
|
|
4115
4113
|
return Number(valueWithUnit.value);
|
|
4116
4114
|
}
|
|
4117
4115
|
else if (valueWithUnit.unit === UnitType.kPercentage && target) {
|
|
4118
4116
|
var bounds = target.nodeName === Shape.GROUP
|
|
4119
4117
|
? target.getLocalBounds()
|
|
4120
|
-
:
|
|
4121
|
-
|
|
4122
|
-
|
|
4118
|
+
: target.getGeometryBounds();
|
|
4119
|
+
return ((useMin ? bounds.min[vec3Index] : 0) +
|
|
4120
|
+
(valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2);
|
|
4123
4121
|
}
|
|
4124
4122
|
return 0;
|
|
4125
4123
|
}
|
|
@@ -5958,7 +5956,7 @@ function convertKeyword2Percent(keyword) {
|
|
|
5958
5956
|
return '50%';
|
|
5959
5957
|
}
|
|
5960
5958
|
else if (keyword === 'left' || keyword === 'top') {
|
|
5961
|
-
return '0';
|
|
5959
|
+
return '0%';
|
|
5962
5960
|
}
|
|
5963
5961
|
else if (keyword === 'right' || keyword === 'bottom') {
|
|
5964
5962
|
return '100%';
|
|
@@ -6226,16 +6224,17 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6226
6224
|
{
|
|
6227
6225
|
n: 'transformOrigin',
|
|
6228
6226
|
p: 100,
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6227
|
+
d: '0 0',
|
|
6228
|
+
// // int: true,
|
|
6229
|
+
// d: (nodeName: string) => {
|
|
6230
|
+
// if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
6231
|
+
// return 'center';
|
|
6232
|
+
// }
|
|
6233
|
+
// if (nodeName === Shape.TEXT) {
|
|
6234
|
+
// return 'text-anchor';
|
|
6235
|
+
// }
|
|
6236
|
+
// return 'left top';
|
|
6237
|
+
// },
|
|
6239
6238
|
l: true,
|
|
6240
6239
|
syntax: PropertySyntax.TRANSFORM_ORIGIN,
|
|
6241
6240
|
},
|
|
@@ -6545,7 +6544,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6545
6544
|
d: '0',
|
|
6546
6545
|
},
|
|
6547
6546
|
];
|
|
6548
|
-
|
|
6547
|
+
BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
|
|
6549
6548
|
var propertyMetadataCache = {};
|
|
6550
6549
|
var unresolvedProperties = new WeakMap();
|
|
6551
6550
|
// const uniqueAttributeSet = new Set<string>();
|
|
@@ -6602,20 +6601,20 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6602
6601
|
}; }
|
|
6603
6602
|
if (!this.runtime.enableCSSParsing) {
|
|
6604
6603
|
Object.assign(object.attributes, attributes);
|
|
6605
|
-
var
|
|
6604
|
+
var attributeNames = Object.keys(attributes);
|
|
6606
6605
|
// clipPath
|
|
6607
6606
|
var oldClipPath = object.parsedStyle.clipPath;
|
|
6608
6607
|
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
6609
6608
|
object.parsedStyle = Object.assign(object.parsedStyle, attributes);
|
|
6610
|
-
var
|
|
6611
|
-
if (!
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
}
|
|
6609
|
+
var needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
6610
|
+
// if (!needUpdateGeometry) {
|
|
6611
|
+
// for (let i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
|
|
6612
|
+
// if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
|
|
6613
|
+
// needUpdateGeometry = true;
|
|
6614
|
+
// break;
|
|
6615
|
+
// }
|
|
6616
|
+
// }
|
|
6617
|
+
// }
|
|
6619
6618
|
if (attributes.fill) {
|
|
6620
6619
|
object.parsedStyle.fill = parseColor(attributes.fill);
|
|
6621
6620
|
}
|
|
@@ -6698,95 +6697,98 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6698
6697
|
attributes.markerMid, null, null);
|
|
6699
6698
|
}
|
|
6700
6699
|
if (!isNil(attributes.zIndex)) {
|
|
6701
|
-
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object,
|
|
6700
|
+
this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames);
|
|
6702
6701
|
}
|
|
6703
6702
|
if (!isNil(attributes.offsetDistance)) {
|
|
6704
|
-
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object,
|
|
6703
|
+
this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames);
|
|
6705
6704
|
}
|
|
6706
6705
|
if (attributes.transform) {
|
|
6707
|
-
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object,
|
|
6706
|
+
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
|
|
6708
6707
|
}
|
|
6709
|
-
if (
|
|
6710
|
-
|
|
6708
|
+
if (needUpdateGeometry) {
|
|
6709
|
+
object.geometry.dirty = true;
|
|
6710
|
+
// FIXME setOrigin may have already dirtified to root.
|
|
6711
|
+
// this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6711
6712
|
}
|
|
6712
|
-
return;
|
|
6713
6713
|
}
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
if (!skipParse) {
|
|
6727
|
-
attributeNames.forEach(function (name) {
|
|
6728
|
-
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize);
|
|
6714
|
+
else {
|
|
6715
|
+
var skipUpdateAttribute_1 = options.skipUpdateAttribute, skipParse = options.skipParse, forceUpdateGeometry = options.forceUpdateGeometry, usedAttributes = options.usedAttributes, memoize_1 = options.memoize;
|
|
6716
|
+
var needUpdateGeometry_1 = forceUpdateGeometry;
|
|
6717
|
+
var attributeNames_1 = Object.keys(attributes);
|
|
6718
|
+
attributeNames_1.forEach(function (attributeName) {
|
|
6719
|
+
var _a;
|
|
6720
|
+
if (!skipUpdateAttribute_1) {
|
|
6721
|
+
object.attributes[attributeName] = attributes[attributeName];
|
|
6722
|
+
}
|
|
6723
|
+
if (!needUpdateGeometry_1 && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
|
|
6724
|
+
needUpdateGeometry_1 = true;
|
|
6725
|
+
}
|
|
6729
6726
|
});
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
// points 50
|
|
6735
|
-
// text 50
|
|
6736
|
-
// textTransform 51
|
|
6737
|
-
// transform 100
|
|
6738
|
-
// transformOrigin 100
|
|
6739
|
-
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
6740
|
-
// uniqueAttributeSet.clear();
|
|
6741
|
-
attributeNames = Array.from(new Set(attributeNames.concat(usedAttributes)));
|
|
6742
|
-
}
|
|
6743
|
-
// [
|
|
6744
|
-
// 'path',
|
|
6745
|
-
// 'points',
|
|
6746
|
-
// 'text',
|
|
6747
|
-
// 'textTransform',
|
|
6748
|
-
// 'transform',
|
|
6749
|
-
// 'transformOrigin',
|
|
6750
|
-
// ].forEach((name) => {
|
|
6751
|
-
// const index = attributeNames.indexOf(name);
|
|
6752
|
-
// if (index > -1) {
|
|
6753
|
-
// attributeNames.splice(index, 1);
|
|
6754
|
-
// attributeNames.push(name);
|
|
6755
|
-
// }
|
|
6756
|
-
// });
|
|
6757
|
-
attributeNames.forEach(function (name) {
|
|
6758
|
-
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6759
|
-
if (name in object.computedStyle) {
|
|
6760
|
-
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize);
|
|
6727
|
+
if (!skipParse) {
|
|
6728
|
+
attributeNames_1.forEach(function (name) {
|
|
6729
|
+
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize_1);
|
|
6730
|
+
});
|
|
6761
6731
|
}
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
//
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6732
|
+
// let hasUnresolvedProperties = false;
|
|
6733
|
+
// parse according to priority
|
|
6734
|
+
// path 50
|
|
6735
|
+
// points 50
|
|
6736
|
+
// text 50
|
|
6737
|
+
// textTransform 51
|
|
6738
|
+
// transform 100
|
|
6739
|
+
// transformOrigin 100
|
|
6740
|
+
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
6741
|
+
// uniqueAttributeSet.clear();
|
|
6742
|
+
attributeNames_1 = Array.from(new Set(attributeNames_1.concat(usedAttributes)));
|
|
6743
|
+
}
|
|
6744
|
+
// [
|
|
6745
|
+
// 'path',
|
|
6746
|
+
// 'points',
|
|
6747
|
+
// 'text',
|
|
6748
|
+
// 'textTransform',
|
|
6749
|
+
// 'transform',
|
|
6750
|
+
// 'transformOrigin',
|
|
6751
|
+
// ].forEach((name) => {
|
|
6752
|
+
// const index = attributeNames.indexOf(name);
|
|
6753
|
+
// if (index > -1) {
|
|
6754
|
+
// attributeNames.splice(index, 1);
|
|
6755
|
+
// attributeNames.push(name);
|
|
6756
|
+
// }
|
|
6757
|
+
// });
|
|
6758
|
+
attributeNames_1.forEach(function (name) {
|
|
6759
|
+
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6760
|
+
if (name in object.computedStyle) {
|
|
6761
|
+
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize_1);
|
|
6762
|
+
}
|
|
6763
|
+
});
|
|
6764
|
+
// if (hasUnresolvedProperties) {
|
|
6765
|
+
// this.dirty = true;
|
|
6766
|
+
// return;
|
|
6767
|
+
// }
|
|
6768
|
+
// update geometry
|
|
6769
|
+
if (needUpdateGeometry_1) {
|
|
6770
|
+
object.geometry.dirty = true;
|
|
6771
|
+
// FIXME setOrigin may have already dirtified to root.
|
|
6772
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6776
6773
|
}
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
|
|
6781
|
-
// update children's inheritable
|
|
6782
|
-
object.children.forEach(function (child) {
|
|
6783
|
-
child.internalSetAttribute(name, null, {
|
|
6784
|
-
skipUpdateAttribute: true,
|
|
6785
|
-
skipParse: true,
|
|
6786
|
-
});
|
|
6787
|
-
});
|
|
6774
|
+
attributeNames_1.forEach(function (name) {
|
|
6775
|
+
if (name in object.parsedStyle) {
|
|
6776
|
+
_this.postProcessProperty(name, object, attributeNames_1);
|
|
6788
6777
|
}
|
|
6789
6778
|
});
|
|
6779
|
+
if (this.runtime.enableCSSParsing && object.children.length) {
|
|
6780
|
+
attributeNames_1.forEach(function (name) {
|
|
6781
|
+
if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
|
|
6782
|
+
// update children's inheritable
|
|
6783
|
+
object.children.forEach(function (child) {
|
|
6784
|
+
child.internalSetAttribute(name, null, {
|
|
6785
|
+
skipUpdateAttribute: true,
|
|
6786
|
+
skipParse: true,
|
|
6787
|
+
});
|
|
6788
|
+
});
|
|
6789
|
+
}
|
|
6790
|
+
});
|
|
6791
|
+
}
|
|
6790
6792
|
}
|
|
6791
6793
|
};
|
|
6792
6794
|
/**
|
|
@@ -7055,25 +7057,22 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7055
7057
|
geometry_1.renderBounds.setMinMax(min, max);
|
|
7056
7058
|
}
|
|
7057
7059
|
});
|
|
7058
|
-
|
|
7059
|
-
// account for negative width / height of Rect
|
|
7060
|
+
object.geometry.dirty = false;
|
|
7060
7061
|
// @see https://github.com/antvis/g/issues/957
|
|
7061
7062
|
var flipY = hwidth < 0;
|
|
7062
7063
|
var flipX = hheight < 0;
|
|
7063
|
-
// } else {
|
|
7064
|
-
// }
|
|
7065
7064
|
// set transform origin
|
|
7066
7065
|
var usedOriginXValue = (flipY ? -1 : 1) *
|
|
7067
7066
|
(transformOrigin
|
|
7068
|
-
? convertPercentUnit(transformOrigin[0], 0, object)
|
|
7067
|
+
? convertPercentUnit(transformOrigin[0], 0, object, true)
|
|
7069
7068
|
: 0);
|
|
7070
7069
|
var usedOriginYValue = (flipX ? -1 : 1) *
|
|
7071
7070
|
(transformOrigin
|
|
7072
|
-
? convertPercentUnit(transformOrigin[1], 1, object)
|
|
7071
|
+
? convertPercentUnit(transformOrigin[1], 1, object, true)
|
|
7073
7072
|
: 0);
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7073
|
+
if (usedOriginXValue || usedOriginYValue) {
|
|
7074
|
+
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
7075
|
+
}
|
|
7077
7076
|
}
|
|
7078
7077
|
};
|
|
7079
7078
|
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
@@ -7564,6 +7563,7 @@ var clock = typeof performance === 'object' && performance.now ? performance : D
|
|
|
7564
7563
|
function isFillOrStrokeAffected(pointerEvents, fill, stroke) {
|
|
7565
7564
|
// account for pointerEvents
|
|
7566
7565
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
7566
|
+
if (pointerEvents === void 0) { pointerEvents = 'auto'; }
|
|
7567
7567
|
var hasFill = false;
|
|
7568
7568
|
var hasStroke = false;
|
|
7569
7569
|
var isFillOtherThanNone = !!fill && !fill.isNone;
|
|
@@ -7810,92 +7810,121 @@ function toFontString(attributes) {
|
|
|
7810
7810
|
return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
|
|
7811
7811
|
}
|
|
7812
7812
|
|
|
7813
|
-
|
|
7813
|
+
function createSkewMatrix(skewMatrix, skewX, skewY) {
|
|
7814
|
+
// Create an identity matrix
|
|
7815
|
+
mat4.identity(skewMatrix);
|
|
7816
|
+
// Apply skew to the matrix
|
|
7817
|
+
skewMatrix[4] = Math.tan(skewX); // Skew Y axis in X direction
|
|
7818
|
+
skewMatrix[1] = Math.tan(skewY); // Skew X axis in Y direction
|
|
7819
|
+
return skewMatrix;
|
|
7820
|
+
}
|
|
7821
|
+
var tmpMat1 = mat4.create();
|
|
7822
|
+
var tmpMat2 = mat4.create();
|
|
7814
7823
|
function parsedTransformToMat4(transform, object) {
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
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
|
-
|
|
7824
|
+
if (transform.length) {
|
|
7825
|
+
var m_1 = mat4.identity(tmpMat1);
|
|
7826
|
+
transform.forEach(function (parsed) {
|
|
7827
|
+
var t = parsed.t, d = parsed.d;
|
|
7828
|
+
if (t === 'scale') {
|
|
7829
|
+
// scale(1) scale(1, 1)
|
|
7830
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1];
|
|
7831
|
+
mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], 1]);
|
|
7832
|
+
}
|
|
7833
|
+
else if (t === 'scalex') {
|
|
7834
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7835
|
+
mat4.fromScaling(tmpMat2, [newScale[0], 1, 1]);
|
|
7836
|
+
}
|
|
7837
|
+
else if (t === 'scaley') {
|
|
7838
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7839
|
+
mat4.fromScaling(tmpMat2, [1, newScale[0], 1]);
|
|
7840
|
+
}
|
|
7841
|
+
else if (t === 'scalez') {
|
|
7842
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
|
|
7843
|
+
mat4.fromScaling(tmpMat2, [1, 1, newScale[0]]);
|
|
7844
|
+
}
|
|
7845
|
+
else if (t === 'scale3d') {
|
|
7846
|
+
var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1, 1];
|
|
7847
|
+
mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], newScale[2]]);
|
|
7848
|
+
}
|
|
7849
|
+
else if (t === 'translate') {
|
|
7850
|
+
var newTranslation = d || [Opx, Opx];
|
|
7851
|
+
mat4.fromTranslation(tmpMat2, [
|
|
7852
|
+
newTranslation[0].value,
|
|
7853
|
+
newTranslation[1].value,
|
|
7854
|
+
0,
|
|
7855
|
+
]);
|
|
7856
|
+
}
|
|
7857
|
+
else if (t === 'translatex') {
|
|
7858
|
+
var newTranslation = d || [Opx];
|
|
7859
|
+
mat4.fromTranslation(tmpMat2, [newTranslation[0].value, 0, 0]);
|
|
7860
|
+
}
|
|
7861
|
+
else if (t === 'translatey') {
|
|
7862
|
+
var newTranslation = d || [Opx];
|
|
7863
|
+
mat4.fromTranslation(tmpMat2, [0, newTranslation[0].value, 0]);
|
|
7864
|
+
}
|
|
7865
|
+
else if (t === 'translatez') {
|
|
7866
|
+
var newTranslation = d || [Opx];
|
|
7867
|
+
mat4.fromTranslation(tmpMat2, [0, 0, newTranslation[0].value]);
|
|
7868
|
+
}
|
|
7869
|
+
else if (t === 'translate3d') {
|
|
7870
|
+
var newTranslation = d || [Opx, Opx, Opx];
|
|
7871
|
+
mat4.fromTranslation(tmpMat2, [
|
|
7872
|
+
newTranslation[0].value,
|
|
7873
|
+
newTranslation[1].value,
|
|
7874
|
+
newTranslation[2].value,
|
|
7875
|
+
]);
|
|
7876
|
+
}
|
|
7877
|
+
else if (t === 'rotate') {
|
|
7878
|
+
var newAngles = d || [Odeg];
|
|
7879
|
+
mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7880
|
+
}
|
|
7881
|
+
else if (t === 'rotatex') {
|
|
7882
|
+
var newAngles = d || [Odeg];
|
|
7883
|
+
mat4.fromXRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7884
|
+
}
|
|
7885
|
+
else if (t === 'rotatey') {
|
|
7886
|
+
var newAngles = d || [Odeg];
|
|
7887
|
+
mat4.fromYRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7888
|
+
}
|
|
7889
|
+
else if (t === 'rotatez') {
|
|
7890
|
+
var newAngles = d || [Odeg];
|
|
7891
|
+
mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
|
|
7892
|
+
}
|
|
7893
|
+
else if (t === 'rotate3d') {
|
|
7894
|
+
var newAngles = d || [Opx, Opx, Opx, Odeg];
|
|
7895
|
+
mat4.fromRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[3])), [
|
|
7896
|
+
newAngles[0].value,
|
|
7897
|
+
newAngles[1].value,
|
|
7898
|
+
newAngles[2].value,
|
|
7899
|
+
]);
|
|
7900
|
+
}
|
|
7901
|
+
else if (t === 'skew') {
|
|
7902
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0, 0];
|
|
7903
|
+
createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), deg2rad(newSkew[1]));
|
|
7904
|
+
}
|
|
7905
|
+
else if (t === 'skewx') {
|
|
7906
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
|
|
7907
|
+
createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), 0);
|
|
7908
|
+
}
|
|
7909
|
+
else if (t === 'skewy') {
|
|
7910
|
+
var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
|
|
7911
|
+
createSkewMatrix(tmpMat2, 0, deg2rad(newSkew[0]));
|
|
7912
|
+
}
|
|
7913
|
+
else if (t === 'matrix') {
|
|
7914
|
+
var _a = __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];
|
|
7915
|
+
mat4.set(tmpMat2, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1);
|
|
7916
|
+
}
|
|
7917
|
+
else if (t === 'matrix3d') {
|
|
7918
|
+
// @ts-ignore
|
|
7919
|
+
mat4.set.apply(mat4, __spreadArray([tmpMat2], __read(d.map(function (s) { return s.value; })), false));
|
|
7920
|
+
}
|
|
7921
|
+
mat4.mul(m_1, m_1, tmpMat2);
|
|
7922
|
+
});
|
|
7923
|
+
object.setLocalTransform(m_1);
|
|
7924
|
+
}
|
|
7925
|
+
else {
|
|
7926
|
+
object.resetLocalTransform();
|
|
7927
|
+
}
|
|
7899
7928
|
return object.getLocalTransform();
|
|
7900
7929
|
}
|
|
7901
7930
|
|
|
@@ -7959,17 +7988,18 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
|
7959
7988
|
function CSSPropertyTransformOrigin() {
|
|
7960
7989
|
this.parser = parseTransformOrigin;
|
|
7961
7990
|
this.parserUnmemoize = parseTransformOriginUnmemoize;
|
|
7962
|
-
// calculator(
|
|
7963
|
-
// name: string,
|
|
7964
|
-
// oldParsed: [CSSUnitValue, CSSUnitValue],
|
|
7965
|
-
// parsed: [CSSUnitValue, CSSUnitValue],
|
|
7966
|
-
// object: DisplayObject,
|
|
7967
|
-
// ): [number, number] {
|
|
7968
|
-
// console.log(object, parsed);
|
|
7969
|
-
// return [parsed[0].value, parsed[1].value];
|
|
7970
|
-
// // return [convertPercentUnit(parsed[0], 0, object), convertPercentUnit(parsed[1], 1, object)];
|
|
7971
|
-
// }
|
|
7972
7991
|
}
|
|
7992
|
+
CSSPropertyTransformOrigin.prototype.postProcessor = function (object) {
|
|
7993
|
+
var transformOrigin = object.parsedStyle.transformOrigin;
|
|
7994
|
+
if (transformOrigin[0].unit === UnitType.kPixels &&
|
|
7995
|
+
transformOrigin[1].unit === UnitType.kPixels) {
|
|
7996
|
+
object.setOrigin(transformOrigin[0].value, transformOrigin[1].value);
|
|
7997
|
+
}
|
|
7998
|
+
else {
|
|
7999
|
+
// Relative to geometry bounds, calculate later.
|
|
8000
|
+
object.getGeometryBounds();
|
|
8001
|
+
}
|
|
8002
|
+
};
|
|
7973
8003
|
return CSSPropertyTransformOrigin;
|
|
7974
8004
|
}());
|
|
7975
8005
|
|
|
@@ -8219,6 +8249,20 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8219
8249
|
return TextUpdater;
|
|
8220
8250
|
}());
|
|
8221
8251
|
|
|
8252
|
+
var GroupUpdater = /** @class */ (function () {
|
|
8253
|
+
function GroupUpdater() {
|
|
8254
|
+
}
|
|
8255
|
+
GroupUpdater.prototype.update = function (parsedStyle, object) {
|
|
8256
|
+
return {
|
|
8257
|
+
cx: 0,
|
|
8258
|
+
cy: 0,
|
|
8259
|
+
hwidth: 0,
|
|
8260
|
+
hheight: 0,
|
|
8261
|
+
};
|
|
8262
|
+
};
|
|
8263
|
+
return GroupUpdater;
|
|
8264
|
+
}());
|
|
8265
|
+
|
|
8222
8266
|
function isFederatedEvent(value) {
|
|
8223
8267
|
return !!value.type;
|
|
8224
8268
|
}
|
|
@@ -8769,7 +8813,7 @@ var EventTarget = /** @class */ (function () {
|
|
|
8769
8813
|
var Node = /** @class */ (function (_super) {
|
|
8770
8814
|
__extends(Node, _super);
|
|
8771
8815
|
function Node() {
|
|
8772
|
-
var _this = _super.
|
|
8816
|
+
var _this = _super.call(this) || this;
|
|
8773
8817
|
_this.shadow = false;
|
|
8774
8818
|
/**
|
|
8775
8819
|
* points to canvas.document
|
|
@@ -9997,7 +10041,7 @@ var RenderingService = /** @class */ (function () {
|
|
|
9997
10041
|
this.zIndexCounter = 0;
|
|
9998
10042
|
var renderingContext = this.context.renderingContext;
|
|
9999
10043
|
this.globalRuntime.sceneGraphService.syncHierarchy(renderingContext.root);
|
|
10000
|
-
this.globalRuntime.sceneGraphService.triggerPendingEvents();
|
|
10044
|
+
// this.globalRuntime.sceneGraphService.triggerPendingEvents();
|
|
10001
10045
|
if (renderingContext.renderReasons.size && this.inited) {
|
|
10002
10046
|
// @ts-ignore
|
|
10003
10047
|
renderingContext.dirtyRectangleRenderingDisabled =
|
|
@@ -10318,9 +10362,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10318
10362
|
*/
|
|
10319
10363
|
this.rotate = (function () {
|
|
10320
10364
|
var parentInvertRotation = quat$1.create();
|
|
10321
|
-
return function (element, degrees, y, z) {
|
|
10365
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10322
10366
|
if (y === void 0) { y = 0; }
|
|
10323
10367
|
if (z === void 0) { z = 0; }
|
|
10368
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10324
10369
|
if (typeof degrees === 'number') {
|
|
10325
10370
|
degrees = vec3.fromValues(degrees, y, z);
|
|
10326
10371
|
}
|
|
@@ -10339,7 +10384,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10339
10384
|
quat$1.multiply(rotation, parentInvertRotation, rotation);
|
|
10340
10385
|
quat$1.multiply(transform.localRotation, rotation, rot);
|
|
10341
10386
|
quat$1.normalize(transform.localRotation, transform.localRotation);
|
|
10342
|
-
|
|
10387
|
+
if (dirtify) {
|
|
10388
|
+
_this.dirtifyLocal(element, transform);
|
|
10389
|
+
}
|
|
10343
10390
|
}
|
|
10344
10391
|
};
|
|
10345
10392
|
})();
|
|
@@ -10349,16 +10396,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10349
10396
|
*/
|
|
10350
10397
|
this.rotateLocal = (function () {
|
|
10351
10398
|
var rotation = quat$1.create();
|
|
10352
|
-
return function (element, degrees, y, z) {
|
|
10399
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10353
10400
|
if (y === void 0) { y = 0; }
|
|
10354
10401
|
if (z === void 0) { z = 0; }
|
|
10402
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10355
10403
|
if (typeof degrees === 'number') {
|
|
10356
10404
|
degrees = vec3.fromValues(degrees, y, z);
|
|
10357
10405
|
}
|
|
10358
10406
|
var transform = element.transformable;
|
|
10359
10407
|
quat$1.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
|
|
10360
10408
|
quat$1.mul(transform.localRotation, transform.localRotation, rotation);
|
|
10361
|
-
|
|
10409
|
+
if (dirtify) {
|
|
10410
|
+
_this.dirtifyLocal(element, transform);
|
|
10411
|
+
}
|
|
10362
10412
|
};
|
|
10363
10413
|
})();
|
|
10364
10414
|
/**
|
|
@@ -10366,9 +10416,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10366
10416
|
*/
|
|
10367
10417
|
this.setEulerAngles = (function () {
|
|
10368
10418
|
var invParentRot = quat$1.create();
|
|
10369
|
-
return function (element, degrees, y, z) {
|
|
10419
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10370
10420
|
if (y === void 0) { y = 0; }
|
|
10371
10421
|
if (z === void 0) { z = 0; }
|
|
10422
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10372
10423
|
if (typeof degrees === 'number') {
|
|
10373
10424
|
degrees = vec3.fromValues(degrees, y, z);
|
|
10374
10425
|
}
|
|
@@ -10382,7 +10433,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10382
10433
|
var parentRotation = _this.getRotation(element.parentNode);
|
|
10383
10434
|
quat$1.copy(invParentRot, quat$1.invert(quat$1.create(), parentRotation));
|
|
10384
10435
|
quat$1.mul(transform.localRotation, transform.localRotation, invParentRot);
|
|
10385
|
-
|
|
10436
|
+
if (dirtify) {
|
|
10437
|
+
_this.dirtifyLocal(element, transform);
|
|
10438
|
+
}
|
|
10386
10439
|
}
|
|
10387
10440
|
};
|
|
10388
10441
|
})();
|
|
@@ -10396,9 +10449,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10396
10449
|
* ```
|
|
10397
10450
|
*/
|
|
10398
10451
|
this.translateLocal = (function () {
|
|
10399
|
-
return function (element, translation, y, z) {
|
|
10452
|
+
return function (element, translation, y, z, dirtify) {
|
|
10400
10453
|
if (y === void 0) { y = 0; }
|
|
10401
10454
|
if (z === void 0) { z = 0; }
|
|
10455
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10402
10456
|
if (typeof translation === 'number') {
|
|
10403
10457
|
translation = vec3.fromValues(translation, y, z);
|
|
10404
10458
|
}
|
|
@@ -10408,7 +10462,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10408
10462
|
}
|
|
10409
10463
|
vec3.transformQuat(translation, translation, transform.localRotation);
|
|
10410
10464
|
vec3.add(transform.localPosition, transform.localPosition, translation);
|
|
10411
|
-
|
|
10465
|
+
if (dirtify) {
|
|
10466
|
+
_this.dirtifyLocal(element, transform);
|
|
10467
|
+
}
|
|
10412
10468
|
};
|
|
10413
10469
|
})();
|
|
10414
10470
|
/**
|
|
@@ -10420,7 +10476,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10420
10476
|
this.setPosition = (function () {
|
|
10421
10477
|
var parentInvertMatrix = mat4.create();
|
|
10422
10478
|
var tmpPosition = vec3.create();
|
|
10423
|
-
return function (element, position) {
|
|
10479
|
+
return function (element, position, dirtify) {
|
|
10480
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10424
10481
|
var transform = element.transformable;
|
|
10425
10482
|
tmpPosition[0] = position[0];
|
|
10426
10483
|
tmpPosition[1] = position[1];
|
|
@@ -10439,7 +10496,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10439
10496
|
mat4.invert(parentInvertMatrix, parentInvertMatrix);
|
|
10440
10497
|
vec3.transformMat4(transform.localPosition, tmpPosition, parentInvertMatrix);
|
|
10441
10498
|
}
|
|
10442
|
-
|
|
10499
|
+
if (dirtify) {
|
|
10500
|
+
_this.dirtifyLocal(element, transform);
|
|
10501
|
+
}
|
|
10443
10502
|
};
|
|
10444
10503
|
})();
|
|
10445
10504
|
/**
|
|
@@ -10447,7 +10506,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10447
10506
|
*/
|
|
10448
10507
|
this.setLocalPosition = (function () {
|
|
10449
10508
|
var tmpPosition = vec3.create();
|
|
10450
|
-
return function (element, position) {
|
|
10509
|
+
return function (element, position, dirtify) {
|
|
10510
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10451
10511
|
var transform = element.transformable;
|
|
10452
10512
|
tmpPosition[0] = position[0];
|
|
10453
10513
|
tmpPosition[1] = position[1];
|
|
@@ -10456,7 +10516,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10456
10516
|
return;
|
|
10457
10517
|
}
|
|
10458
10518
|
vec3.copy(transform.localPosition, tmpPosition);
|
|
10459
|
-
|
|
10519
|
+
if (dirtify) {
|
|
10520
|
+
_this.dirtifyLocal(element, transform);
|
|
10521
|
+
}
|
|
10460
10522
|
};
|
|
10461
10523
|
})();
|
|
10462
10524
|
/**
|
|
@@ -10475,9 +10537,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10475
10537
|
var zeroVec3 = vec3.create();
|
|
10476
10538
|
var tmpVec3 = vec3.create();
|
|
10477
10539
|
var tr = vec3.create();
|
|
10478
|
-
return function (element, translation, y, z) {
|
|
10540
|
+
return function (element, translation, y, z, dirtify) {
|
|
10479
10541
|
if (y === void 0) { y = 0; }
|
|
10480
10542
|
if (z === void 0) { z = 0; }
|
|
10543
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10481
10544
|
if (typeof translation === 'number') {
|
|
10482
10545
|
translation = vec3.set(tmpVec3, translation, y, z);
|
|
10483
10546
|
}
|
|
@@ -10485,12 +10548,13 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10485
10548
|
return;
|
|
10486
10549
|
}
|
|
10487
10550
|
vec3.add(tr, _this.getPosition(element), translation);
|
|
10488
|
-
_this.setPosition(element, tr);
|
|
10551
|
+
_this.setPosition(element, tr, dirtify);
|
|
10489
10552
|
};
|
|
10490
10553
|
})();
|
|
10491
10554
|
this.setRotation = function () {
|
|
10492
10555
|
var parentInvertRotation = quat$1.create();
|
|
10493
|
-
return function (element, rotation, y, z, w) {
|
|
10556
|
+
return function (element, rotation, y, z, w, dirtify) {
|
|
10557
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10494
10558
|
var transform = element.transformable;
|
|
10495
10559
|
if (typeof rotation === 'number') {
|
|
10496
10560
|
rotation = quat$1.fromValues(rotation, y, z, w);
|
|
@@ -10505,7 +10569,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10505
10569
|
quat$1.invert(parentInvertRotation, parentInvertRotation);
|
|
10506
10570
|
quat$1.multiply(transform.localRotation, parentInvertRotation, rotation);
|
|
10507
10571
|
quat$1.normalize(transform.localRotation, transform.localRotation);
|
|
10508
|
-
|
|
10572
|
+
if (dirtify) {
|
|
10573
|
+
_this.dirtifyLocal(element, transform);
|
|
10574
|
+
}
|
|
10509
10575
|
}
|
|
10510
10576
|
};
|
|
10511
10577
|
};
|
|
@@ -10546,7 +10612,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10546
10612
|
// .filter((node) => !node.shadow);
|
|
10547
10613
|
};
|
|
10548
10614
|
DefaultSceneGraphService.prototype.attach = function (child, parent, index) {
|
|
10549
|
-
var _a
|
|
10615
|
+
var _a;
|
|
10550
10616
|
var detached = false;
|
|
10551
10617
|
if (child.parentNode) {
|
|
10552
10618
|
detached = child.parentNode !== parent;
|
|
@@ -10562,7 +10628,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10562
10628
|
// parent needs re-sort
|
|
10563
10629
|
var sortable = parent.sortable;
|
|
10564
10630
|
if (((_a = sortable === null || sortable === void 0 ? void 0 : sortable.sorted) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
10565
|
-
|
|
10631
|
+
child.parsedStyle.zIndex) {
|
|
10566
10632
|
if (sortable.dirtyChildren.indexOf(child) === -1) {
|
|
10567
10633
|
sortable.dirtyChildren.push(child);
|
|
10568
10634
|
}
|
|
@@ -10616,6 +10682,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10616
10682
|
}
|
|
10617
10683
|
};
|
|
10618
10684
|
DefaultSceneGraphService.prototype.getOrigin = function (element) {
|
|
10685
|
+
element.getGeometryBounds();
|
|
10619
10686
|
return element.transformable.origin;
|
|
10620
10687
|
};
|
|
10621
10688
|
/**
|
|
@@ -10647,40 +10714,52 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10647
10714
|
/**
|
|
10648
10715
|
* set euler angles(degrees) in local space
|
|
10649
10716
|
*/
|
|
10650
|
-
DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z) {
|
|
10717
|
+
DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z, dirtify) {
|
|
10651
10718
|
if (y === void 0) { y = 0; }
|
|
10652
10719
|
if (z === void 0) { z = 0; }
|
|
10720
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10653
10721
|
if (typeof degrees === 'number') {
|
|
10654
10722
|
degrees = vec3.fromValues(degrees, y, z);
|
|
10655
10723
|
}
|
|
10656
10724
|
var transform = element.transformable;
|
|
10657
10725
|
quat$1.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
10658
|
-
|
|
10726
|
+
if (dirtify) {
|
|
10727
|
+
this.dirtifyLocal(element, transform);
|
|
10728
|
+
}
|
|
10659
10729
|
};
|
|
10660
10730
|
/**
|
|
10661
10731
|
* scale in local space
|
|
10662
10732
|
*/
|
|
10663
|
-
DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling) {
|
|
10733
|
+
DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling, dirtify) {
|
|
10734
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10664
10735
|
var transform = element.transformable;
|
|
10665
10736
|
vec3.multiply(transform.localScale, transform.localScale, vec3.fromValues(scaling[0], scaling[1], scaling[2] || 1));
|
|
10666
|
-
|
|
10737
|
+
if (dirtify) {
|
|
10738
|
+
this.dirtifyLocal(element, transform);
|
|
10739
|
+
}
|
|
10667
10740
|
};
|
|
10668
|
-
DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling) {
|
|
10741
|
+
DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling, dirtify) {
|
|
10742
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10669
10743
|
var transform = element.transformable;
|
|
10670
10744
|
var updatedScaling = vec3.fromValues(scaling[0], scaling[1], scaling[2] || transform.localScale[2]);
|
|
10671
10745
|
if (vec3.equals(updatedScaling, transform.localScale)) {
|
|
10672
10746
|
return;
|
|
10673
10747
|
}
|
|
10674
10748
|
vec3.copy(transform.localScale, updatedScaling);
|
|
10675
|
-
|
|
10749
|
+
if (dirtify) {
|
|
10750
|
+
this.dirtifyLocal(element, transform);
|
|
10751
|
+
}
|
|
10676
10752
|
};
|
|
10677
|
-
DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w) {
|
|
10753
|
+
DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w, dirtify) {
|
|
10754
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10678
10755
|
if (typeof rotation === 'number') {
|
|
10679
10756
|
rotation = quat$1.fromValues(rotation, y, z, w);
|
|
10680
10757
|
}
|
|
10681
10758
|
var transform = element.transformable;
|
|
10682
10759
|
quat$1.copy(transform.localRotation, rotation);
|
|
10683
|
-
|
|
10760
|
+
if (dirtify) {
|
|
10761
|
+
this.dirtifyLocal(element, transform);
|
|
10762
|
+
}
|
|
10684
10763
|
};
|
|
10685
10764
|
DefaultSceneGraphService.prototype.setLocalSkew = function (element, skew, y) {
|
|
10686
10765
|
if (typeof skew === 'number') {
|
|
@@ -10844,9 +10923,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10844
10923
|
var t = mat4.getTranslation(vec3.create(), transform);
|
|
10845
10924
|
var r = mat4.getRotation(quat$1.create(), transform);
|
|
10846
10925
|
var s = mat4.getScaling(vec3.create(), transform);
|
|
10847
|
-
this.setLocalScale(element, s);
|
|
10848
|
-
this.setLocalPosition(element, t);
|
|
10849
|
-
this.setLocalRotation(element, r);
|
|
10926
|
+
this.setLocalScale(element, s, false);
|
|
10927
|
+
this.setLocalPosition(element, t, false);
|
|
10928
|
+
this.setLocalRotation(element, r, undefined, undefined, undefined, false);
|
|
10929
|
+
this.dirtifyLocal(element, element.transformable);
|
|
10850
10930
|
};
|
|
10851
10931
|
DefaultSceneGraphService.prototype.resetLocalTransform = function (element) {
|
|
10852
10932
|
this.setLocalScale(element, [1, 1, 1]);
|
|
@@ -10872,6 +10952,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10872
10952
|
DefaultSceneGraphService.prototype.getGeometryBounds = function (element, render) {
|
|
10873
10953
|
if (render === void 0) { render = false; }
|
|
10874
10954
|
var geometry = element.geometry;
|
|
10955
|
+
if (geometry.dirty) {
|
|
10956
|
+
runtime.styleValueRegistry.updateGeometry(element);
|
|
10957
|
+
}
|
|
10875
10958
|
var bounds = render
|
|
10876
10959
|
? geometry.renderBounds
|
|
10877
10960
|
: geometry.contentBounds || null;
|
|
@@ -11462,7 +11545,7 @@ var geometryUpdaterFactory = (function () {
|
|
|
11462
11545
|
_a[Shape.ELLIPSE] = new EllipseUpdater(),
|
|
11463
11546
|
_a[Shape.RECT] = rectUpdater,
|
|
11464
11547
|
_a[Shape.IMAGE] = rectUpdater,
|
|
11465
|
-
_a[Shape.GROUP] =
|
|
11548
|
+
_a[Shape.GROUP] = new GroupUpdater(),
|
|
11466
11549
|
_a[Shape.LINE] = new LineUpdater(),
|
|
11467
11550
|
_a[Shape.TEXT] = new TextUpdater(runtime),
|
|
11468
11551
|
_a[Shape.POLYLINE] = polylineUpdater,
|
|
@@ -11539,12 +11622,13 @@ runtime.globalThis = getGlobalThis();
|
|
|
11539
11622
|
runtime.enableCSSParsing = true;
|
|
11540
11623
|
runtime.enableDataset = false;
|
|
11541
11624
|
runtime.enableStyleSyntax = true;
|
|
11625
|
+
runtime.enableAttributeDashCased = false;
|
|
11542
11626
|
|
|
11543
11627
|
var entityCounter = 0;
|
|
11544
11628
|
function resetEntityCounter() {
|
|
11545
11629
|
entityCounter = 0;
|
|
11546
11630
|
}
|
|
11547
|
-
|
|
11631
|
+
new MutationEvent(ElementEvent.INSERTED, null, '', '', '', 0, '', '');
|
|
11548
11632
|
var removedEvent = new MutationEvent(ElementEvent.REMOVED, null, '', '', '', 0, '', '');
|
|
11549
11633
|
var destroyEvent = new CustomEvent(ElementEvent.DESTROY);
|
|
11550
11634
|
/**
|
|
@@ -11556,7 +11640,7 @@ var destroyEvent = new CustomEvent(ElementEvent.DESTROY);
|
|
|
11556
11640
|
var Element = /** @class */ (function (_super) {
|
|
11557
11641
|
__extends(Element, _super);
|
|
11558
11642
|
function Element() {
|
|
11559
|
-
var _this = _super.
|
|
11643
|
+
var _this = _super.call(this) || this;
|
|
11560
11644
|
/**
|
|
11561
11645
|
* Unique id.
|
|
11562
11646
|
*/
|
|
@@ -11600,6 +11684,7 @@ var Element = /** @class */ (function (_super) {
|
|
|
11600
11684
|
_this.geometry = {
|
|
11601
11685
|
contentBounds: undefined,
|
|
11602
11686
|
renderBounds: undefined,
|
|
11687
|
+
dirty: true,
|
|
11603
11688
|
};
|
|
11604
11689
|
_this.rBushNode = {
|
|
11605
11690
|
aabb: undefined,
|
|
@@ -11783,11 +11868,8 @@ var Element = /** @class */ (function (_super) {
|
|
|
11783
11868
|
if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
|
|
11784
11869
|
this.ownerDocument.defaultView.mountChildren(child);
|
|
11785
11870
|
}
|
|
11786
|
-
//
|
|
11787
|
-
|
|
11788
|
-
insertedEvent.relatedNode = this;
|
|
11789
|
-
child.dispatchEvent(insertedEvent);
|
|
11790
|
-
}
|
|
11871
|
+
// insertedEvent.relatedNode = this as IElement;
|
|
11872
|
+
// child.dispatchEvent(insertedEvent);
|
|
11791
11873
|
return child;
|
|
11792
11874
|
};
|
|
11793
11875
|
Element.prototype.insertBefore = function (newChild, refChild) {
|
|
@@ -12060,8 +12142,10 @@ var Element = /** @class */ (function (_super) {
|
|
|
12060
12142
|
}
|
|
12061
12143
|
var value = this.attributes[name];
|
|
12062
12144
|
if (value === undefined) {
|
|
12063
|
-
|
|
12064
|
-
|
|
12145
|
+
if (runtime.enableAttributeDashCased) {
|
|
12146
|
+
var attributeName = formatAttributeName(name);
|
|
12147
|
+
value = this.attributes[attributeName];
|
|
12148
|
+
}
|
|
12065
12149
|
// if the given attribute does not exist, the value returned will either be null or ""
|
|
12066
12150
|
return runtime.enableCSSParsing ? (isNil(value) ? null : value) : value;
|
|
12067
12151
|
}
|
|
@@ -12167,7 +12251,20 @@ var DEFAULT_PARSED_STYLE_PROPS = {
|
|
|
12167
12251
|
shadowType: 'outer',
|
|
12168
12252
|
miterLimit: 10,
|
|
12169
12253
|
};
|
|
12170
|
-
|
|
12254
|
+
// const DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED = {
|
|
12255
|
+
// ...DEFAULT_PARSED_STYLE_PROPS,
|
|
12256
|
+
// opacity: 1,
|
|
12257
|
+
// fillOpacity: 1,
|
|
12258
|
+
// strokeOpacity: 1,
|
|
12259
|
+
// visibility: 'visible',
|
|
12260
|
+
// pointerEvents: 'auto',
|
|
12261
|
+
// lineWidth: 1,
|
|
12262
|
+
// lineCap: 'butt',
|
|
12263
|
+
// lineJoin: 'miter',
|
|
12264
|
+
// increasedLineWidthForHitTesting: 0,
|
|
12265
|
+
// fillRule: 'nonzero',
|
|
12266
|
+
// // TODO: transformOrigin
|
|
12267
|
+
// };
|
|
12171
12268
|
var INHERITABLE_BASE_STYLE_PROPS = [
|
|
12172
12269
|
'opacity',
|
|
12173
12270
|
'fillOpacity',
|
|
@@ -12229,8 +12326,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12229
12326
|
// assign name, id to config
|
|
12230
12327
|
// eg. group.get('name')
|
|
12231
12328
|
_this.config = config;
|
|
12232
|
-
// compatible with G 3.0
|
|
12233
|
-
// this.config.interactive = this.config.capture ?? this.config.interactive;
|
|
12234
12329
|
// init scene graph node
|
|
12235
12330
|
_this.id = _this.config.id || '';
|
|
12236
12331
|
_this.name = _this.config.name || '';
|
|
@@ -12238,29 +12333,9 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12238
12333
|
_this.className = _this.config.className || _this.config.class;
|
|
12239
12334
|
}
|
|
12240
12335
|
_this.nodeName = _this.config.type || Shape.GROUP;
|
|
12241
|
-
// // compatible with G 3.0
|
|
12242
|
-
// this.config.style =
|
|
12243
|
-
// this.config.style || this.config.attrs || ({} as StyleProps);
|
|
12244
|
-
// // Object.assign(this.config.style, this.config.attrs);
|
|
12245
|
-
// // this.config.style = {
|
|
12246
|
-
// // // ...DEFAULT_STYLE_PROPS,
|
|
12247
|
-
// // ...this.config.style,
|
|
12248
|
-
// // ...this.config.attrs,
|
|
12249
|
-
// // };
|
|
12250
|
-
// if (this.config.visible != null) {
|
|
12251
|
-
// this.config.style.visibility =
|
|
12252
|
-
// this.config.visible === false ? 'hidden' : 'visible';
|
|
12253
|
-
// }
|
|
12254
|
-
// if (this.config.interactive != null) {
|
|
12255
|
-
// this.config.style.pointerEvents =
|
|
12256
|
-
// this.config.interactive === false ? 'none' : 'auto';
|
|
12257
|
-
// }
|
|
12258
|
-
// merge parsed value
|
|
12259
|
-
Object.assign(_this.parsedStyle, runtime.enableCSSParsing
|
|
12260
|
-
? DEFAULT_PARSED_STYLE_PROPS
|
|
12261
|
-
: DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED, _this.config.initialParsedStyle);
|
|
12262
12336
|
if (runtime.enableCSSParsing) {
|
|
12263
12337
|
Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
|
|
12338
|
+
Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
|
|
12264
12339
|
}
|
|
12265
12340
|
// start to process attributes
|
|
12266
12341
|
_this.initAttributes(_this.config.style);
|
|
@@ -12384,10 +12459,14 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12384
12459
|
options.usedAttributes = INHERITABLE_STYLE_PROPS;
|
|
12385
12460
|
}
|
|
12386
12461
|
// account for FCP, process properties as less as possible
|
|
12387
|
-
var formattedAttributes =
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
formattedAttributes
|
|
12462
|
+
var formattedAttributes = attributes;
|
|
12463
|
+
if (runtime.enableAttributeDashCased) {
|
|
12464
|
+
// @ts-ignore
|
|
12465
|
+
formattedAttributes = {};
|
|
12466
|
+
for (var name_1 in attributes) {
|
|
12467
|
+
var attributeName = formatAttributeName(name_1);
|
|
12468
|
+
formattedAttributes[attributeName] = attributes[name_1];
|
|
12469
|
+
}
|
|
12391
12470
|
}
|
|
12392
12471
|
runtime.styleValueRegistry.processProperties(this, formattedAttributes, options);
|
|
12393
12472
|
// redraw at next frame
|
|
@@ -12396,14 +12475,16 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12396
12475
|
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12397
12476
|
if (force === void 0) { force = false; }
|
|
12398
12477
|
if (memoize === void 0) { memoize = true; }
|
|
12399
|
-
|
|
12478
|
+
if (runtime.enableAttributeDashCased) {
|
|
12479
|
+
name = formatAttributeName(name);
|
|
12480
|
+
}
|
|
12400
12481
|
// ignore undefined value
|
|
12401
12482
|
if (isUndefined(value)) {
|
|
12402
12483
|
return;
|
|
12403
12484
|
}
|
|
12404
|
-
if (force || value !== this.attributes[
|
|
12405
|
-
this.internalSetAttribute(
|
|
12406
|
-
_super.prototype.setAttribute.call(this,
|
|
12485
|
+
if (force || value !== this.attributes[name]) {
|
|
12486
|
+
this.internalSetAttribute(name, value, { memoize: memoize });
|
|
12487
|
+
_super.prototype.setAttribute.call(this, name, value);
|
|
12407
12488
|
}
|
|
12408
12489
|
};
|
|
12409
12490
|
/**
|
|
@@ -12657,8 +12738,10 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12657
12738
|
* shortcut for Used value of `visibility`
|
|
12658
12739
|
*/
|
|
12659
12740
|
DisplayObject.prototype.isVisible = function () {
|
|
12660
|
-
var _a;
|
|
12661
|
-
return
|
|
12741
|
+
var _a, _b;
|
|
12742
|
+
return runtime.enableCSSParsing
|
|
12743
|
+
? ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible'
|
|
12744
|
+
: ((_b = this.parsedStyle) === null || _b === void 0 ? void 0 : _b.visibility) !== 'hidden';
|
|
12662
12745
|
};
|
|
12663
12746
|
Object.defineProperty(DisplayObject.prototype, "interactive", {
|
|
12664
12747
|
get: function () {
|
|
@@ -12901,124 +12984,13 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12901
12984
|
return DisplayObject;
|
|
12902
12985
|
}(Element));
|
|
12903
12986
|
|
|
12904
|
-
/**
|
|
12905
|
-
* holds useful CSS-related methods.
|
|
12906
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
12907
|
-
*
|
|
12908
|
-
* * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
|
|
12909
|
-
* * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
12910
|
-
* * CSS Layout API
|
|
12911
|
-
*/
|
|
12912
|
-
var CSS = {
|
|
12913
|
-
/**
|
|
12914
|
-
* <number>
|
|
12915
|
-
* @see https://drafts.csswg.org/css-values-4/#number-value
|
|
12916
|
-
*/
|
|
12917
|
-
number: function (n) {
|
|
12918
|
-
return new CSSUnitValue(n);
|
|
12919
|
-
},
|
|
12920
|
-
/**
|
|
12921
|
-
* <percentage>
|
|
12922
|
-
* @see https://drafts.csswg.org/css-values-4/#percentage-value
|
|
12923
|
-
*/
|
|
12924
|
-
percent: function (n) {
|
|
12925
|
-
return new CSSUnitValue(n, '%');
|
|
12926
|
-
},
|
|
12927
|
-
/**
|
|
12928
|
-
* <length>
|
|
12929
|
-
*/
|
|
12930
|
-
px: function (n) {
|
|
12931
|
-
return new CSSUnitValue(n, 'px');
|
|
12932
|
-
},
|
|
12933
|
-
/**
|
|
12934
|
-
* <length>
|
|
12935
|
-
*/
|
|
12936
|
-
em: function (n) {
|
|
12937
|
-
return new CSSUnitValue(n, 'em');
|
|
12938
|
-
},
|
|
12939
|
-
rem: function (n) {
|
|
12940
|
-
return new CSSUnitValue(n, 'rem');
|
|
12941
|
-
},
|
|
12942
|
-
/**
|
|
12943
|
-
* <angle>
|
|
12944
|
-
*/
|
|
12945
|
-
deg: function (n) {
|
|
12946
|
-
return new CSSUnitValue(n, 'deg');
|
|
12947
|
-
},
|
|
12948
|
-
/**
|
|
12949
|
-
* <angle>
|
|
12950
|
-
*/
|
|
12951
|
-
grad: function (n) {
|
|
12952
|
-
return new CSSUnitValue(n, 'grad');
|
|
12953
|
-
},
|
|
12954
|
-
/**
|
|
12955
|
-
* <angle>
|
|
12956
|
-
*/
|
|
12957
|
-
rad: function (n) {
|
|
12958
|
-
return new CSSUnitValue(n, 'rad');
|
|
12959
|
-
},
|
|
12960
|
-
/**
|
|
12961
|
-
* <angle>
|
|
12962
|
-
*/
|
|
12963
|
-
turn: function (n) {
|
|
12964
|
-
return new CSSUnitValue(n, 'turn');
|
|
12965
|
-
},
|
|
12966
|
-
/**
|
|
12967
|
-
* <time>
|
|
12968
|
-
*/
|
|
12969
|
-
s: function (n) {
|
|
12970
|
-
return new CSSUnitValue(n, 's');
|
|
12971
|
-
},
|
|
12972
|
-
/**
|
|
12973
|
-
* <time>
|
|
12974
|
-
*/
|
|
12975
|
-
ms: function (n) {
|
|
12976
|
-
return new CSSUnitValue(n, 'ms');
|
|
12977
|
-
},
|
|
12978
|
-
/**
|
|
12979
|
-
* CSS Properties & Values API
|
|
12980
|
-
*
|
|
12981
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
|
|
12982
|
-
* @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
|
|
12983
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
12984
|
-
*/
|
|
12985
|
-
registerProperty: function (definition) {
|
|
12986
|
-
var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
|
|
12987
|
-
runtime.styleValueRegistry.registerMetadata({
|
|
12988
|
-
n: name,
|
|
12989
|
-
inh: inherits,
|
|
12990
|
-
int: interpolable,
|
|
12991
|
-
d: initialValue,
|
|
12992
|
-
syntax: syntax,
|
|
12993
|
-
});
|
|
12994
|
-
},
|
|
12995
|
-
/**
|
|
12996
|
-
* CSS Layout API
|
|
12997
|
-
* register layout
|
|
12998
|
-
*
|
|
12999
|
-
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
13000
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
13001
|
-
*/
|
|
13002
|
-
registerLayout: function (name, clazz) {
|
|
13003
|
-
runtime.layoutRegistry.registerLayout(name, clazz);
|
|
13004
|
-
},
|
|
13005
|
-
};
|
|
13006
|
-
|
|
13007
12987
|
var Circle = /** @class */ (function (_super) {
|
|
13008
12988
|
__extends(Circle, _super);
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
if (_a === void 0) { _a = {}; }
|
|
13015
|
-
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13016
|
-
return _super.call(this, __assign({ type: Shape.CIRCLE, style: runtime.enableCSSParsing
|
|
13017
|
-
? __assign({ cx: '', cy: '', r: '' }, style) : __assign({}, style), initialParsedStyle: {
|
|
13018
|
-
transformOrigin: runtime.enableCSSParsing
|
|
13019
|
-
? null
|
|
13020
|
-
: [PECENTAGE_50, PECENTAGE_50],
|
|
13021
|
-
} }, rest)) || this;
|
|
12989
|
+
function Circle(options) {
|
|
12990
|
+
if (options === void 0) { options = {}; }
|
|
12991
|
+
var _this = _super.call(this, options) || this;
|
|
12992
|
+
_this.nodeName = Shape.CIRCLE;
|
|
12993
|
+
return _this;
|
|
13022
12994
|
}
|
|
13023
12995
|
return Circle;
|
|
13024
12996
|
}(DisplayObject));
|
|
@@ -13047,15 +13019,11 @@ var CustomElement = /** @class */ (function (_super) {
|
|
|
13047
13019
|
|
|
13048
13020
|
var Ellipse = /** @class */ (function (_super) {
|
|
13049
13021
|
__extends(Ellipse, _super);
|
|
13050
|
-
function Ellipse(
|
|
13051
|
-
if (
|
|
13052
|
-
var
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
transformOrigin: runtime.enableCSSParsing
|
|
13056
|
-
? null
|
|
13057
|
-
: [PECENTAGE_50, PECENTAGE_50],
|
|
13058
|
-
} }, rest)) || this;
|
|
13022
|
+
function Ellipse(options) {
|
|
13023
|
+
if (options === void 0) { options = {}; }
|
|
13024
|
+
var _this = _super.call(this, options) || this;
|
|
13025
|
+
_this.nodeName = Shape.ELLIPSE;
|
|
13026
|
+
return _this;
|
|
13059
13027
|
}
|
|
13060
13028
|
return Ellipse;
|
|
13061
13029
|
}(DisplayObject));
|
|
@@ -13806,6 +13774,109 @@ var CustomElementRegistry = /** @class */ (function () {
|
|
|
13806
13774
|
return CustomElementRegistry;
|
|
13807
13775
|
}());
|
|
13808
13776
|
|
|
13777
|
+
/**
|
|
13778
|
+
* holds useful CSS-related methods.
|
|
13779
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
13780
|
+
*
|
|
13781
|
+
* * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
|
|
13782
|
+
* * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13783
|
+
* * CSS Layout API
|
|
13784
|
+
*/
|
|
13785
|
+
var CSS = {
|
|
13786
|
+
/**
|
|
13787
|
+
* <number>
|
|
13788
|
+
* @see https://drafts.csswg.org/css-values-4/#number-value
|
|
13789
|
+
*/
|
|
13790
|
+
number: function (n) {
|
|
13791
|
+
return new CSSUnitValue(n);
|
|
13792
|
+
},
|
|
13793
|
+
/**
|
|
13794
|
+
* <percentage>
|
|
13795
|
+
* @see https://drafts.csswg.org/css-values-4/#percentage-value
|
|
13796
|
+
*/
|
|
13797
|
+
percent: function (n) {
|
|
13798
|
+
return new CSSUnitValue(n, '%');
|
|
13799
|
+
},
|
|
13800
|
+
/**
|
|
13801
|
+
* <length>
|
|
13802
|
+
*/
|
|
13803
|
+
px: function (n) {
|
|
13804
|
+
return new CSSUnitValue(n, 'px');
|
|
13805
|
+
},
|
|
13806
|
+
/**
|
|
13807
|
+
* <length>
|
|
13808
|
+
*/
|
|
13809
|
+
em: function (n) {
|
|
13810
|
+
return new CSSUnitValue(n, 'em');
|
|
13811
|
+
},
|
|
13812
|
+
rem: function (n) {
|
|
13813
|
+
return new CSSUnitValue(n, 'rem');
|
|
13814
|
+
},
|
|
13815
|
+
/**
|
|
13816
|
+
* <angle>
|
|
13817
|
+
*/
|
|
13818
|
+
deg: function (n) {
|
|
13819
|
+
return new CSSUnitValue(n, 'deg');
|
|
13820
|
+
},
|
|
13821
|
+
/**
|
|
13822
|
+
* <angle>
|
|
13823
|
+
*/
|
|
13824
|
+
grad: function (n) {
|
|
13825
|
+
return new CSSUnitValue(n, 'grad');
|
|
13826
|
+
},
|
|
13827
|
+
/**
|
|
13828
|
+
* <angle>
|
|
13829
|
+
*/
|
|
13830
|
+
rad: function (n) {
|
|
13831
|
+
return new CSSUnitValue(n, 'rad');
|
|
13832
|
+
},
|
|
13833
|
+
/**
|
|
13834
|
+
* <angle>
|
|
13835
|
+
*/
|
|
13836
|
+
turn: function (n) {
|
|
13837
|
+
return new CSSUnitValue(n, 'turn');
|
|
13838
|
+
},
|
|
13839
|
+
/**
|
|
13840
|
+
* <time>
|
|
13841
|
+
*/
|
|
13842
|
+
s: function (n) {
|
|
13843
|
+
return new CSSUnitValue(n, 's');
|
|
13844
|
+
},
|
|
13845
|
+
/**
|
|
13846
|
+
* <time>
|
|
13847
|
+
*/
|
|
13848
|
+
ms: function (n) {
|
|
13849
|
+
return new CSSUnitValue(n, 'ms');
|
|
13850
|
+
},
|
|
13851
|
+
/**
|
|
13852
|
+
* CSS Properties & Values API
|
|
13853
|
+
*
|
|
13854
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
|
|
13855
|
+
* @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
|
|
13856
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
|
|
13857
|
+
*/
|
|
13858
|
+
registerProperty: function (definition) {
|
|
13859
|
+
var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
|
|
13860
|
+
runtime.styleValueRegistry.registerMetadata({
|
|
13861
|
+
n: name,
|
|
13862
|
+
inh: inherits,
|
|
13863
|
+
int: interpolable,
|
|
13864
|
+
d: initialValue,
|
|
13865
|
+
syntax: syntax,
|
|
13866
|
+
});
|
|
13867
|
+
},
|
|
13868
|
+
/**
|
|
13869
|
+
* CSS Layout API
|
|
13870
|
+
* register layout
|
|
13871
|
+
*
|
|
13872
|
+
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
13873
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
13874
|
+
*/
|
|
13875
|
+
registerLayout: function (name, clazz) {
|
|
13876
|
+
runtime.layoutRegistry.registerLayout(name, clazz);
|
|
13877
|
+
},
|
|
13878
|
+
};
|
|
13879
|
+
|
|
13809
13880
|
/**
|
|
13810
13881
|
* the entry of DOM tree
|
|
13811
13882
|
* Document -> Node -> EventTarget
|
|
@@ -14646,9 +14717,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14646
14717
|
* sync to RBush later
|
|
14647
14718
|
*/
|
|
14648
14719
|
this.toSync = new Set();
|
|
14720
|
+
// private isFirstTimeRendering = true;
|
|
14721
|
+
this.syncing = false;
|
|
14649
14722
|
}
|
|
14650
|
-
// private isFirstTimeRendering = true;
|
|
14651
|
-
// private syncing = false;
|
|
14652
14723
|
PrepareRendererPlugin.prototype.apply = function (context) {
|
|
14653
14724
|
var _this = this;
|
|
14654
14725
|
var renderingService = context.renderingService, renderingContext = context.renderingContext, rBushRoot = context.rBushRoot;
|
|
@@ -14710,25 +14781,17 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14710
14781
|
_this.toSync.clear();
|
|
14711
14782
|
});
|
|
14712
14783
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
// // @see https://github.com/antvis/G/issues/1117
|
|
14717
|
-
// setTimeout(() => {
|
|
14718
|
-
// this.syncRTree();
|
|
14719
|
-
// console.log('fcp...');
|
|
14720
|
-
// });
|
|
14721
|
-
// } else {
|
|
14722
|
-
// console.log('next...');
|
|
14723
|
-
_this.syncRTree();
|
|
14724
|
-
// }
|
|
14784
|
+
requestIdleCallback(function () {
|
|
14785
|
+
_this.syncRTree();
|
|
14786
|
+
});
|
|
14725
14787
|
});
|
|
14726
14788
|
};
|
|
14727
14789
|
PrepareRendererPlugin.prototype.syncRTree = function () {
|
|
14728
|
-
// if (this.syncing) {
|
|
14729
|
-
// return;
|
|
14730
|
-
// }
|
|
14731
14790
|
var _this = this;
|
|
14791
|
+
if (this.syncing || this.toSync.size === 0) {
|
|
14792
|
+
return;
|
|
14793
|
+
}
|
|
14794
|
+
this.syncing = true;
|
|
14732
14795
|
// bounds changed, need re-inserting its children
|
|
14733
14796
|
var bulk = [];
|
|
14734
14797
|
Array.from(this.toSync)
|
|
@@ -14766,9 +14829,10 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14766
14829
|
// use bulk inserting, which is ~2-3 times faster
|
|
14767
14830
|
// @see https://github.com/mourner/rbush#bulk-inserting-data
|
|
14768
14831
|
this.rBush.load(bulk);
|
|
14832
|
+
console.log('sync...', Array.from(this.toSync));
|
|
14769
14833
|
bulk.length = 0;
|
|
14770
14834
|
this.toSync.clear();
|
|
14771
|
-
|
|
14835
|
+
this.syncing = false;
|
|
14772
14836
|
};
|
|
14773
14837
|
PrepareRendererPlugin.tag = 'Prepare';
|
|
14774
14838
|
return PrepareRendererPlugin;
|
|
@@ -15275,5 +15339,5 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15275
15339
|
return Canvas;
|
|
15276
15340
|
}(EventTarget));
|
|
15277
15341
|
|
|
15278
|
-
export { AABB, AbstractRenderer, AbstractRendererPlugin, BUILT_IN_PROPERTIES, CSS, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSStyleValue, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasEvent, Circle, CircleUpdater, ClipSpaceNearZ, CustomElement, CustomElementRegistry, CustomEvent, DefaultSceneGraphSelector, DefaultSceneGraphService, DisplayObject, Document, ERROR_MSG_METHOD_NOT_IMPLEMENTED, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, Frustum, GradientType, Group, HTML, Image, Line, LineUpdater, Mask, MutationEvent, Node, OffscreenCanvasCreator, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertySyntax, RBush, Rect, RectUpdater, Rectangle, RenderReason, RenderingService, Shape, SortReason, Strategy, Text, TextService, TextUpdater, UnitType, computeLinearGradient, computeRadialGradient, convertToPath, createVec3, decompose, definedProps, deg2rad, deg2turn, findClosestClipPathTarget, fromRotationTranslationScale, getAngle, getEuler, getOrCalculatePathTotalLength, grad2deg, isBrowser, isCSSGradientValue, isCSSRGB, isCanvas, isDisplayObject, isFederatedEvent, isFillOrStrokeAffected, isPattern, mergeColors, parseColor, parseLength, parsePath, parseTransform, parsedTransformToMat4, propertyMetadataCache, rad2deg, resetEntityCounter, runtime, setDOMSize, translatePathToString, turn2deg };
|
|
15342
|
+
export { AABB, AbstractRenderer, AbstractRendererPlugin, BUILT_IN_PROPERTIES, CSS, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSStyleValue, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasEvent, Circle, CircleUpdater, ClipSpaceNearZ, CustomElement, CustomElementRegistry, CustomEvent, DefaultSceneGraphSelector, DefaultSceneGraphService, DisplayObject, Document, ERROR_MSG_METHOD_NOT_IMPLEMENTED, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, Frustum, GradientType, Group, GroupUpdater, HTML, Image, Line, LineUpdater, Mask, MutationEvent, Node, OffscreenCanvasCreator, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertySyntax, RBush, Rect, RectUpdater, Rectangle, RenderReason, RenderingService, Shape, SortReason, Strategy, Text, TextService, TextUpdater, UnitType, computeLinearGradient, computeRadialGradient, convertToPath, createVec3, decompose, definedProps, deg2rad, deg2turn, findClosestClipPathTarget, fromRotationTranslationScale, getAngle, getEuler, getOrCalculatePathTotalLength, grad2deg, isBrowser, isCSSGradientValue, isCSSRGB, isCanvas, isDisplayObject, isFederatedEvent, isFillOrStrokeAffected, isPattern, mergeColors, parseColor, parseLength, parsePath, parseTransform, parsedTransformToMat4, propertyMetadataCache, rad2deg, resetEntityCounter, runtime, setDOMSize, translatePathToString, turn2deg };
|
|
15279
15343
|
//# sourceMappingURL=index.esm.js.map
|