@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/index.js CHANGED
@@ -4138,8 +4138,7 @@ function convertPercentUnit(valueWithUnit, vec3Index, target) {
4138
4138
  else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
4139
4139
  var bounds = target.nodeName === exports.Shape.GROUP
4140
4140
  ? target.getLocalBounds()
4141
- : // : target.getGeometryBounds();
4142
- target.geometry.contentBounds;
4141
+ : target.getGeometryBounds();
4143
4142
  return (valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2;
4144
4143
  }
4145
4144
  return 0;
@@ -6728,7 +6727,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6728
6727
  this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames_1);
6729
6728
  }
6730
6729
  if (needUpdateGeometry_1) {
6731
- this.updateGeometry(object);
6730
+ object.geometry.dirty = true;
6731
+ // FIXME setOrigin may have already dirtified to root.
6732
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6732
6733
  }
6733
6734
  return;
6734
6735
  }
@@ -6787,9 +6788,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6787
6788
  // }
6788
6789
  // update geometry
6789
6790
  if (needUpdateGeometry) {
6790
- // object.geometry.dirty = true;
6791
- // runtime.sceneGraphService.dirtifyToRoot(object);
6792
- this.updateGeometry(object);
6791
+ object.geometry.dirty = true;
6792
+ // FIXME setOrigin may have already dirtified to root.
6793
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6793
6794
  }
6794
6795
  attributeNames.forEach(function (name) {
6795
6796
  if (name in object.parsedStyle) {
@@ -7076,6 +7077,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7076
7077
  geometry_1.renderBounds.setMinMax(min, max);
7077
7078
  }
7078
7079
  });
7080
+ object.geometry.dirty = false;
7079
7081
  // if (nodeName === Shape.RECT) {
7080
7082
  // account for negative width / height of Rect
7081
7083
  // @see https://github.com/antvis/g/issues/957
@@ -7093,8 +7095,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7093
7095
  ? convertPercentUnit(transformOrigin[1], 1, object)
7094
7096
  : 0);
7095
7097
  object.setOrigin(cx - hwidth + usedOriginXValue, cy - hheight + usedOriginYValue);
7096
- // FIXME setOrigin may have already dirtified to root.
7097
- this.runtime.sceneGraphService.dirtifyToRoot(object);
7098
7098
  }
7099
7099
  };
7100
7100
  DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
@@ -7831,92 +7831,118 @@ function toFontString(attributes) {
7831
7831
  return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
7832
7832
  }
7833
7833
 
7834
- var tmpMat4 = glMatrix.mat4.create();
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
- // reset transform
7837
- object.resetLocalTransform();
7838
- transform.forEach(function (parsed) {
7839
- var t = parsed.t, d = parsed.d;
7840
- if (t === 'scale') {
7841
- // scale(1) scale(1, 1)
7842
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1];
7843
- object.scaleLocal(newScale[0], newScale[1], 1);
7844
- }
7845
- else if (t === 'scalex') {
7846
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7847
- object.scaleLocal(newScale[0], 1, 1);
7848
- }
7849
- else if (t === 'scaley') {
7850
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7851
- object.scaleLocal(1, newScale[0], 1);
7852
- }
7853
- else if (t === 'scalez') {
7854
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7855
- object.scaleLocal(1, 1, newScale[0]);
7856
- }
7857
- else if (t === 'scale3d') {
7858
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1, 1];
7859
- object.scaleLocal(newScale[0], newScale[1], newScale[2]);
7860
- }
7861
- else if (t === 'translate') {
7862
- var newTranslation = d || [Opx, Opx];
7863
- object.translateLocal(newTranslation[0].value, newTranslation[1].value, 0);
7864
- }
7865
- else if (t === 'translatex') {
7866
- var newTranslation = d || [Opx];
7867
- object.translateLocal(newTranslation[0].value, 0, 0);
7868
- }
7869
- else if (t === 'translatey') {
7870
- var newTranslation = d || [Opx];
7871
- object.translateLocal(0, newTranslation[0].value, 0);
7872
- }
7873
- else if (t === 'translatez') {
7874
- var newTranslation = d || [Opx];
7875
- object.translateLocal(0, 0, newTranslation[0].value);
7876
- }
7877
- else if (t === 'translate3d') {
7878
- var newTranslation = d || [Opx, Opx, Opx];
7879
- object.translateLocal(newTranslation[0].value, newTranslation[1].value, newTranslation[2].value);
7880
- }
7881
- else if (t === 'rotate') {
7882
- var newAngles = d || [Odeg];
7883
- object.rotateLocal(0, 0, convertAngleUnit(newAngles[0]));
7884
- }
7885
- else if (t === 'rotatex') {
7886
- var newAngles = d || [Odeg];
7887
- object.rotateLocal(convertAngleUnit(newAngles[0]), 0, 0);
7888
- }
7889
- else if (t === 'rotatey') {
7890
- var newAngles = d || [Odeg];
7891
- object.rotateLocal(0, convertAngleUnit(newAngles[0]), 0);
7892
- }
7893
- else if (t === 'rotatez') {
7894
- var newAngles = d || [Odeg];
7895
- object.rotateLocal(0, 0, convertAngleUnit(newAngles[0]));
7896
- }
7897
- else if (t === 'rotate3d') ;
7898
- else if (t === 'skew') {
7899
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0, 0];
7900
- object.setLocalSkew(deg2rad(newSkew[0]), deg2rad(newSkew[1]));
7901
- }
7902
- else if (t === 'skewx') {
7903
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7904
- object.setLocalSkew(deg2rad(newSkew[0]), object.getLocalSkew()[1]);
7905
- }
7906
- else if (t === 'skewy') {
7907
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7908
- object.setLocalSkew(object.getLocalSkew()[0], deg2rad(newSkew[0]));
7909
- }
7910
- else if (t === 'matrix') {
7911
- 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];
7912
- object.setLocalTransform(glMatrix.mat4.set(tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1));
7913
- }
7914
- else if (t === 'matrix3d') {
7915
- // @ts-ignore
7916
- glMatrix.mat4.set.apply(glMatrix.mat4, tslib.__spreadArray([tmpMat4], tslib.__read(d.map(function (s) { return s.value; })), false));
7917
- object.setLocalTransform(tmpMat4);
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
+ }
7920
7946
  return object.getLocalTransform();
7921
7947
  }
7922
7948
 
@@ -8790,7 +8816,7 @@ var EventTarget = /** @class */ (function () {
8790
8816
  var Node = /** @class */ (function (_super) {
8791
8817
  tslib.__extends(Node, _super);
8792
8818
  function Node() {
8793
- var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
8819
+ var _this = _super.call(this) || this;
8794
8820
  _this.shadow = false;
8795
8821
  /**
8796
8822
  * points to canvas.document
@@ -10339,9 +10365,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10339
10365
  */
10340
10366
  this.rotate = (function () {
10341
10367
  var parentInvertRotation = glMatrix.quat.create();
10342
- return function (element, degrees, y, z) {
10368
+ return function (element, degrees, y, z, dirtify) {
10343
10369
  if (y === void 0) { y = 0; }
10344
10370
  if (z === void 0) { z = 0; }
10371
+ if (dirtify === void 0) { dirtify = true; }
10345
10372
  if (typeof degrees === 'number') {
10346
10373
  degrees = glMatrix.vec3.fromValues(degrees, y, z);
10347
10374
  }
@@ -10360,7 +10387,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10360
10387
  glMatrix.quat.multiply(rotation, parentInvertRotation, rotation);
10361
10388
  glMatrix.quat.multiply(transform.localRotation, rotation, rot);
10362
10389
  glMatrix.quat.normalize(transform.localRotation, transform.localRotation);
10363
- _this.dirtifyLocal(element, transform);
10390
+ if (dirtify) {
10391
+ _this.dirtifyLocal(element, transform);
10392
+ }
10364
10393
  }
10365
10394
  };
10366
10395
  })();
@@ -10370,16 +10399,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
10370
10399
  */
10371
10400
  this.rotateLocal = (function () {
10372
10401
  var rotation = glMatrix.quat.create();
10373
- return function (element, degrees, y, z) {
10402
+ return function (element, degrees, y, z, dirtify) {
10374
10403
  if (y === void 0) { y = 0; }
10375
10404
  if (z === void 0) { z = 0; }
10405
+ if (dirtify === void 0) { dirtify = true; }
10376
10406
  if (typeof degrees === 'number') {
10377
10407
  degrees = glMatrix.vec3.fromValues(degrees, y, z);
10378
10408
  }
10379
10409
  var transform = element.transformable;
10380
10410
  glMatrix.quat.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
10381
10411
  glMatrix.quat.mul(transform.localRotation, transform.localRotation, rotation);
10382
- _this.dirtifyLocal(element, transform);
10412
+ if (dirtify) {
10413
+ _this.dirtifyLocal(element, transform);
10414
+ }
10383
10415
  };
10384
10416
  })();
10385
10417
  /**
@@ -10387,9 +10419,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10387
10419
  */
10388
10420
  this.setEulerAngles = (function () {
10389
10421
  var invParentRot = glMatrix.quat.create();
10390
- return function (element, degrees, y, z) {
10422
+ return function (element, degrees, y, z, dirtify) {
10391
10423
  if (y === void 0) { y = 0; }
10392
10424
  if (z === void 0) { z = 0; }
10425
+ if (dirtify === void 0) { dirtify = true; }
10393
10426
  if (typeof degrees === 'number') {
10394
10427
  degrees = glMatrix.vec3.fromValues(degrees, y, z);
10395
10428
  }
@@ -10403,7 +10436,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10403
10436
  var parentRotation = _this.getRotation(element.parentNode);
10404
10437
  glMatrix.quat.copy(invParentRot, glMatrix.quat.invert(glMatrix.quat.create(), parentRotation));
10405
10438
  glMatrix.quat.mul(transform.localRotation, transform.localRotation, invParentRot);
10406
- _this.dirtifyLocal(element, transform);
10439
+ if (dirtify) {
10440
+ _this.dirtifyLocal(element, transform);
10441
+ }
10407
10442
  }
10408
10443
  };
10409
10444
  })();
@@ -10417,9 +10452,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10417
10452
  * ```
10418
10453
  */
10419
10454
  this.translateLocal = (function () {
10420
- return function (element, translation, y, z) {
10455
+ return function (element, translation, y, z, dirtify) {
10421
10456
  if (y === void 0) { y = 0; }
10422
10457
  if (z === void 0) { z = 0; }
10458
+ if (dirtify === void 0) { dirtify = true; }
10423
10459
  if (typeof translation === 'number') {
10424
10460
  translation = glMatrix.vec3.fromValues(translation, y, z);
10425
10461
  }
@@ -10429,7 +10465,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10429
10465
  }
10430
10466
  glMatrix.vec3.transformQuat(translation, translation, transform.localRotation);
10431
10467
  glMatrix.vec3.add(transform.localPosition, transform.localPosition, translation);
10432
- _this.dirtifyLocal(element, transform);
10468
+ if (dirtify) {
10469
+ _this.dirtifyLocal(element, transform);
10470
+ }
10433
10471
  };
10434
10472
  })();
10435
10473
  /**
@@ -10441,7 +10479,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
10441
10479
  this.setPosition = (function () {
10442
10480
  var parentInvertMatrix = glMatrix.mat4.create();
10443
10481
  var tmpPosition = glMatrix.vec3.create();
10444
- return function (element, position) {
10482
+ return function (element, position, dirtify) {
10483
+ if (dirtify === void 0) { dirtify = true; }
10445
10484
  var transform = element.transformable;
10446
10485
  tmpPosition[0] = position[0];
10447
10486
  tmpPosition[1] = position[1];
@@ -10460,7 +10499,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10460
10499
  glMatrix.mat4.invert(parentInvertMatrix, parentInvertMatrix);
10461
10500
  glMatrix.vec3.transformMat4(transform.localPosition, tmpPosition, parentInvertMatrix);
10462
10501
  }
10463
- _this.dirtifyLocal(element, transform);
10502
+ if (dirtify) {
10503
+ _this.dirtifyLocal(element, transform);
10504
+ }
10464
10505
  };
10465
10506
  })();
10466
10507
  /**
@@ -10468,7 +10509,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
10468
10509
  */
10469
10510
  this.setLocalPosition = (function () {
10470
10511
  var tmpPosition = glMatrix.vec3.create();
10471
- return function (element, position) {
10512
+ return function (element, position, dirtify) {
10513
+ if (dirtify === void 0) { dirtify = true; }
10472
10514
  var transform = element.transformable;
10473
10515
  tmpPosition[0] = position[0];
10474
10516
  tmpPosition[1] = position[1];
@@ -10477,7 +10519,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10477
10519
  return;
10478
10520
  }
10479
10521
  glMatrix.vec3.copy(transform.localPosition, tmpPosition);
10480
- _this.dirtifyLocal(element, transform);
10522
+ if (dirtify) {
10523
+ _this.dirtifyLocal(element, transform);
10524
+ }
10481
10525
  };
10482
10526
  })();
10483
10527
  /**
@@ -10496,9 +10540,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10496
10540
  var zeroVec3 = glMatrix.vec3.create();
10497
10541
  var tmpVec3 = glMatrix.vec3.create();
10498
10542
  var tr = glMatrix.vec3.create();
10499
- return function (element, translation, y, z) {
10543
+ return function (element, translation, y, z, dirtify) {
10500
10544
  if (y === void 0) { y = 0; }
10501
10545
  if (z === void 0) { z = 0; }
10546
+ if (dirtify === void 0) { dirtify = true; }
10502
10547
  if (typeof translation === 'number') {
10503
10548
  translation = glMatrix.vec3.set(tmpVec3, translation, y, z);
10504
10549
  }
@@ -10506,12 +10551,13 @@ var DefaultSceneGraphService = /** @class */ (function () {
10506
10551
  return;
10507
10552
  }
10508
10553
  glMatrix.vec3.add(tr, _this.getPosition(element), translation);
10509
- _this.setPosition(element, tr);
10554
+ _this.setPosition(element, tr, dirtify);
10510
10555
  };
10511
10556
  })();
10512
10557
  this.setRotation = function () {
10513
10558
  var parentInvertRotation = glMatrix.quat.create();
10514
- return function (element, rotation, y, z, w) {
10559
+ return function (element, rotation, y, z, w, dirtify) {
10560
+ if (dirtify === void 0) { dirtify = true; }
10515
10561
  var transform = element.transformable;
10516
10562
  if (typeof rotation === 'number') {
10517
10563
  rotation = glMatrix.quat.fromValues(rotation, y, z, w);
@@ -10526,7 +10572,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10526
10572
  glMatrix.quat.invert(parentInvertRotation, parentInvertRotation);
10527
10573
  glMatrix.quat.multiply(transform.localRotation, parentInvertRotation, rotation);
10528
10574
  glMatrix.quat.normalize(transform.localRotation, transform.localRotation);
10529
- _this.dirtifyLocal(element, transform);
10575
+ if (dirtify) {
10576
+ _this.dirtifyLocal(element, transform);
10577
+ }
10530
10578
  }
10531
10579
  };
10532
10580
  };
@@ -10567,7 +10615,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10567
10615
  // .filter((node) => !node.shadow);
10568
10616
  };
10569
10617
  DefaultSceneGraphService.prototype.attach = function (child, parent, index) {
10570
- var _a, _b;
10618
+ var _a;
10571
10619
  var detached = false;
10572
10620
  if (child.parentNode) {
10573
10621
  detached = child.parentNode !== parent;
@@ -10583,7 +10631,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10583
10631
  // parent needs re-sort
10584
10632
  var sortable = parent.sortable;
10585
10633
  if (((_a = sortable === null || sortable === void 0 ? void 0 : sortable.sorted) === null || _a === void 0 ? void 0 : _a.length) ||
10586
- ((_b = child.style) === null || _b === void 0 ? void 0 : _b.zIndex)) {
10634
+ child.parsedStyle.zIndex) {
10587
10635
  if (sortable.dirtyChildren.indexOf(child) === -1) {
10588
10636
  sortable.dirtyChildren.push(child);
10589
10637
  }
@@ -10668,40 +10716,52 @@ var DefaultSceneGraphService = /** @class */ (function () {
10668
10716
  /**
10669
10717
  * set euler angles(degrees) in local space
10670
10718
  */
10671
- DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z) {
10719
+ DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z, dirtify) {
10672
10720
  if (y === void 0) { y = 0; }
10673
10721
  if (z === void 0) { z = 0; }
10722
+ if (dirtify === void 0) { dirtify = true; }
10674
10723
  if (typeof degrees === 'number') {
10675
10724
  degrees = glMatrix.vec3.fromValues(degrees, y, z);
10676
10725
  }
10677
10726
  var transform = element.transformable;
10678
10727
  glMatrix.quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
10679
- this.dirtifyLocal(element, transform);
10728
+ if (dirtify) {
10729
+ this.dirtifyLocal(element, transform);
10730
+ }
10680
10731
  };
10681
10732
  /**
10682
10733
  * scale in local space
10683
10734
  */
10684
- DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling) {
10735
+ DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling, dirtify) {
10736
+ if (dirtify === void 0) { dirtify = true; }
10685
10737
  var transform = element.transformable;
10686
10738
  glMatrix.vec3.multiply(transform.localScale, transform.localScale, glMatrix.vec3.fromValues(scaling[0], scaling[1], scaling[2] || 1));
10687
- this.dirtifyLocal(element, transform);
10739
+ if (dirtify) {
10740
+ this.dirtifyLocal(element, transform);
10741
+ }
10688
10742
  };
10689
- DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling) {
10743
+ DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling, dirtify) {
10744
+ if (dirtify === void 0) { dirtify = true; }
10690
10745
  var transform = element.transformable;
10691
10746
  var updatedScaling = glMatrix.vec3.fromValues(scaling[0], scaling[1], scaling[2] || transform.localScale[2]);
10692
10747
  if (glMatrix.vec3.equals(updatedScaling, transform.localScale)) {
10693
10748
  return;
10694
10749
  }
10695
10750
  glMatrix.vec3.copy(transform.localScale, updatedScaling);
10696
- this.dirtifyLocal(element, transform);
10751
+ if (dirtify) {
10752
+ this.dirtifyLocal(element, transform);
10753
+ }
10697
10754
  };
10698
- DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w) {
10755
+ DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w, dirtify) {
10756
+ if (dirtify === void 0) { dirtify = true; }
10699
10757
  if (typeof rotation === 'number') {
10700
10758
  rotation = glMatrix.quat.fromValues(rotation, y, z, w);
10701
10759
  }
10702
10760
  var transform = element.transformable;
10703
10761
  glMatrix.quat.copy(transform.localRotation, rotation);
10704
- this.dirtifyLocal(element, transform);
10762
+ if (dirtify) {
10763
+ this.dirtifyLocal(element, transform);
10764
+ }
10705
10765
  };
10706
10766
  DefaultSceneGraphService.prototype.setLocalSkew = function (element, skew, y) {
10707
10767
  if (typeof skew === 'number') {
@@ -10865,9 +10925,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10865
10925
  var t = glMatrix.mat4.getTranslation(glMatrix.vec3.create(), transform);
10866
10926
  var r = glMatrix.mat4.getRotation(glMatrix.quat.create(), transform);
10867
10927
  var s = glMatrix.mat4.getScaling(glMatrix.vec3.create(), transform);
10868
- this.setLocalScale(element, s);
10869
- this.setLocalPosition(element, t);
10870
- this.setLocalRotation(element, r);
10928
+ this.setLocalScale(element, s, false);
10929
+ this.setLocalPosition(element, t, false);
10930
+ this.setLocalRotation(element, r, undefined, undefined, undefined, false);
10931
+ this.dirtifyLocal(element, element.transformable);
10871
10932
  };
10872
10933
  DefaultSceneGraphService.prototype.resetLocalTransform = function (element) {
10873
10934
  this.setLocalScale(element, [1, 1, 1]);
@@ -10893,6 +10954,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10893
10954
  DefaultSceneGraphService.prototype.getGeometryBounds = function (element, render) {
10894
10955
  if (render === void 0) { render = false; }
10895
10956
  var geometry = element.geometry;
10957
+ if (geometry.dirty) {
10958
+ runtime.styleValueRegistry.updateGeometry(element);
10959
+ }
10896
10960
  var bounds = render
10897
10961
  ? geometry.renderBounds
10898
10962
  : geometry.contentBounds || null;
@@ -11577,7 +11641,7 @@ var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
11577
11641
  var Element = /** @class */ (function (_super) {
11578
11642
  tslib.__extends(Element, _super);
11579
11643
  function Element() {
11580
- var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
11644
+ var _this = _super.call(this) || this;
11581
11645
  /**
11582
11646
  * Unique id.
11583
11647
  */
@@ -11621,6 +11685,7 @@ var Element = /** @class */ (function (_super) {
11621
11685
  _this.geometry = {
11622
11686
  contentBounds: undefined,
11623
11687
  renderBounds: undefined,
11688
+ dirty: true,
11624
11689
  };
11625
11690
  _this.rBushNode = {
11626
11691
  aabb: undefined,
@@ -11804,11 +11869,8 @@ var Element = /** @class */ (function (_super) {
11804
11869
  if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
11805
11870
  this.ownerDocument.defaultView.mountChildren(child);
11806
11871
  }
11807
- // @ts-ignore
11808
- if (child.isMutationObserved) {
11809
- insertedEvent.relatedNode = this;
11810
- child.dispatchEvent(insertedEvent);
11811
- }
11872
+ insertedEvent.relatedNode = this;
11873
+ child.dispatchEvent(insertedEvent);
11812
11874
  return child;
11813
11875
  };
11814
11876
  Element.prototype.insertBefore = function (newChild, refChild) {
@@ -12250,8 +12312,6 @@ var DisplayObject = /** @class */ (function (_super) {
12250
12312
  // assign name, id to config
12251
12313
  // eg. group.get('name')
12252
12314
  _this.config = config;
12253
- // compatible with G 3.0
12254
- // this.config.interactive = this.config.capture ?? this.config.interactive;
12255
12315
  // init scene graph node
12256
12316
  _this.id = _this.config.id || '';
12257
12317
  _this.name = _this.config.name || '';
@@ -12259,23 +12319,6 @@ var DisplayObject = /** @class */ (function (_super) {
12259
12319
  _this.className = _this.config.className || _this.config.class;
12260
12320
  }
12261
12321
  _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
12322
  // merge parsed value
12280
12323
  Object.assign(_this.parsedStyle, runtime.enableCSSParsing
12281
12324
  ? DEFAULT_PARSED_STYLE_PROPS
@@ -13035,7 +13078,7 @@ var Circle = /** @class */ (function (_super) {
13035
13078
  if (_a === void 0) { _a = {}; }
13036
13079
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13037
13080
  return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE, style: runtime.enableCSSParsing
13038
- ? tslib.__assign({ cx: '', cy: '', r: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
13081
+ ? tslib.__assign({ cx: '', cy: '', r: '' }, style) : style, initialParsedStyle: {
13039
13082
  transformOrigin: runtime.enableCSSParsing
13040
13083
  ? null
13041
13084
  : [PECENTAGE_50, PECENTAGE_50],
@@ -13072,7 +13115,7 @@ var Ellipse = /** @class */ (function (_super) {
13072
13115
  if (_a === void 0) { _a = {}; }
13073
13116
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13074
13117
  return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE, style: runtime.enableCSSParsing
13075
- ? tslib.__assign({ cx: '', cy: '', rx: '', ry: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
13118
+ ? tslib.__assign({ cx: '', cy: '', rx: '', ry: '' }, style) : style, initialParsedStyle: {
13076
13119
  transformOrigin: runtime.enableCSSParsing
13077
13120
  ? null
13078
13121
  : [PECENTAGE_50, PECENTAGE_50],