@antv/g-lite 1.3.0-next.0 → 1.3.0-next.10

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
@@ -3186,7 +3186,7 @@ var getOrCreateUnitValue = function (value, unitOrName) {
3186
3186
  if (unitOrName === void 0) { unitOrName = exports.UnitType.kNumber; }
3187
3187
  return new CSSUnitValue(value, unitOrName);
3188
3188
  };
3189
- var PECENTAGE_50 = new CSSUnitValue(50, '%');
3189
+ new CSSUnitValue(50, '%');
3190
3190
 
3191
3191
  /**
3192
3192
  * @see https://doc.babylonjs.com/how_to/optimizing_your_scene#changing-mesh-culling-strategy
@@ -4128,19 +4128,17 @@ function parseDimensionArray(string) {
4128
4128
  // },
4129
4129
  // ];
4130
4130
  // }
4131
- function convertPercentUnit(valueWithUnit, vec3Index, target) {
4132
- if (valueWithUnit.value === 0) {
4133
- return 0;
4134
- }
4131
+ function convertPercentUnit(valueWithUnit, vec3Index, target, useMin) {
4132
+ if (useMin === void 0) { useMin = false; }
4135
4133
  if (valueWithUnit.unit === exports.UnitType.kPixels) {
4136
4134
  return Number(valueWithUnit.value);
4137
4135
  }
4138
4136
  else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
4139
4137
  var bounds = target.nodeName === exports.Shape.GROUP
4140
4138
  ? target.getLocalBounds()
4141
- : // : target.getGeometryBounds();
4142
- target.geometry.contentBounds;
4143
- return (valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2;
4139
+ : target.getGeometryBounds();
4140
+ return ((useMin ? bounds.min[vec3Index] : 0) +
4141
+ (valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2);
4144
4142
  }
4145
4143
  return 0;
4146
4144
  }
@@ -4922,7 +4920,6 @@ function rectToCommands(width, height, x, y, radius) {
4922
4920
  /**
4923
4921
  * convert object to path, should account for:
4924
4922
  * * transform & origin
4925
- * * anchor
4926
4923
  * * lineWidth
4927
4924
  */
4928
4925
  function convertToPath(object, transform) {
@@ -5980,7 +5977,7 @@ function convertKeyword2Percent(keyword) {
5980
5977
  return '50%';
5981
5978
  }
5982
5979
  else if (keyword === 'left' || keyword === 'top') {
5983
- return '0';
5980
+ return '0%';
5984
5981
  }
5985
5982
  else if (keyword === 'right' || keyword === 'bottom') {
5986
5983
  return '100%';
@@ -6248,47 +6245,38 @@ var BUILT_IN_PROPERTIES = [
6248
6245
  {
6249
6246
  n: 'transformOrigin',
6250
6247
  p: 100,
6251
- // int: true,
6252
- d: function (nodeName) {
6253
- if (nodeName === exports.Shape.CIRCLE || nodeName === exports.Shape.ELLIPSE) {
6254
- return 'center';
6255
- }
6256
- if (nodeName === exports.Shape.TEXT) {
6257
- return 'text-anchor';
6258
- }
6259
- return 'left top';
6260
- },
6248
+ d: '0 0',
6249
+ // // int: true,
6250
+ // d: (nodeName: string) => {
6251
+ // if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
6252
+ // return 'center';
6253
+ // }
6254
+ // if (nodeName === Shape.TEXT) {
6255
+ // return 'text-anchor';
6256
+ // }
6257
+ // return 'left top';
6258
+ // },
6261
6259
  l: true,
6262
6260
  syntax: exports.PropertySyntax.TRANSFORM_ORIGIN,
6263
6261
  },
6264
- {
6265
- n: 'anchor',
6266
- p: 99,
6267
- d: function (nodeName) {
6268
- // if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
6269
- // return '0.5 0.5';
6270
- // }
6271
- return '0 0';
6272
- },
6273
- l: true,
6274
- syntax: exports.PropertySyntax.LENGTH_PERCENTAGE_12,
6275
- },
6276
- // <circle> & <ellipse>
6277
6262
  {
6278
6263
  n: 'cx',
6279
6264
  int: true,
6265
+ l: true,
6280
6266
  d: '0',
6281
6267
  syntax: exports.PropertySyntax.COORDINATE,
6282
6268
  },
6283
6269
  {
6284
6270
  n: 'cy',
6285
6271
  int: true,
6272
+ l: true,
6286
6273
  d: '0',
6287
6274
  syntax: exports.PropertySyntax.COORDINATE,
6288
6275
  },
6289
6276
  {
6290
6277
  n: 'cz',
6291
6278
  int: true,
6279
+ l: true,
6292
6280
  d: '0',
6293
6281
  syntax: exports.PropertySyntax.COORDINATE,
6294
6282
  },
@@ -6318,6 +6306,7 @@ var BUILT_IN_PROPERTIES = [
6318
6306
  // x in local space
6319
6307
  n: 'x',
6320
6308
  int: true,
6309
+ l: true,
6321
6310
  d: '0',
6322
6311
  syntax: exports.PropertySyntax.COORDINATE,
6323
6312
  },
@@ -6325,6 +6314,7 @@ var BUILT_IN_PROPERTIES = [
6325
6314
  // y in local space
6326
6315
  n: 'y',
6327
6316
  int: true,
6317
+ l: true,
6328
6318
  d: '0',
6329
6319
  syntax: exports.PropertySyntax.COORDINATE,
6330
6320
  },
@@ -6332,6 +6322,7 @@ var BUILT_IN_PROPERTIES = [
6332
6322
  // z in local space
6333
6323
  n: 'z',
6334
6324
  int: true,
6325
+ l: true,
6335
6326
  d: '0',
6336
6327
  syntax: exports.PropertySyntax.COORDINATE,
6337
6328
  },
@@ -6695,11 +6686,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6695
6686
  if (attributes.offsetPath) {
6696
6687
  this.runtime.CSSPropertySyntaxFactory['<defined-path>'].calculator('offsetPath', oldOffsetPath, attributes.offsetPath, object, this.runtime);
6697
6688
  }
6698
- if (attributes.anchor) {
6699
- object.parsedStyle.anchor = parseDimensionArrayFormat(
6700
- // @ts-ignorex
6701
- attributes.anchor, 2);
6702
- }
6703
6689
  if (attributes.transform) {
6704
6690
  object.parsedStyle.transform = parseTransform(attributes.transform);
6705
6691
  }
@@ -6734,14 +6720,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6734
6720
  if (!util.isNil(attributes.zIndex)) {
6735
6721
  this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames_1);
6736
6722
  }
6737
- // @ts-ignore
6738
- if (attributes.path) {
6739
- this.runtime.CSSPropertySyntaxFactory['<path>'].postProcessor(object, attributeNames_1);
6740
- }
6741
- // @ts-ignore
6742
- if (attributes.points) {
6743
- this.runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object, attributeNames_1);
6744
- }
6745
6723
  if (!util.isNil(attributes.offsetDistance)) {
6746
6724
  this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames_1);
6747
6725
  }
@@ -6749,7 +6727,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6749
6727
  this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames_1);
6750
6728
  }
6751
6729
  if (needUpdateGeometry_1) {
6752
- this.updateGeometry(object);
6730
+ object.geometry.dirty = true;
6731
+ // FIXME setOrigin may have already dirtified to root.
6732
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6753
6733
  }
6754
6734
  return;
6755
6735
  }
@@ -6776,7 +6756,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6776
6756
  // points 50
6777
6757
  // text 50
6778
6758
  // textTransform 51
6779
- // anchor 99
6780
6759
  // transform 100
6781
6760
  // transformOrigin 100
6782
6761
  if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
@@ -6788,7 +6767,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6788
6767
  // 'points',
6789
6768
  // 'text',
6790
6769
  // 'textTransform',
6791
- // 'anchor',
6792
6770
  // 'transform',
6793
6771
  // 'transformOrigin',
6794
6772
  // ].forEach((name) => {
@@ -6810,9 +6788,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6810
6788
  // }
6811
6789
  // update geometry
6812
6790
  if (needUpdateGeometry) {
6813
- // object.geometry.dirty = true;
6814
- // runtime.sceneGraphService.dirtifyToRoot(object);
6815
- this.updateGeometry(object);
6791
+ object.geometry.dirty = true;
6792
+ // FIXME setOrigin may have already dirtified to root.
6793
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6816
6794
  }
6817
6795
  attributeNames.forEach(function (name) {
6818
6796
  if (name in object.parsedStyle) {
@@ -7009,7 +6987,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7009
6987
  geometry_1.renderBounds = new AABB();
7010
6988
  }
7011
6989
  var parsedStyle = object.parsedStyle;
7012
- var _a = geometryUpdater.update(parsedStyle, object), cx = _a.cx, cy = _a.cy, _b = _a.cz, cz = _b === void 0 ? 0 : _b, hwidth = _a.hwidth, hheight = _a.hheight, _c = _a.hdepth, hdepth = _c === void 0 ? 0 : _c;
6990
+ var _a = geometryUpdater.update(parsedStyle, object), _b = _a.cx, cx = _b === void 0 ? 0 : _b, _c = _a.cy, cy = _c === void 0 ? 0 : _c, _d = _a.cz, cz = _d === void 0 ? 0 : _d, _e = _a.hwidth, hwidth = _e === void 0 ? 0 : _e, _f = _a.hheight, hheight = _f === void 0 ? 0 : _f, _g = _a.hdepth, hdepth = _g === void 0 ? 0 : _g;
7013
6991
  // init with content box
7014
6992
  var halfExtents = [
7015
6993
  Math.abs(hwidth),
@@ -7023,18 +7001,11 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7023
7001
  // depth / 2,
7024
7002
  // );
7025
7003
  // anchor is center by default, don't account for lineWidth here
7026
- var _d = parsedStyle, stroke = _d.stroke, lineWidth = _d.lineWidth,
7004
+ var _h = parsedStyle, stroke = _h.stroke, lineWidth = _h.lineWidth,
7027
7005
  // lineCap,
7028
7006
  // lineJoin,
7029
7007
  // miterLimit,
7030
- increasedLineWidthForHitTesting = _d.increasedLineWidthForHitTesting, shadowType = _d.shadowType, shadowColor = _d.shadowColor, _e = _d.filter, filter = _e === void 0 ? [] : _e, transformOrigin = _d.transformOrigin;
7031
- // let anchor = parsedStyle.anchor;
7032
- // <Text> use textAlign & textBaseline instead of anchor
7033
- // if (nodeName === Shape.TEXT) {
7034
- // delete parsedStyle.anchor;
7035
- // } else if (nodeName === Shape.MESH) {
7036
- // parsedStyle.anchor[2] = 0.5;
7037
- // }
7008
+ increasedLineWidthForHitTesting = _h.increasedLineWidthForHitTesting, shadowType = _h.shadowType, shadowColor = _h.shadowColor, _j = _h.filter, filter = _j === void 0 ? [] : _j, transformOrigin = _h.transformOrigin;
7038
7009
  var center = [cx, cy, cz];
7039
7010
  // update geometry's AABB
7040
7011
  geometry_1.contentBounds.update(center, halfExtents);
@@ -7068,8 +7039,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7068
7039
  geometry_1.renderBounds.update(center, halfExtents);
7069
7040
  // account for shadow, only support constant value now
7070
7041
  if (shadowColor && shadowType && shadowType !== 'inner') {
7071
- var _f = geometry_1.renderBounds, min = _f.min, max = _f.max;
7072
- var _g = parsedStyle, shadowBlur = _g.shadowBlur, shadowOffsetX = _g.shadowOffsetX, shadowOffsetY = _g.shadowOffsetY;
7042
+ var _k = geometry_1.renderBounds, min = _k.min, max = _k.max;
7043
+ var _l = parsedStyle, shadowBlur = _l.shadowBlur, shadowOffsetX = _l.shadowOffsetX, shadowOffsetY = _l.shadowOffsetY;
7073
7044
  var shadowBlurInPixels = shadowBlur || 0;
7074
7045
  var shadowOffsetXInPixels = shadowOffsetX || 0;
7075
7046
  var shadowOffsetYInPixels = shadowOffsetY || 0;
@@ -7106,25 +7077,22 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7106
7077
  geometry_1.renderBounds.setMinMax(min, max);
7107
7078
  }
7108
7079
  });
7109
- // if (nodeName === Shape.RECT) {
7110
- // account for negative width / height of Rect
7080
+ object.geometry.dirty = false;
7111
7081
  // @see https://github.com/antvis/g/issues/957
7112
7082
  var flipY = hwidth < 0;
7113
7083
  var flipX = hheight < 0;
7114
- // } else {
7115
- // }
7116
7084
  // set transform origin
7117
7085
  var usedOriginXValue = (flipY ? -1 : 1) *
7118
7086
  (transformOrigin
7119
- ? convertPercentUnit(transformOrigin[0], 0, object)
7087
+ ? convertPercentUnit(transformOrigin[0], 0, object, true)
7120
7088
  : 0);
7121
7089
  var usedOriginYValue = (flipX ? -1 : 1) *
7122
7090
  (transformOrigin
7123
- ? convertPercentUnit(transformOrigin[1], 1, object)
7091
+ ? convertPercentUnit(transformOrigin[1], 1, object, true)
7124
7092
  : 0);
7125
- object.setOrigin(cx - hwidth + usedOriginXValue, cy - hheight + usedOriginYValue);
7126
- // FIXME setOrigin may have already dirtified to root.
7127
- this.runtime.sceneGraphService.dirtifyToRoot(object);
7093
+ if (usedOriginXValue || usedOriginYValue) {
7094
+ object.setOrigin(usedOriginXValue, usedOriginYValue);
7095
+ }
7128
7096
  }
7129
7097
  };
7130
7098
  DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
@@ -7861,92 +7829,121 @@ function toFontString(attributes) {
7861
7829
  return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
7862
7830
  }
7863
7831
 
7864
- var tmpMat4 = glMatrix.mat4.create();
7832
+ function createSkewMatrix(skewMatrix, skewX, skewY) {
7833
+ // Create an identity matrix
7834
+ glMatrix.mat4.identity(skewMatrix);
7835
+ // Apply skew to the matrix
7836
+ skewMatrix[4] = Math.tan(skewX); // Skew Y axis in X direction
7837
+ skewMatrix[1] = Math.tan(skewY); // Skew X axis in Y direction
7838
+ return skewMatrix;
7839
+ }
7840
+ var tmpMat1 = glMatrix.mat4.create();
7841
+ var tmpMat2 = glMatrix.mat4.create();
7865
7842
  function parsedTransformToMat4(transform, object) {
7866
- // reset transform
7867
- object.resetLocalTransform();
7868
- transform.forEach(function (parsed) {
7869
- var t = parsed.t, d = parsed.d;
7870
- if (t === 'scale') {
7871
- // scale(1) scale(1, 1)
7872
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1];
7873
- object.scaleLocal(newScale[0], newScale[1], 1);
7874
- }
7875
- else if (t === 'scalex') {
7876
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7877
- object.scaleLocal(newScale[0], 1, 1);
7878
- }
7879
- else if (t === 'scaley') {
7880
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7881
- object.scaleLocal(1, newScale[0], 1);
7882
- }
7883
- else if (t === 'scalez') {
7884
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7885
- object.scaleLocal(1, 1, newScale[0]);
7886
- }
7887
- else if (t === 'scale3d') {
7888
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1, 1];
7889
- object.scaleLocal(newScale[0], newScale[1], newScale[2]);
7890
- }
7891
- else if (t === 'translate') {
7892
- var newTranslation = d || [Opx, Opx];
7893
- object.translateLocal(newTranslation[0].value, newTranslation[1].value, 0);
7894
- }
7895
- else if (t === 'translatex') {
7896
- var newTranslation = d || [Opx];
7897
- object.translateLocal(newTranslation[0].value, 0, 0);
7898
- }
7899
- else if (t === 'translatey') {
7900
- var newTranslation = d || [Opx];
7901
- object.translateLocal(0, newTranslation[0].value, 0);
7902
- }
7903
- else if (t === 'translatez') {
7904
- var newTranslation = d || [Opx];
7905
- object.translateLocal(0, 0, newTranslation[0].value);
7906
- }
7907
- else if (t === 'translate3d') {
7908
- var newTranslation = d || [Opx, Opx, Opx];
7909
- object.translateLocal(newTranslation[0].value, newTranslation[1].value, newTranslation[2].value);
7910
- }
7911
- else if (t === 'rotate') {
7912
- var newAngles = d || [Odeg];
7913
- object.rotateLocal(0, 0, convertAngleUnit(newAngles[0]));
7914
- }
7915
- else if (t === 'rotatex') {
7916
- var newAngles = d || [Odeg];
7917
- object.rotateLocal(convertAngleUnit(newAngles[0]), 0, 0);
7918
- }
7919
- else if (t === 'rotatey') {
7920
- var newAngles = d || [Odeg];
7921
- object.rotateLocal(0, convertAngleUnit(newAngles[0]), 0);
7922
- }
7923
- else if (t === 'rotatez') {
7924
- var newAngles = d || [Odeg];
7925
- object.rotateLocal(0, 0, convertAngleUnit(newAngles[0]));
7926
- }
7927
- else if (t === 'rotate3d') ;
7928
- else if (t === 'skew') {
7929
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0, 0];
7930
- object.setLocalSkew(deg2rad(newSkew[0]), deg2rad(newSkew[1]));
7931
- }
7932
- else if (t === 'skewx') {
7933
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7934
- object.setLocalSkew(deg2rad(newSkew[0]), object.getLocalSkew()[1]);
7935
- }
7936
- else if (t === 'skewy') {
7937
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7938
- object.setLocalSkew(object.getLocalSkew()[0], deg2rad(newSkew[0]));
7939
- }
7940
- else if (t === 'matrix') {
7941
- var _a = tslib.__read(d.map(function (s) { return s.value; }), 6), a = _a[0], b = _a[1], c = _a[2], dd = _a[3], tx = _a[4], ty = _a[5];
7942
- object.setLocalTransform(glMatrix.mat4.set(tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1));
7943
- }
7944
- else if (t === 'matrix3d') {
7945
- // @ts-ignore
7946
- glMatrix.mat4.set.apply(glMatrix.mat4, tslib.__spreadArray([tmpMat4], tslib.__read(d.map(function (s) { return s.value; })), false));
7947
- object.setLocalTransform(tmpMat4);
7948
- }
7949
- });
7843
+ if (transform.length) {
7844
+ var m_1 = glMatrix.mat4.identity(tmpMat1);
7845
+ transform.forEach(function (parsed) {
7846
+ var t = parsed.t, d = parsed.d;
7847
+ if (t === 'scale') {
7848
+ // scale(1) scale(1, 1)
7849
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1];
7850
+ glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], 1]);
7851
+ }
7852
+ else if (t === 'scalex') {
7853
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7854
+ glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], 1, 1]);
7855
+ }
7856
+ else if (t === 'scaley') {
7857
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7858
+ glMatrix.mat4.fromScaling(tmpMat2, [1, newScale[0], 1]);
7859
+ }
7860
+ else if (t === 'scalez') {
7861
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7862
+ glMatrix.mat4.fromScaling(tmpMat2, [1, 1, newScale[0]]);
7863
+ }
7864
+ else if (t === 'scale3d') {
7865
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1, 1];
7866
+ glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], newScale[2]]);
7867
+ }
7868
+ else if (t === 'translate') {
7869
+ var newTranslation = d || [Opx, Opx];
7870
+ glMatrix.mat4.fromTranslation(tmpMat2, [
7871
+ newTranslation[0].value,
7872
+ newTranslation[1].value,
7873
+ 0,
7874
+ ]);
7875
+ }
7876
+ else if (t === 'translatex') {
7877
+ var newTranslation = d || [Opx];
7878
+ glMatrix.mat4.fromTranslation(tmpMat2, [newTranslation[0].value, 0, 0]);
7879
+ }
7880
+ else if (t === 'translatey') {
7881
+ var newTranslation = d || [Opx];
7882
+ glMatrix.mat4.fromTranslation(tmpMat2, [0, newTranslation[0].value, 0]);
7883
+ }
7884
+ else if (t === 'translatez') {
7885
+ var newTranslation = d || [Opx];
7886
+ glMatrix.mat4.fromTranslation(tmpMat2, [0, 0, newTranslation[0].value]);
7887
+ }
7888
+ else if (t === 'translate3d') {
7889
+ var newTranslation = d || [Opx, Opx, Opx];
7890
+ glMatrix.mat4.fromTranslation(tmpMat2, [
7891
+ newTranslation[0].value,
7892
+ newTranslation[1].value,
7893
+ newTranslation[2].value,
7894
+ ]);
7895
+ }
7896
+ else if (t === 'rotate') {
7897
+ var newAngles = d || [Odeg];
7898
+ glMatrix.mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
7899
+ }
7900
+ else if (t === 'rotatex') {
7901
+ var newAngles = d || [Odeg];
7902
+ glMatrix.mat4.fromXRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
7903
+ }
7904
+ else if (t === 'rotatey') {
7905
+ var newAngles = d || [Odeg];
7906
+ glMatrix.mat4.fromYRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
7907
+ }
7908
+ else if (t === 'rotatez') {
7909
+ var newAngles = d || [Odeg];
7910
+ glMatrix.mat4.fromZRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[0])));
7911
+ }
7912
+ else if (t === 'rotate3d') {
7913
+ var newAngles = d || [Opx, Opx, Opx, Odeg];
7914
+ glMatrix.mat4.fromRotation(tmpMat2, deg2rad(convertAngleUnit(newAngles[3])), [
7915
+ newAngles[0].value,
7916
+ newAngles[1].value,
7917
+ newAngles[2].value,
7918
+ ]);
7919
+ }
7920
+ else if (t === 'skew') {
7921
+ var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0, 0];
7922
+ createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), deg2rad(newSkew[1]));
7923
+ }
7924
+ else if (t === 'skewx') {
7925
+ var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7926
+ createSkewMatrix(tmpMat2, deg2rad(newSkew[0]), 0);
7927
+ }
7928
+ else if (t === 'skewy') {
7929
+ var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7930
+ createSkewMatrix(tmpMat2, 0, deg2rad(newSkew[0]));
7931
+ }
7932
+ else if (t === 'matrix') {
7933
+ 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];
7934
+ glMatrix.mat4.set(tmpMat2, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1);
7935
+ }
7936
+ else if (t === 'matrix3d') {
7937
+ // @ts-ignore
7938
+ glMatrix.mat4.set.apply(glMatrix.mat4, tslib.__spreadArray([tmpMat2], tslib.__read(d.map(function (s) { return s.value; })), false));
7939
+ }
7940
+ glMatrix.mat4.mul(m_1, m_1, tmpMat2);
7941
+ });
7942
+ object.setLocalTransform(m_1);
7943
+ }
7944
+ else {
7945
+ object.resetLocalTransform();
7946
+ }
7950
7947
  return object.getLocalTransform();
7951
7948
  }
7952
7949
 
@@ -8010,17 +8007,18 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
8010
8007
  function CSSPropertyTransformOrigin() {
8011
8008
  this.parser = parseTransformOrigin;
8012
8009
  this.parserUnmemoize = parseTransformOriginUnmemoize;
8013
- // calculator(
8014
- // name: string,
8015
- // oldParsed: [CSSUnitValue, CSSUnitValue],
8016
- // parsed: [CSSUnitValue, CSSUnitValue],
8017
- // object: DisplayObject,
8018
- // ): [number, number] {
8019
- // console.log(object, parsed);
8020
- // return [parsed[0].value, parsed[1].value];
8021
- // // return [convertPercentUnit(parsed[0], 0, object), convertPercentUnit(parsed[1], 1, object)];
8022
- // }
8023
8010
  }
8011
+ CSSPropertyTransformOrigin.prototype.postProcessor = function (object) {
8012
+ var transformOrigin = object.parsedStyle.transformOrigin;
8013
+ if (transformOrigin[0].unit === exports.UnitType.kPixels &&
8014
+ transformOrigin[1].unit === exports.UnitType.kPixels) {
8015
+ object.setOrigin(transformOrigin[0].value, transformOrigin[1].value);
8016
+ }
8017
+ else {
8018
+ // Relative to geometry bounds, calculate later.
8019
+ object.getGeometryBounds();
8020
+ }
8021
+ };
8024
8022
  return CSSPropertyTransformOrigin;
8025
8023
  }());
8026
8024
 
@@ -8054,7 +8052,7 @@ var CircleUpdater = /** @class */ (function () {
8054
8052
  function CircleUpdater() {
8055
8053
  }
8056
8054
  CircleUpdater.prototype.update = function (parsedStyle, object) {
8057
- var cx = parsedStyle.cx, cy = parsedStyle.cy, r = parsedStyle.r;
8055
+ var _a = parsedStyle.cx, cx = _a === void 0 ? 0 : _a, _b = parsedStyle.cy, cy = _b === void 0 ? 0 : _b, _c = parsedStyle.r, r = _c === void 0 ? 0 : _c;
8058
8056
  return {
8059
8057
  cx: cx,
8060
8058
  cy: cy,
@@ -8069,7 +8067,7 @@ var EllipseUpdater = /** @class */ (function () {
8069
8067
  function EllipseUpdater() {
8070
8068
  }
8071
8069
  EllipseUpdater.prototype.update = function (parsedStyle, object) {
8072
- var cx = parsedStyle.cx, cy = parsedStyle.cy, rx = parsedStyle.rx, ry = parsedStyle.ry;
8070
+ var _a = parsedStyle.cx, cx = _a === void 0 ? 0 : _a, _b = parsedStyle.cy, cy = _b === void 0 ? 0 : _b, _c = parsedStyle.rx, rx = _c === void 0 ? 0 : _c, _d = parsedStyle.ry, ry = _d === void 0 ? 0 : _d;
8073
8071
  return {
8074
8072
  cx: cx,
8075
8073
  cy: cy,
@@ -8157,7 +8155,7 @@ var RectUpdater = /** @class */ (function () {
8157
8155
  function RectUpdater() {
8158
8156
  }
8159
8157
  RectUpdater.prototype.update = function (parsedStyle, object) {
8160
- var x = parsedStyle.x, y = parsedStyle.y, img = parsedStyle.img, _a = parsedStyle.width, width = _a === void 0 ? 0 : _a, _b = parsedStyle.height, height = _b === void 0 ? 0 : _b;
8158
+ var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b, img = parsedStyle.img, _c = parsedStyle.width, width = _c === void 0 ? 0 : _c, _d = parsedStyle.height, height = _d === void 0 ? 0 : _d;
8161
8159
  var contentWidth = width;
8162
8160
  var contentHeight = height;
8163
8161
  // resize with HTMLImageElement's size
@@ -8198,7 +8196,7 @@ var TextUpdater = /** @class */ (function () {
8198
8196
  };
8199
8197
  TextUpdater.prototype.update = function (parsedStyle, object) {
8200
8198
  var _a, _b;
8201
- var text = parsedStyle.text, textAlign = parsedStyle.textAlign, lineWidth = parsedStyle.lineWidth, textBaseline = parsedStyle.textBaseline, dx = parsedStyle.dx, dy = parsedStyle.dy, x = parsedStyle.x, y = parsedStyle.y;
8199
+ var text = parsedStyle.text, textAlign = parsedStyle.textAlign, lineWidth = parsedStyle.lineWidth, textBaseline = parsedStyle.textBaseline, dx = parsedStyle.dx, dy = parsedStyle.dy, _c = parsedStyle.x, x = _c === void 0 ? 0 : _c, _d = parsedStyle.y, y = _d === void 0 ? 0 : _d;
8202
8200
  if (!this.isReadyToMeasure(parsedStyle, object)) {
8203
8201
  parsedStyle.metrics = {
8204
8202
  font: '',
@@ -8270,6 +8268,20 @@ var TextUpdater = /** @class */ (function () {
8270
8268
  return TextUpdater;
8271
8269
  }());
8272
8270
 
8271
+ var GroupUpdater = /** @class */ (function () {
8272
+ function GroupUpdater() {
8273
+ }
8274
+ GroupUpdater.prototype.update = function (parsedStyle, object) {
8275
+ return {
8276
+ cx: 0,
8277
+ cy: 0,
8278
+ hwidth: 0,
8279
+ hheight: 0,
8280
+ };
8281
+ };
8282
+ return GroupUpdater;
8283
+ }());
8284
+
8273
8285
  function isFederatedEvent(value) {
8274
8286
  return !!value.type;
8275
8287
  }
@@ -8820,7 +8832,7 @@ var EventTarget = /** @class */ (function () {
8820
8832
  var Node = /** @class */ (function (_super) {
8821
8833
  tslib.__extends(Node, _super);
8822
8834
  function Node() {
8823
- var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
8835
+ var _this = _super.call(this) || this;
8824
8836
  _this.shadow = false;
8825
8837
  /**
8826
8838
  * points to canvas.document
@@ -10369,9 +10381,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10369
10381
  */
10370
10382
  this.rotate = (function () {
10371
10383
  var parentInvertRotation = glMatrix.quat.create();
10372
- return function (element, degrees, y, z) {
10384
+ return function (element, degrees, y, z, dirtify) {
10373
10385
  if (y === void 0) { y = 0; }
10374
10386
  if (z === void 0) { z = 0; }
10387
+ if (dirtify === void 0) { dirtify = true; }
10375
10388
  if (typeof degrees === 'number') {
10376
10389
  degrees = glMatrix.vec3.fromValues(degrees, y, z);
10377
10390
  }
@@ -10390,7 +10403,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10390
10403
  glMatrix.quat.multiply(rotation, parentInvertRotation, rotation);
10391
10404
  glMatrix.quat.multiply(transform.localRotation, rotation, rot);
10392
10405
  glMatrix.quat.normalize(transform.localRotation, transform.localRotation);
10393
- _this.dirtifyLocal(element, transform);
10406
+ if (dirtify) {
10407
+ _this.dirtifyLocal(element, transform);
10408
+ }
10394
10409
  }
10395
10410
  };
10396
10411
  })();
@@ -10400,16 +10415,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
10400
10415
  */
10401
10416
  this.rotateLocal = (function () {
10402
10417
  var rotation = glMatrix.quat.create();
10403
- return function (element, degrees, y, z) {
10418
+ return function (element, degrees, y, z, dirtify) {
10404
10419
  if (y === void 0) { y = 0; }
10405
10420
  if (z === void 0) { z = 0; }
10421
+ if (dirtify === void 0) { dirtify = true; }
10406
10422
  if (typeof degrees === 'number') {
10407
10423
  degrees = glMatrix.vec3.fromValues(degrees, y, z);
10408
10424
  }
10409
10425
  var transform = element.transformable;
10410
10426
  glMatrix.quat.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
10411
10427
  glMatrix.quat.mul(transform.localRotation, transform.localRotation, rotation);
10412
- _this.dirtifyLocal(element, transform);
10428
+ if (dirtify) {
10429
+ _this.dirtifyLocal(element, transform);
10430
+ }
10413
10431
  };
10414
10432
  })();
10415
10433
  /**
@@ -10417,9 +10435,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10417
10435
  */
10418
10436
  this.setEulerAngles = (function () {
10419
10437
  var invParentRot = glMatrix.quat.create();
10420
- return function (element, degrees, y, z) {
10438
+ return function (element, degrees, y, z, dirtify) {
10421
10439
  if (y === void 0) { y = 0; }
10422
10440
  if (z === void 0) { z = 0; }
10441
+ if (dirtify === void 0) { dirtify = true; }
10423
10442
  if (typeof degrees === 'number') {
10424
10443
  degrees = glMatrix.vec3.fromValues(degrees, y, z);
10425
10444
  }
@@ -10433,7 +10452,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10433
10452
  var parentRotation = _this.getRotation(element.parentNode);
10434
10453
  glMatrix.quat.copy(invParentRot, glMatrix.quat.invert(glMatrix.quat.create(), parentRotation));
10435
10454
  glMatrix.quat.mul(transform.localRotation, transform.localRotation, invParentRot);
10436
- _this.dirtifyLocal(element, transform);
10455
+ if (dirtify) {
10456
+ _this.dirtifyLocal(element, transform);
10457
+ }
10437
10458
  }
10438
10459
  };
10439
10460
  })();
@@ -10447,9 +10468,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10447
10468
  * ```
10448
10469
  */
10449
10470
  this.translateLocal = (function () {
10450
- return function (element, translation, y, z) {
10471
+ return function (element, translation, y, z, dirtify) {
10451
10472
  if (y === void 0) { y = 0; }
10452
10473
  if (z === void 0) { z = 0; }
10474
+ if (dirtify === void 0) { dirtify = true; }
10453
10475
  if (typeof translation === 'number') {
10454
10476
  translation = glMatrix.vec3.fromValues(translation, y, z);
10455
10477
  }
@@ -10459,7 +10481,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10459
10481
  }
10460
10482
  glMatrix.vec3.transformQuat(translation, translation, transform.localRotation);
10461
10483
  glMatrix.vec3.add(transform.localPosition, transform.localPosition, translation);
10462
- _this.dirtifyLocal(element, transform);
10484
+ if (dirtify) {
10485
+ _this.dirtifyLocal(element, transform);
10486
+ }
10463
10487
  };
10464
10488
  })();
10465
10489
  /**
@@ -10471,7 +10495,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
10471
10495
  this.setPosition = (function () {
10472
10496
  var parentInvertMatrix = glMatrix.mat4.create();
10473
10497
  var tmpPosition = glMatrix.vec3.create();
10474
- return function (element, position) {
10498
+ return function (element, position, dirtify) {
10499
+ if (dirtify === void 0) { dirtify = true; }
10475
10500
  var transform = element.transformable;
10476
10501
  tmpPosition[0] = position[0];
10477
10502
  tmpPosition[1] = position[1];
@@ -10490,7 +10515,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10490
10515
  glMatrix.mat4.invert(parentInvertMatrix, parentInvertMatrix);
10491
10516
  glMatrix.vec3.transformMat4(transform.localPosition, tmpPosition, parentInvertMatrix);
10492
10517
  }
10493
- _this.dirtifyLocal(element, transform);
10518
+ if (dirtify) {
10519
+ _this.dirtifyLocal(element, transform);
10520
+ }
10494
10521
  };
10495
10522
  })();
10496
10523
  /**
@@ -10498,7 +10525,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
10498
10525
  */
10499
10526
  this.setLocalPosition = (function () {
10500
10527
  var tmpPosition = glMatrix.vec3.create();
10501
- return function (element, position) {
10528
+ return function (element, position, dirtify) {
10529
+ if (dirtify === void 0) { dirtify = true; }
10502
10530
  var transform = element.transformable;
10503
10531
  tmpPosition[0] = position[0];
10504
10532
  tmpPosition[1] = position[1];
@@ -10507,7 +10535,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10507
10535
  return;
10508
10536
  }
10509
10537
  glMatrix.vec3.copy(transform.localPosition, tmpPosition);
10510
- _this.dirtifyLocal(element, transform);
10538
+ if (dirtify) {
10539
+ _this.dirtifyLocal(element, transform);
10540
+ }
10511
10541
  };
10512
10542
  })();
10513
10543
  /**
@@ -10526,9 +10556,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10526
10556
  var zeroVec3 = glMatrix.vec3.create();
10527
10557
  var tmpVec3 = glMatrix.vec3.create();
10528
10558
  var tr = glMatrix.vec3.create();
10529
- return function (element, translation, y, z) {
10559
+ return function (element, translation, y, z, dirtify) {
10530
10560
  if (y === void 0) { y = 0; }
10531
10561
  if (z === void 0) { z = 0; }
10562
+ if (dirtify === void 0) { dirtify = true; }
10532
10563
  if (typeof translation === 'number') {
10533
10564
  translation = glMatrix.vec3.set(tmpVec3, translation, y, z);
10534
10565
  }
@@ -10536,12 +10567,13 @@ var DefaultSceneGraphService = /** @class */ (function () {
10536
10567
  return;
10537
10568
  }
10538
10569
  glMatrix.vec3.add(tr, _this.getPosition(element), translation);
10539
- _this.setPosition(element, tr);
10570
+ _this.setPosition(element, tr, dirtify);
10540
10571
  };
10541
10572
  })();
10542
10573
  this.setRotation = function () {
10543
10574
  var parentInvertRotation = glMatrix.quat.create();
10544
- return function (element, rotation, y, z, w) {
10575
+ return function (element, rotation, y, z, w, dirtify) {
10576
+ if (dirtify === void 0) { dirtify = true; }
10545
10577
  var transform = element.transformable;
10546
10578
  if (typeof rotation === 'number') {
10547
10579
  rotation = glMatrix.quat.fromValues(rotation, y, z, w);
@@ -10556,7 +10588,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10556
10588
  glMatrix.quat.invert(parentInvertRotation, parentInvertRotation);
10557
10589
  glMatrix.quat.multiply(transform.localRotation, parentInvertRotation, rotation);
10558
10590
  glMatrix.quat.normalize(transform.localRotation, transform.localRotation);
10559
- _this.dirtifyLocal(element, transform);
10591
+ if (dirtify) {
10592
+ _this.dirtifyLocal(element, transform);
10593
+ }
10560
10594
  }
10561
10595
  };
10562
10596
  };
@@ -10597,7 +10631,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10597
10631
  // .filter((node) => !node.shadow);
10598
10632
  };
10599
10633
  DefaultSceneGraphService.prototype.attach = function (child, parent, index) {
10600
- var _a, _b;
10634
+ var _a;
10601
10635
  var detached = false;
10602
10636
  if (child.parentNode) {
10603
10637
  detached = child.parentNode !== parent;
@@ -10613,7 +10647,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10613
10647
  // parent needs re-sort
10614
10648
  var sortable = parent.sortable;
10615
10649
  if (((_a = sortable === null || sortable === void 0 ? void 0 : sortable.sorted) === null || _a === void 0 ? void 0 : _a.length) ||
10616
- ((_b = child.style) === null || _b === void 0 ? void 0 : _b.zIndex)) {
10650
+ child.parsedStyle.zIndex) {
10617
10651
  if (sortable.dirtyChildren.indexOf(child) === -1) {
10618
10652
  sortable.dirtyChildren.push(child);
10619
10653
  }
@@ -10698,40 +10732,52 @@ var DefaultSceneGraphService = /** @class */ (function () {
10698
10732
  /**
10699
10733
  * set euler angles(degrees) in local space
10700
10734
  */
10701
- DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z) {
10735
+ DefaultSceneGraphService.prototype.setLocalEulerAngles = function (element, degrees, y, z, dirtify) {
10702
10736
  if (y === void 0) { y = 0; }
10703
10737
  if (z === void 0) { z = 0; }
10738
+ if (dirtify === void 0) { dirtify = true; }
10704
10739
  if (typeof degrees === 'number') {
10705
10740
  degrees = glMatrix.vec3.fromValues(degrees, y, z);
10706
10741
  }
10707
10742
  var transform = element.transformable;
10708
10743
  glMatrix.quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
10709
- this.dirtifyLocal(element, transform);
10744
+ if (dirtify) {
10745
+ this.dirtifyLocal(element, transform);
10746
+ }
10710
10747
  };
10711
10748
  /**
10712
10749
  * scale in local space
10713
10750
  */
10714
- DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling) {
10751
+ DefaultSceneGraphService.prototype.scaleLocal = function (element, scaling, dirtify) {
10752
+ if (dirtify === void 0) { dirtify = true; }
10715
10753
  var transform = element.transformable;
10716
10754
  glMatrix.vec3.multiply(transform.localScale, transform.localScale, glMatrix.vec3.fromValues(scaling[0], scaling[1], scaling[2] || 1));
10717
- this.dirtifyLocal(element, transform);
10755
+ if (dirtify) {
10756
+ this.dirtifyLocal(element, transform);
10757
+ }
10718
10758
  };
10719
- DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling) {
10759
+ DefaultSceneGraphService.prototype.setLocalScale = function (element, scaling, dirtify) {
10760
+ if (dirtify === void 0) { dirtify = true; }
10720
10761
  var transform = element.transformable;
10721
10762
  var updatedScaling = glMatrix.vec3.fromValues(scaling[0], scaling[1], scaling[2] || transform.localScale[2]);
10722
10763
  if (glMatrix.vec3.equals(updatedScaling, transform.localScale)) {
10723
10764
  return;
10724
10765
  }
10725
10766
  glMatrix.vec3.copy(transform.localScale, updatedScaling);
10726
- this.dirtifyLocal(element, transform);
10767
+ if (dirtify) {
10768
+ this.dirtifyLocal(element, transform);
10769
+ }
10727
10770
  };
10728
- DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w) {
10771
+ DefaultSceneGraphService.prototype.setLocalRotation = function (element, rotation, y, z, w, dirtify) {
10772
+ if (dirtify === void 0) { dirtify = true; }
10729
10773
  if (typeof rotation === 'number') {
10730
10774
  rotation = glMatrix.quat.fromValues(rotation, y, z, w);
10731
10775
  }
10732
10776
  var transform = element.transformable;
10733
10777
  glMatrix.quat.copy(transform.localRotation, rotation);
10734
- this.dirtifyLocal(element, transform);
10778
+ if (dirtify) {
10779
+ this.dirtifyLocal(element, transform);
10780
+ }
10735
10781
  };
10736
10782
  DefaultSceneGraphService.prototype.setLocalSkew = function (element, skew, y) {
10737
10783
  if (typeof skew === 'number') {
@@ -10895,9 +10941,10 @@ var DefaultSceneGraphService = /** @class */ (function () {
10895
10941
  var t = glMatrix.mat4.getTranslation(glMatrix.vec3.create(), transform);
10896
10942
  var r = glMatrix.mat4.getRotation(glMatrix.quat.create(), transform);
10897
10943
  var s = glMatrix.mat4.getScaling(glMatrix.vec3.create(), transform);
10898
- this.setLocalScale(element, s);
10899
- this.setLocalPosition(element, t);
10900
- this.setLocalRotation(element, r);
10944
+ this.setLocalScale(element, s, false);
10945
+ this.setLocalPosition(element, t, false);
10946
+ this.setLocalRotation(element, r, undefined, undefined, undefined, false);
10947
+ this.dirtifyLocal(element, element.transformable);
10901
10948
  };
10902
10949
  DefaultSceneGraphService.prototype.resetLocalTransform = function (element) {
10903
10950
  this.setLocalScale(element, [1, 1, 1]);
@@ -10923,6 +10970,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10923
10970
  DefaultSceneGraphService.prototype.getGeometryBounds = function (element, render) {
10924
10971
  if (render === void 0) { render = false; }
10925
10972
  var geometry = element.geometry;
10973
+ if (geometry.dirty) {
10974
+ runtime.styleValueRegistry.updateGeometry(element);
10975
+ }
10926
10976
  var bounds = render
10927
10977
  ? geometry.renderBounds
10928
10978
  : geometry.contentBounds || null;
@@ -11513,7 +11563,7 @@ var geometryUpdaterFactory = (function () {
11513
11563
  _a[exports.Shape.ELLIPSE] = new EllipseUpdater(),
11514
11564
  _a[exports.Shape.RECT] = rectUpdater,
11515
11565
  _a[exports.Shape.IMAGE] = rectUpdater,
11516
- _a[exports.Shape.GROUP] = rectUpdater,
11566
+ _a[exports.Shape.GROUP] = new GroupUpdater(),
11517
11567
  _a[exports.Shape.LINE] = new LineUpdater(),
11518
11568
  _a[exports.Shape.TEXT] = new TextUpdater(runtime),
11519
11569
  _a[exports.Shape.POLYLINE] = polylineUpdater,
@@ -11607,7 +11657,7 @@ var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
11607
11657
  var Element = /** @class */ (function (_super) {
11608
11658
  tslib.__extends(Element, _super);
11609
11659
  function Element() {
11610
- var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
11660
+ var _this = _super.call(this) || this;
11611
11661
  /**
11612
11662
  * Unique id.
11613
11663
  */
@@ -11651,6 +11701,7 @@ var Element = /** @class */ (function (_super) {
11651
11701
  _this.geometry = {
11652
11702
  contentBounds: undefined,
11653
11703
  renderBounds: undefined,
11704
+ dirty: true,
11654
11705
  };
11655
11706
  _this.rBushNode = {
11656
11707
  aabb: undefined,
@@ -11678,7 +11729,6 @@ var Element = /** @class */ (function (_super) {
11678
11729
  _this.style = {};
11679
11730
  _this.computedStyle = runtime.enableCSSParsing
11680
11731
  ? {
11681
- anchor: unsetKeywordValue,
11682
11732
  opacity: unsetKeywordValue,
11683
11733
  fillOpacity: unsetKeywordValue,
11684
11734
  strokeOpacity: unsetKeywordValue,
@@ -11835,11 +11885,8 @@ var Element = /** @class */ (function (_super) {
11835
11885
  if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
11836
11886
  this.ownerDocument.defaultView.mountChildren(child);
11837
11887
  }
11838
- // @ts-ignore
11839
- if (child.isMutationObserved) {
11840
- insertedEvent.relatedNode = this;
11841
- child.dispatchEvent(insertedEvent);
11842
- }
11888
+ insertedEvent.relatedNode = this;
11889
+ child.dispatchEvent(insertedEvent);
11843
11890
  return child;
11844
11891
  };
11845
11892
  Element.prototype.insertBefore = function (newChild, refChild) {
@@ -12144,7 +12191,7 @@ var Element = /** @class */ (function (_super) {
12144
12191
  /**
12145
12192
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
12146
12193
  */
12147
- Element.prototype.setAttribute = function (attributeName, value, force) {
12194
+ Element.prototype.setAttribute = function (attributeName, value, force, memoize) {
12148
12195
  this.attributes[attributeName] = value;
12149
12196
  };
12150
12197
  Element.prototype.getAttributeNS = function (namespace, localName) {
@@ -12185,7 +12232,6 @@ function isDisplayObject(value) {
12185
12232
  }
12186
12233
  var mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
12187
12234
  var DEFAULT_STYLE_PROPS = {
12188
- anchor: '',
12189
12235
  opacity: '',
12190
12236
  fillOpacity: '',
12191
12237
  strokeOpacity: '',
@@ -12212,7 +12258,6 @@ var DEFAULT_STYLE_PROPS = {
12212
12258
  shadowType: '',
12213
12259
  };
12214
12260
  var DEFAULT_PARSED_STYLE_PROPS = {
12215
- anchor: [0, 0],
12216
12261
  fill: noneColor,
12217
12262
  stroke: noneColor,
12218
12263
  transform: [],
@@ -12283,8 +12328,6 @@ var DisplayObject = /** @class */ (function (_super) {
12283
12328
  // assign name, id to config
12284
12329
  // eg. group.get('name')
12285
12330
  _this.config = config;
12286
- // compatible with G 3.0
12287
- // this.config.interactive = this.config.capture ?? this.config.interactive;
12288
12331
  // init scene graph node
12289
12332
  _this.id = _this.config.id || '';
12290
12333
  _this.name = _this.config.name || '';
@@ -12292,23 +12335,6 @@ var DisplayObject = /** @class */ (function (_super) {
12292
12335
  _this.className = _this.config.className || _this.config.class;
12293
12336
  }
12294
12337
  _this.nodeName = _this.config.type || exports.Shape.GROUP;
12295
- // // compatible with G 3.0
12296
- // this.config.style =
12297
- // this.config.style || this.config.attrs || ({} as StyleProps);
12298
- // // Object.assign(this.config.style, this.config.attrs);
12299
- // // this.config.style = {
12300
- // // // ...DEFAULT_STYLE_PROPS,
12301
- // // ...this.config.style,
12302
- // // ...this.config.attrs,
12303
- // // };
12304
- // if (this.config.visible != null) {
12305
- // this.config.style.visibility =
12306
- // this.config.visible === false ? 'hidden' : 'visible';
12307
- // }
12308
- // if (this.config.interactive != null) {
12309
- // this.config.style.pointerEvents =
12310
- // this.config.interactive === false ? 'none' : 'auto';
12311
- // }
12312
12338
  // merge parsed value
12313
12339
  Object.assign(_this.parsedStyle, runtime.enableCSSParsing
12314
12340
  ? DEFAULT_PARSED_STYLE_PROPS
@@ -12955,125 +12981,13 @@ var DisplayObject = /** @class */ (function (_super) {
12955
12981
  return DisplayObject;
12956
12982
  }(Element));
12957
12983
 
12958
- /**
12959
- * holds useful CSS-related methods.
12960
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
12961
- *
12962
- * * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
12963
- * * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
12964
- * * CSS Layout API
12965
- */
12966
- var CSS = {
12967
- /**
12968
- * <number>
12969
- * @see https://drafts.csswg.org/css-values-4/#number-value
12970
- */
12971
- number: function (n) {
12972
- return new CSSUnitValue(n);
12973
- },
12974
- /**
12975
- * <percentage>
12976
- * @see https://drafts.csswg.org/css-values-4/#percentage-value
12977
- */
12978
- percent: function (n) {
12979
- return new CSSUnitValue(n, '%');
12980
- },
12981
- /**
12982
- * <length>
12983
- */
12984
- px: function (n) {
12985
- return new CSSUnitValue(n, 'px');
12986
- },
12987
- /**
12988
- * <length>
12989
- */
12990
- em: function (n) {
12991
- return new CSSUnitValue(n, 'em');
12992
- },
12993
- rem: function (n) {
12994
- return new CSSUnitValue(n, 'rem');
12995
- },
12996
- /**
12997
- * <angle>
12998
- */
12999
- deg: function (n) {
13000
- return new CSSUnitValue(n, 'deg');
13001
- },
13002
- /**
13003
- * <angle>
13004
- */
13005
- grad: function (n) {
13006
- return new CSSUnitValue(n, 'grad');
13007
- },
13008
- /**
13009
- * <angle>
13010
- */
13011
- rad: function (n) {
13012
- return new CSSUnitValue(n, 'rad');
13013
- },
13014
- /**
13015
- * <angle>
13016
- */
13017
- turn: function (n) {
13018
- return new CSSUnitValue(n, 'turn');
13019
- },
13020
- /**
13021
- * <time>
13022
- */
13023
- s: function (n) {
13024
- return new CSSUnitValue(n, 's');
13025
- },
13026
- /**
13027
- * <time>
13028
- */
13029
- ms: function (n) {
13030
- return new CSSUnitValue(n, 'ms');
13031
- },
13032
- /**
13033
- * CSS Properties & Values API
13034
- *
13035
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
13036
- * @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
13037
- * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
13038
- */
13039
- registerProperty: function (definition) {
13040
- var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
13041
- runtime.styleValueRegistry.registerMetadata({
13042
- n: name,
13043
- inh: inherits,
13044
- int: interpolable,
13045
- d: initialValue,
13046
- syntax: syntax,
13047
- });
13048
- },
13049
- /**
13050
- * CSS Layout API
13051
- * register layout
13052
- *
13053
- * @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
13054
- * @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
13055
- */
13056
- registerLayout: function (name, clazz) {
13057
- runtime.layoutRegistry.registerLayout(name, clazz);
13058
- },
13059
- };
13060
-
13061
12984
  var Circle = /** @class */ (function (_super) {
13062
12985
  tslib.__extends(Circle, _super);
13063
- // constructor(options: DisplayObjectConfig<CircleStyleProps> = {}) {
13064
- // super(options);
13065
- // this.nodeName = Shape.CIRCLE;
13066
- // }
13067
- function Circle(_a) {
13068
- if (_a === void 0) { _a = {}; }
13069
- var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13070
- return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE, style: runtime.enableCSSParsing
13071
- ? tslib.__assign({ cx: '', cy: '', r: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
13072
- // anchor: [0.5, 0.5],
13073
- transformOrigin: runtime.enableCSSParsing
13074
- ? null
13075
- : [PECENTAGE_50, PECENTAGE_50],
13076
- } }, rest)) || this;
12986
+ function Circle(options) {
12987
+ if (options === void 0) { options = {}; }
12988
+ var _this = _super.call(this, options) || this;
12989
+ _this.nodeName = exports.Shape.CIRCLE;
12990
+ return _this;
13077
12991
  }
13078
12992
  return Circle;
13079
12993
  }(DisplayObject));
@@ -13090,7 +13004,7 @@ var CustomElement = /** @class */ (function (_super) {
13090
13004
  var _this = this;
13091
13005
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13092
13006
  _this = _super.call(this, tslib.__assign({ style: runtime.enableCSSParsing
13093
- ? tslib.__assign({ x: '', y: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
13007
+ ? tslib.__assign({}, style) : tslib.__assign({}, style) }, rest)) || this;
13094
13008
  // static get observedAttributes(): string[] {
13095
13009
  // return [];
13096
13010
  // }
@@ -13102,16 +13016,11 @@ var CustomElement = /** @class */ (function (_super) {
13102
13016
 
13103
13017
  var Ellipse = /** @class */ (function (_super) {
13104
13018
  tslib.__extends(Ellipse, _super);
13105
- function Ellipse(_a) {
13106
- if (_a === void 0) { _a = {}; }
13107
- var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13108
- return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE, style: runtime.enableCSSParsing
13109
- ? tslib.__assign({ cx: '', cy: '', rx: '', ry: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
13110
- // anchor: [0.5, 0.5],
13111
- transformOrigin: runtime.enableCSSParsing
13112
- ? null
13113
- : [PECENTAGE_50, PECENTAGE_50],
13114
- } }, rest)) || this;
13019
+ function Ellipse(options) {
13020
+ if (options === void 0) { options = {}; }
13021
+ var _this = _super.call(this, options) || this;
13022
+ _this.nodeName = exports.Shape.ELLIPSE;
13023
+ return _this;
13115
13024
  }
13116
13025
  return Ellipse;
13117
13026
  }(DisplayObject));
@@ -13132,7 +13041,7 @@ var Group = /** @class */ (function (_super) {
13132
13041
  if (_a === void 0) { _a = {}; }
13133
13042
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13134
13043
  return _super.call(this, tslib.__assign({ type: exports.Shape.GROUP, style: runtime.enableCSSParsing
13135
- ? tslib.__assign({ x: '', y: '', width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
13044
+ ? tslib.__assign({ width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
13136
13045
  }
13137
13046
  return Group;
13138
13047
  }(DisplayObject));
@@ -13862,6 +13771,109 @@ var CustomElementRegistry = /** @class */ (function () {
13862
13771
  return CustomElementRegistry;
13863
13772
  }());
13864
13773
 
13774
+ /**
13775
+ * holds useful CSS-related methods.
13776
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
13777
+ *
13778
+ * * CSS Typed OM @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/factory_functions
13779
+ * * register property @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
13780
+ * * CSS Layout API
13781
+ */
13782
+ var CSS = {
13783
+ /**
13784
+ * <number>
13785
+ * @see https://drafts.csswg.org/css-values-4/#number-value
13786
+ */
13787
+ number: function (n) {
13788
+ return new CSSUnitValue(n);
13789
+ },
13790
+ /**
13791
+ * <percentage>
13792
+ * @see https://drafts.csswg.org/css-values-4/#percentage-value
13793
+ */
13794
+ percent: function (n) {
13795
+ return new CSSUnitValue(n, '%');
13796
+ },
13797
+ /**
13798
+ * <length>
13799
+ */
13800
+ px: function (n) {
13801
+ return new CSSUnitValue(n, 'px');
13802
+ },
13803
+ /**
13804
+ * <length>
13805
+ */
13806
+ em: function (n) {
13807
+ return new CSSUnitValue(n, 'em');
13808
+ },
13809
+ rem: function (n) {
13810
+ return new CSSUnitValue(n, 'rem');
13811
+ },
13812
+ /**
13813
+ * <angle>
13814
+ */
13815
+ deg: function (n) {
13816
+ return new CSSUnitValue(n, 'deg');
13817
+ },
13818
+ /**
13819
+ * <angle>
13820
+ */
13821
+ grad: function (n) {
13822
+ return new CSSUnitValue(n, 'grad');
13823
+ },
13824
+ /**
13825
+ * <angle>
13826
+ */
13827
+ rad: function (n) {
13828
+ return new CSSUnitValue(n, 'rad');
13829
+ },
13830
+ /**
13831
+ * <angle>
13832
+ */
13833
+ turn: function (n) {
13834
+ return new CSSUnitValue(n, 'turn');
13835
+ },
13836
+ /**
13837
+ * <time>
13838
+ */
13839
+ s: function (n) {
13840
+ return new CSSUnitValue(n, 's');
13841
+ },
13842
+ /**
13843
+ * <time>
13844
+ */
13845
+ ms: function (n) {
13846
+ return new CSSUnitValue(n, 'ms');
13847
+ },
13848
+ /**
13849
+ * CSS Properties & Values API
13850
+ *
13851
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Properties_and_Values_API
13852
+ * @see https://drafts.css-houdini.org/css-properties-values-api/#registering-custom-properties
13853
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty
13854
+ */
13855
+ registerProperty: function (definition) {
13856
+ var name = definition.name, inherits = definition.inherits, interpolable = definition.interpolable, initialValue = definition.initialValue, syntax = definition.syntax;
13857
+ runtime.styleValueRegistry.registerMetadata({
13858
+ n: name,
13859
+ inh: inherits,
13860
+ int: interpolable,
13861
+ d: initialValue,
13862
+ syntax: syntax,
13863
+ });
13864
+ },
13865
+ /**
13866
+ * CSS Layout API
13867
+ * register layout
13868
+ *
13869
+ * @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
13870
+ * @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
13871
+ */
13872
+ registerLayout: function (name, clazz) {
13873
+ runtime.layoutRegistry.registerLayout(name, clazz);
13874
+ },
13875
+ };
13876
+
13865
13877
  /**
13866
13878
  * the entry of DOM tree
13867
13879
  * Document -> Node -> EventTarget
@@ -15365,6 +15377,7 @@ exports.FederatedPointerEvent = FederatedPointerEvent;
15365
15377
  exports.FederatedWheelEvent = FederatedWheelEvent;
15366
15378
  exports.Frustum = Frustum;
15367
15379
  exports.Group = Group;
15380
+ exports.GroupUpdater = GroupUpdater;
15368
15381
  exports.HTML = HTML;
15369
15382
  exports.Image = Image;
15370
15383
  exports.Line = Line;