@antv/g-lite 1.3.0-next.4 → 1.3.0-next.7
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/dom/Element.d.ts +1 -0
- package/dist/dom/Node.d.ts +1 -0
- package/dist/dom/interfaces.d.ts +1 -1
- package/dist/index.esm.js +193 -150
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +193 -150
- 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/services/SceneGraphService.d.ts +12 -12
- package/dist/utils/path.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -4117,8 +4117,7 @@ function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
|
4117
4117
|
else if (valueWithUnit.unit === UnitType.kPercentage && target) {
|
|
4118
4118
|
var bounds = target.nodeName === Shape.GROUP
|
|
4119
4119
|
? target.getLocalBounds()
|
|
4120
|
-
:
|
|
4121
|
-
target.geometry.contentBounds;
|
|
4120
|
+
: target.getGeometryBounds();
|
|
4122
4121
|
return (valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2;
|
|
4123
4122
|
}
|
|
4124
4123
|
return 0;
|
|
@@ -6707,7 +6706,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6707
6706
|
this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames_1);
|
|
6708
6707
|
}
|
|
6709
6708
|
if (needUpdateGeometry_1) {
|
|
6710
|
-
|
|
6709
|
+
object.geometry.dirty = true;
|
|
6710
|
+
// FIXME setOrigin may have already dirtified to root.
|
|
6711
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6711
6712
|
}
|
|
6712
6713
|
return;
|
|
6713
6714
|
}
|
|
@@ -6766,9 +6767,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6766
6767
|
// }
|
|
6767
6768
|
// update geometry
|
|
6768
6769
|
if (needUpdateGeometry) {
|
|
6769
|
-
|
|
6770
|
-
//
|
|
6771
|
-
this.
|
|
6770
|
+
object.geometry.dirty = true;
|
|
6771
|
+
// FIXME setOrigin may have already dirtified to root.
|
|
6772
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6772
6773
|
}
|
|
6773
6774
|
attributeNames.forEach(function (name) {
|
|
6774
6775
|
if (name in object.parsedStyle) {
|
|
@@ -7055,6 +7056,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7055
7056
|
geometry_1.renderBounds.setMinMax(min, max);
|
|
7056
7057
|
}
|
|
7057
7058
|
});
|
|
7059
|
+
object.geometry.dirty = false;
|
|
7058
7060
|
// if (nodeName === Shape.RECT) {
|
|
7059
7061
|
// account for negative width / height of Rect
|
|
7060
7062
|
// @see https://github.com/antvis/g/issues/957
|
|
@@ -7072,8 +7074,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7072
7074
|
? convertPercentUnit(transformOrigin[1], 1, object)
|
|
7073
7075
|
: 0);
|
|
7074
7076
|
object.setOrigin(cx - hwidth + usedOriginXValue, cy - hheight + usedOriginYValue);
|
|
7075
|
-
// FIXME setOrigin may have already dirtified to root.
|
|
7076
|
-
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
7077
7077
|
}
|
|
7078
7078
|
};
|
|
7079
7079
|
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
@@ -7810,92 +7810,118 @@ 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
|
+
}
|
|
7899
7925
|
return object.getLocalTransform();
|
|
7900
7926
|
}
|
|
7901
7927
|
|
|
@@ -8769,7 +8795,7 @@ var EventTarget = /** @class */ (function () {
|
|
|
8769
8795
|
var Node = /** @class */ (function (_super) {
|
|
8770
8796
|
__extends(Node, _super);
|
|
8771
8797
|
function Node() {
|
|
8772
|
-
var _this = _super.
|
|
8798
|
+
var _this = _super.call(this) || this;
|
|
8773
8799
|
_this.shadow = false;
|
|
8774
8800
|
/**
|
|
8775
8801
|
* points to canvas.document
|
|
@@ -10318,9 +10344,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10318
10344
|
*/
|
|
10319
10345
|
this.rotate = (function () {
|
|
10320
10346
|
var parentInvertRotation = quat$1.create();
|
|
10321
|
-
return function (element, degrees, y, z) {
|
|
10347
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10322
10348
|
if (y === void 0) { y = 0; }
|
|
10323
10349
|
if (z === void 0) { z = 0; }
|
|
10350
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10324
10351
|
if (typeof degrees === 'number') {
|
|
10325
10352
|
degrees = vec3.fromValues(degrees, y, z);
|
|
10326
10353
|
}
|
|
@@ -10339,7 +10366,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10339
10366
|
quat$1.multiply(rotation, parentInvertRotation, rotation);
|
|
10340
10367
|
quat$1.multiply(transform.localRotation, rotation, rot);
|
|
10341
10368
|
quat$1.normalize(transform.localRotation, transform.localRotation);
|
|
10342
|
-
|
|
10369
|
+
if (dirtify) {
|
|
10370
|
+
_this.dirtifyLocal(element, transform);
|
|
10371
|
+
}
|
|
10343
10372
|
}
|
|
10344
10373
|
};
|
|
10345
10374
|
})();
|
|
@@ -10349,16 +10378,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10349
10378
|
*/
|
|
10350
10379
|
this.rotateLocal = (function () {
|
|
10351
10380
|
var rotation = quat$1.create();
|
|
10352
|
-
return function (element, degrees, y, z) {
|
|
10381
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10353
10382
|
if (y === void 0) { y = 0; }
|
|
10354
10383
|
if (z === void 0) { z = 0; }
|
|
10384
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10355
10385
|
if (typeof degrees === 'number') {
|
|
10356
10386
|
degrees = vec3.fromValues(degrees, y, z);
|
|
10357
10387
|
}
|
|
10358
10388
|
var transform = element.transformable;
|
|
10359
10389
|
quat$1.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
|
|
10360
10390
|
quat$1.mul(transform.localRotation, transform.localRotation, rotation);
|
|
10361
|
-
|
|
10391
|
+
if (dirtify) {
|
|
10392
|
+
_this.dirtifyLocal(element, transform);
|
|
10393
|
+
}
|
|
10362
10394
|
};
|
|
10363
10395
|
})();
|
|
10364
10396
|
/**
|
|
@@ -10366,9 +10398,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10366
10398
|
*/
|
|
10367
10399
|
this.setEulerAngles = (function () {
|
|
10368
10400
|
var invParentRot = quat$1.create();
|
|
10369
|
-
return function (element, degrees, y, z) {
|
|
10401
|
+
return function (element, degrees, y, z, dirtify) {
|
|
10370
10402
|
if (y === void 0) { y = 0; }
|
|
10371
10403
|
if (z === void 0) { z = 0; }
|
|
10404
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10372
10405
|
if (typeof degrees === 'number') {
|
|
10373
10406
|
degrees = vec3.fromValues(degrees, y, z);
|
|
10374
10407
|
}
|
|
@@ -10382,7 +10415,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10382
10415
|
var parentRotation = _this.getRotation(element.parentNode);
|
|
10383
10416
|
quat$1.copy(invParentRot, quat$1.invert(quat$1.create(), parentRotation));
|
|
10384
10417
|
quat$1.mul(transform.localRotation, transform.localRotation, invParentRot);
|
|
10385
|
-
|
|
10418
|
+
if (dirtify) {
|
|
10419
|
+
_this.dirtifyLocal(element, transform);
|
|
10420
|
+
}
|
|
10386
10421
|
}
|
|
10387
10422
|
};
|
|
10388
10423
|
})();
|
|
@@ -10396,9 +10431,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10396
10431
|
* ```
|
|
10397
10432
|
*/
|
|
10398
10433
|
this.translateLocal = (function () {
|
|
10399
|
-
return function (element, translation, y, z) {
|
|
10434
|
+
return function (element, translation, y, z, dirtify) {
|
|
10400
10435
|
if (y === void 0) { y = 0; }
|
|
10401
10436
|
if (z === void 0) { z = 0; }
|
|
10437
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10402
10438
|
if (typeof translation === 'number') {
|
|
10403
10439
|
translation = vec3.fromValues(translation, y, z);
|
|
10404
10440
|
}
|
|
@@ -10408,7 +10444,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10408
10444
|
}
|
|
10409
10445
|
vec3.transformQuat(translation, translation, transform.localRotation);
|
|
10410
10446
|
vec3.add(transform.localPosition, transform.localPosition, translation);
|
|
10411
|
-
|
|
10447
|
+
if (dirtify) {
|
|
10448
|
+
_this.dirtifyLocal(element, transform);
|
|
10449
|
+
}
|
|
10412
10450
|
};
|
|
10413
10451
|
})();
|
|
10414
10452
|
/**
|
|
@@ -10420,7 +10458,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10420
10458
|
this.setPosition = (function () {
|
|
10421
10459
|
var parentInvertMatrix = mat4.create();
|
|
10422
10460
|
var tmpPosition = vec3.create();
|
|
10423
|
-
return function (element, position) {
|
|
10461
|
+
return function (element, position, dirtify) {
|
|
10462
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10424
10463
|
var transform = element.transformable;
|
|
10425
10464
|
tmpPosition[0] = position[0];
|
|
10426
10465
|
tmpPosition[1] = position[1];
|
|
@@ -10439,7 +10478,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10439
10478
|
mat4.invert(parentInvertMatrix, parentInvertMatrix);
|
|
10440
10479
|
vec3.transformMat4(transform.localPosition, tmpPosition, parentInvertMatrix);
|
|
10441
10480
|
}
|
|
10442
|
-
|
|
10481
|
+
if (dirtify) {
|
|
10482
|
+
_this.dirtifyLocal(element, transform);
|
|
10483
|
+
}
|
|
10443
10484
|
};
|
|
10444
10485
|
})();
|
|
10445
10486
|
/**
|
|
@@ -10447,7 +10488,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10447
10488
|
*/
|
|
10448
10489
|
this.setLocalPosition = (function () {
|
|
10449
10490
|
var tmpPosition = vec3.create();
|
|
10450
|
-
return function (element, position) {
|
|
10491
|
+
return function (element, position, dirtify) {
|
|
10492
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10451
10493
|
var transform = element.transformable;
|
|
10452
10494
|
tmpPosition[0] = position[0];
|
|
10453
10495
|
tmpPosition[1] = position[1];
|
|
@@ -10456,7 +10498,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10456
10498
|
return;
|
|
10457
10499
|
}
|
|
10458
10500
|
vec3.copy(transform.localPosition, tmpPosition);
|
|
10459
|
-
|
|
10501
|
+
if (dirtify) {
|
|
10502
|
+
_this.dirtifyLocal(element, transform);
|
|
10503
|
+
}
|
|
10460
10504
|
};
|
|
10461
10505
|
})();
|
|
10462
10506
|
/**
|
|
@@ -10475,9 +10519,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10475
10519
|
var zeroVec3 = vec3.create();
|
|
10476
10520
|
var tmpVec3 = vec3.create();
|
|
10477
10521
|
var tr = vec3.create();
|
|
10478
|
-
return function (element, translation, y, z) {
|
|
10522
|
+
return function (element, translation, y, z, dirtify) {
|
|
10479
10523
|
if (y === void 0) { y = 0; }
|
|
10480
10524
|
if (z === void 0) { z = 0; }
|
|
10525
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10481
10526
|
if (typeof translation === 'number') {
|
|
10482
10527
|
translation = vec3.set(tmpVec3, translation, y, z);
|
|
10483
10528
|
}
|
|
@@ -10485,12 +10530,13 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10485
10530
|
return;
|
|
10486
10531
|
}
|
|
10487
10532
|
vec3.add(tr, _this.getPosition(element), translation);
|
|
10488
|
-
_this.setPosition(element, tr);
|
|
10533
|
+
_this.setPosition(element, tr, dirtify);
|
|
10489
10534
|
};
|
|
10490
10535
|
})();
|
|
10491
10536
|
this.setRotation = function () {
|
|
10492
10537
|
var parentInvertRotation = quat$1.create();
|
|
10493
|
-
return function (element, rotation, y, z, w) {
|
|
10538
|
+
return function (element, rotation, y, z, w, dirtify) {
|
|
10539
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10494
10540
|
var transform = element.transformable;
|
|
10495
10541
|
if (typeof rotation === 'number') {
|
|
10496
10542
|
rotation = quat$1.fromValues(rotation, y, z, w);
|
|
@@ -10505,7 +10551,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10505
10551
|
quat$1.invert(parentInvertRotation, parentInvertRotation);
|
|
10506
10552
|
quat$1.multiply(transform.localRotation, parentInvertRotation, rotation);
|
|
10507
10553
|
quat$1.normalize(transform.localRotation, transform.localRotation);
|
|
10508
|
-
|
|
10554
|
+
if (dirtify) {
|
|
10555
|
+
_this.dirtifyLocal(element, transform);
|
|
10556
|
+
}
|
|
10509
10557
|
}
|
|
10510
10558
|
};
|
|
10511
10559
|
};
|
|
@@ -10546,7 +10594,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10546
10594
|
// .filter((node) => !node.shadow);
|
|
10547
10595
|
};
|
|
10548
10596
|
DefaultSceneGraphService.prototype.attach = function (child, parent, index) {
|
|
10549
|
-
var _a
|
|
10597
|
+
var _a;
|
|
10550
10598
|
var detached = false;
|
|
10551
10599
|
if (child.parentNode) {
|
|
10552
10600
|
detached = child.parentNode !== parent;
|
|
@@ -10562,7 +10610,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10562
10610
|
// parent needs re-sort
|
|
10563
10611
|
var sortable = parent.sortable;
|
|
10564
10612
|
if (((_a = sortable === null || sortable === void 0 ? void 0 : sortable.sorted) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
10565
|
-
|
|
10613
|
+
child.parsedStyle.zIndex) {
|
|
10566
10614
|
if (sortable.dirtyChildren.indexOf(child) === -1) {
|
|
10567
10615
|
sortable.dirtyChildren.push(child);
|
|
10568
10616
|
}
|
|
@@ -10647,40 +10695,52 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10647
10695
|
/**
|
|
10648
10696
|
* set euler angles(degrees) in local space
|
|
10649
10697
|
*/
|
|
10650
|
-
DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z) {
|
|
10698
|
+
DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z, dirtify) {
|
|
10651
10699
|
if (y === void 0) { y = 0; }
|
|
10652
10700
|
if (z === void 0) { z = 0; }
|
|
10701
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10653
10702
|
if (typeof degrees === 'number') {
|
|
10654
10703
|
degrees = vec3.fromValues(degrees, y, z);
|
|
10655
10704
|
}
|
|
10656
10705
|
var transform = element.transformable;
|
|
10657
10706
|
quat$1.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
10658
|
-
|
|
10707
|
+
if (dirtify) {
|
|
10708
|
+
this.dirtifyLocal(element, transform);
|
|
10709
|
+
}
|
|
10659
10710
|
};
|
|
10660
10711
|
/**
|
|
10661
10712
|
* scale in local space
|
|
10662
10713
|
*/
|
|
10663
|
-
DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling) {
|
|
10714
|
+
DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling, dirtify) {
|
|
10715
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10664
10716
|
var transform = element.transformable;
|
|
10665
10717
|
vec3.multiply(transform.localScale, transform.localScale, vec3.fromValues(scaling[0], scaling[1], scaling[2] || 1));
|
|
10666
|
-
|
|
10718
|
+
if (dirtify) {
|
|
10719
|
+
this.dirtifyLocal(element, transform);
|
|
10720
|
+
}
|
|
10667
10721
|
};
|
|
10668
|
-
DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling) {
|
|
10722
|
+
DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling, dirtify) {
|
|
10723
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10669
10724
|
var transform = element.transformable;
|
|
10670
10725
|
var updatedScaling = vec3.fromValues(scaling[0], scaling[1], scaling[2] || transform.localScale[2]);
|
|
10671
10726
|
if (vec3.equals(updatedScaling, transform.localScale)) {
|
|
10672
10727
|
return;
|
|
10673
10728
|
}
|
|
10674
10729
|
vec3.copy(transform.localScale, updatedScaling);
|
|
10675
|
-
|
|
10730
|
+
if (dirtify) {
|
|
10731
|
+
this.dirtifyLocal(element, transform);
|
|
10732
|
+
}
|
|
10676
10733
|
};
|
|
10677
|
-
DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w) {
|
|
10734
|
+
DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w, dirtify) {
|
|
10735
|
+
if (dirtify === void 0) { dirtify = true; }
|
|
10678
10736
|
if (typeof rotation === 'number') {
|
|
10679
10737
|
rotation = quat$1.fromValues(rotation, y, z, w);
|
|
10680
10738
|
}
|
|
10681
10739
|
var transform = element.transformable;
|
|
10682
10740
|
quat$1.copy(transform.localRotation, rotation);
|
|
10683
|
-
|
|
10741
|
+
if (dirtify) {
|
|
10742
|
+
this.dirtifyLocal(element, transform);
|
|
10743
|
+
}
|
|
10684
10744
|
};
|
|
10685
10745
|
DefaultSceneGraphService.prototype.setLocalSkew = function (element, skew, y) {
|
|
10686
10746
|
if (typeof skew === 'number') {
|
|
@@ -10844,9 +10904,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10844
10904
|
var t = mat4.getTranslation(vec3.create(), transform);
|
|
10845
10905
|
var r = mat4.getRotation(quat$1.create(), transform);
|
|
10846
10906
|
var s = mat4.getScaling(vec3.create(), transform);
|
|
10847
|
-
this.setLocalScale(element, s);
|
|
10848
|
-
this.setLocalPosition(element, t);
|
|
10849
|
-
this.setLocalRotation(element, r);
|
|
10907
|
+
this.setLocalScale(element, s, false);
|
|
10908
|
+
this.setLocalPosition(element, t, false);
|
|
10909
|
+
this.setLocalRotation(element, r, undefined, undefined, undefined, false);
|
|
10910
|
+
this.dirtifyLocal(element, element.transformable);
|
|
10850
10911
|
};
|
|
10851
10912
|
DefaultSceneGraphService.prototype.resetLocalTransform = function (element) {
|
|
10852
10913
|
this.setLocalScale(element, [1, 1, 1]);
|
|
@@ -10872,6 +10933,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10872
10933
|
DefaultSceneGraphService.prototype.getGeometryBounds = function (element, render) {
|
|
10873
10934
|
if (render === void 0) { render = false; }
|
|
10874
10935
|
var geometry = element.geometry;
|
|
10936
|
+
if (geometry.dirty) {
|
|
10937
|
+
runtime.styleValueRegistry.updateGeometry(element);
|
|
10938
|
+
}
|
|
10875
10939
|
var bounds = render
|
|
10876
10940
|
? geometry.renderBounds
|
|
10877
10941
|
: geometry.contentBounds || null;
|
|
@@ -11556,7 +11620,7 @@ var destroyEvent = new CustomEvent(ElementEvent.DESTROY);
|
|
|
11556
11620
|
var Element = /** @class */ (function (_super) {
|
|
11557
11621
|
__extends(Element, _super);
|
|
11558
11622
|
function Element() {
|
|
11559
|
-
var _this = _super.
|
|
11623
|
+
var _this = _super.call(this) || this;
|
|
11560
11624
|
/**
|
|
11561
11625
|
* Unique id.
|
|
11562
11626
|
*/
|
|
@@ -11600,6 +11664,7 @@ var Element = /** @class */ (function (_super) {
|
|
|
11600
11664
|
_this.geometry = {
|
|
11601
11665
|
contentBounds: undefined,
|
|
11602
11666
|
renderBounds: undefined,
|
|
11667
|
+
dirty: true,
|
|
11603
11668
|
};
|
|
11604
11669
|
_this.rBushNode = {
|
|
11605
11670
|
aabb: undefined,
|
|
@@ -11783,11 +11848,8 @@ var Element = /** @class */ (function (_super) {
|
|
|
11783
11848
|
if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
|
|
11784
11849
|
this.ownerDocument.defaultView.mountChildren(child);
|
|
11785
11850
|
}
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
insertedEvent.relatedNode = this;
|
|
11789
|
-
child.dispatchEvent(insertedEvent);
|
|
11790
|
-
}
|
|
11851
|
+
insertedEvent.relatedNode = this;
|
|
11852
|
+
child.dispatchEvent(insertedEvent);
|
|
11791
11853
|
return child;
|
|
11792
11854
|
};
|
|
11793
11855
|
Element.prototype.insertBefore = function (newChild, refChild) {
|
|
@@ -12229,8 +12291,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12229
12291
|
// assign name, id to config
|
|
12230
12292
|
// eg. group.get('name')
|
|
12231
12293
|
_this.config = config;
|
|
12232
|
-
// compatible with G 3.0
|
|
12233
|
-
// this.config.interactive = this.config.capture ?? this.config.interactive;
|
|
12234
12294
|
// init scene graph node
|
|
12235
12295
|
_this.id = _this.config.id || '';
|
|
12236
12296
|
_this.name = _this.config.name || '';
|
|
@@ -12238,23 +12298,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12238
12298
|
_this.className = _this.config.className || _this.config.class;
|
|
12239
12299
|
}
|
|
12240
12300
|
_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
12301
|
// merge parsed value
|
|
12259
12302
|
Object.assign(_this.parsedStyle, runtime.enableCSSParsing
|
|
12260
12303
|
? DEFAULT_PARSED_STYLE_PROPS
|
|
@@ -13014,7 +13057,7 @@ var Circle = /** @class */ (function (_super) {
|
|
|
13014
13057
|
if (_a === void 0) { _a = {}; }
|
|
13015
13058
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13016
13059
|
return _super.call(this, __assign({ type: Shape.CIRCLE, style: runtime.enableCSSParsing
|
|
13017
|
-
? __assign({ cx: '', cy: '', r: '' }, style) :
|
|
13060
|
+
? __assign({ cx: '', cy: '', r: '' }, style) : style, initialParsedStyle: {
|
|
13018
13061
|
transformOrigin: runtime.enableCSSParsing
|
|
13019
13062
|
? null
|
|
13020
13063
|
: [PECENTAGE_50, PECENTAGE_50],
|
|
@@ -13051,7 +13094,7 @@ var Ellipse = /** @class */ (function (_super) {
|
|
|
13051
13094
|
if (_a === void 0) { _a = {}; }
|
|
13052
13095
|
var style = _a.style, rest = __rest(_a, ["style"]);
|
|
13053
13096
|
return _super.call(this, __assign({ type: Shape.ELLIPSE, style: runtime.enableCSSParsing
|
|
13054
|
-
? __assign({ cx: '', cy: '', rx: '', ry: '' }, style) :
|
|
13097
|
+
? __assign({ cx: '', cy: '', rx: '', ry: '' }, style) : style, initialParsedStyle: {
|
|
13055
13098
|
transformOrigin: runtime.enableCSSParsing
|
|
13056
13099
|
? null
|
|
13057
13100
|
: [PECENTAGE_50, PECENTAGE_50],
|