@antv/g-lite 1.2.21 → 1.3.0-next.1

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
@@ -3569,7 +3569,7 @@ var parseGradient$1 = (function () {
3569
3569
  return getAST();
3570
3570
  };
3571
3571
  })();
3572
- function computeLinearGradient(width, height, angle) {
3572
+ function computeLinearGradient(min, width, height, angle) {
3573
3573
  var rad = deg2rad(angle.value);
3574
3574
  var rx = 0;
3575
3575
  var ry = 0;
@@ -3578,13 +3578,13 @@ function computeLinearGradient(width, height, angle) {
3578
3578
  // get the length of gradient line
3579
3579
  // @see https://observablehq.com/@danburzo/css-gradient-line
3580
3580
  var length = Math.abs(width * Math.cos(rad)) + Math.abs(height * Math.sin(rad));
3581
- var x1 = rcx - (Math.cos(rad) * length) / 2;
3582
- var y1 = rcy - (Math.sin(rad) * length) / 2;
3583
- var x2 = rcx + (Math.cos(rad) * length) / 2;
3584
- var y2 = rcy + (Math.sin(rad) * length) / 2;
3581
+ var x1 = min[0] + rcx - (Math.cos(rad) * length) / 2;
3582
+ var y1 = min[1] + rcy - (Math.sin(rad) * length) / 2;
3583
+ var x2 = min[0] + rcx + (Math.cos(rad) * length) / 2;
3584
+ var y2 = min[1] + rcy + (Math.sin(rad) * length) / 2;
3585
3585
  return { x1: x1, y1: y1, x2: x2, y2: y2 };
3586
3586
  }
3587
- function computeRadialGradient(width, height, cx, cy, size) {
3587
+ function computeRadialGradient(min, width, height, cx, cy, size) {
3588
3588
  // 'px'
3589
3589
  var x = cx.value;
3590
3590
  var y = cy.value;
@@ -3615,7 +3615,7 @@ function computeRadialGradient(width, height, cx, cy, size) {
3615
3615
  }
3616
3616
  }
3617
3617
  }
3618
- return { x: x, y: y, r: r };
3618
+ return { x: x + min[0], y: y + min[1], r: r };
3619
3619
  }
3620
3620
 
3621
3621
  var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
@@ -4812,11 +4812,10 @@ function getArcParams(startPoint, params) {
4812
4812
  };
4813
4813
  }
4814
4814
  function commandsToPathString(commands, object, transform) {
4815
- var _a = object.parsedStyle, _b = _a.defX, defX = _b === void 0 ? 0 : _b, _c = _a.defY, defY = _c === void 0 ? 0 : _c;
4816
4815
  return commands.reduce(function (prev, cur) {
4817
4816
  var path = '';
4818
4817
  if (cur[0] === 'M' || cur[0] === 'L') {
4819
- var p = glMatrix.vec3.fromValues(cur[1] - defX, cur[2] - defY, 0);
4818
+ var p = glMatrix.vec3.fromValues(cur[1], cur[2], 0);
4820
4819
  if (transform) {
4821
4820
  glMatrix.vec3.transformMat4(p, p, transform);
4822
4821
  }
@@ -4826,9 +4825,9 @@ function commandsToPathString(commands, object, transform) {
4826
4825
  path = cur[0];
4827
4826
  }
4828
4827
  else if (cur[0] === 'C') {
4829
- var p1 = glMatrix.vec3.fromValues(cur[1] - defX, cur[2] - defY, 0);
4830
- var p2 = glMatrix.vec3.fromValues(cur[3] - defX, cur[4] - defY, 0);
4831
- var p3 = glMatrix.vec3.fromValues(cur[5] - defX, cur[6] - defY, 0);
4828
+ var p1 = glMatrix.vec3.fromValues(cur[1], cur[2], 0);
4829
+ var p2 = glMatrix.vec3.fromValues(cur[3], cur[4], 0);
4830
+ var p3 = glMatrix.vec3.fromValues(cur[5], cur[6], 0);
4832
4831
  if (transform) {
4833
4832
  glMatrix.vec3.transformMat4(p1, p1, transform);
4834
4833
  glMatrix.vec3.transformMat4(p2, p2, transform);
@@ -4837,15 +4836,15 @@ function commandsToPathString(commands, object, transform) {
4837
4836
  path = "".concat(cur[0]).concat(p1[0], ",").concat(p1[1], ",").concat(p2[0], ",").concat(p2[1], ",").concat(p3[0], ",").concat(p3[1]);
4838
4837
  }
4839
4838
  else if (cur[0] === 'A') {
4840
- var c = glMatrix.vec3.fromValues(cur[6] - defX, cur[7] - defY, 0);
4839
+ var c = glMatrix.vec3.fromValues(cur[6], cur[7], 0);
4841
4840
  if (transform) {
4842
4841
  glMatrix.vec3.transformMat4(c, c, transform);
4843
4842
  }
4844
4843
  path = "".concat(cur[0]).concat(cur[1], ",").concat(cur[2], ",").concat(cur[3], ",").concat(cur[4], ",").concat(cur[5], ",").concat(c[0], ",").concat(c[1]);
4845
4844
  }
4846
4845
  else if (cur[0] === 'Q') {
4847
- var p1 = glMatrix.vec3.fromValues(cur[1] - defX, cur[2] - defY, 0);
4848
- var p2 = glMatrix.vec3.fromValues(cur[3] - defX, cur[4] - defY, 0);
4846
+ var p1 = glMatrix.vec3.fromValues(cur[1], cur[2], 0);
4847
+ var p2 = glMatrix.vec3.fromValues(cur[3], cur[4], 0);
4849
4848
  if (transform) {
4850
4849
  glMatrix.vec3.transformMat4(p1, p1, transform);
4851
4850
  glMatrix.vec3.transformMat4(p2, p2, transform);
@@ -4923,7 +4922,6 @@ function rectToCommands(width, height, x, y, radius) {
4923
4922
  /**
4924
4923
  * convert object to path, should account for:
4925
4924
  * * transform & origin
4926
- * * anchor
4927
4925
  * * lineWidth
4928
4926
  */
4929
4927
  function convertToPath(object, transform) {
@@ -4966,7 +4964,7 @@ function convertToPath(object, transform) {
4966
4964
  return commandsToPathString(commands, object, transform);
4967
4965
  }
4968
4966
  }
4969
- function translatePathToString(absolutePath, defX, defY, startOffsetX, startOffsetY, endOffsetX, endOffsetY) {
4967
+ function translatePathToString(absolutePath, startOffsetX, startOffsetY, endOffsetX, endOffsetY) {
4970
4968
  if (startOffsetX === void 0) { startOffsetX = 0; }
4971
4969
  if (startOffsetY === void 0) { startOffsetY = 0; }
4972
4970
  if (endOffsetX === void 0) { endOffsetX = 0; }
@@ -4985,27 +4983,27 @@ function translatePathToString(absolutePath, defX, defY, startOffsetX, startOffs
4985
4983
  case 'M':
4986
4984
  // Use start marker offset
4987
4985
  if (useStartOffset) {
4988
- return "M ".concat(params[1] - defX + startOffsetX, ",").concat(params[2] - defY + startOffsetY, " L ").concat(params[1] - defX, ",").concat(params[2] - defY);
4986
+ return "M ".concat(params[1] + startOffsetX, ",").concat(params[2] + startOffsetY, " L ").concat(params[1], ",").concat(params[2]);
4989
4987
  }
4990
4988
  else {
4991
- return "M ".concat(params[1] - defX, ",").concat(params[2] - defY);
4989
+ return "M ".concat(params[1], ",").concat(params[2]);
4992
4990
  }
4993
4991
  case 'L':
4994
- return "L ".concat(params[1] - defX + (useEndOffset ? endOffsetX : 0), ",").concat(params[2] - defY + (useEndOffset ? endOffsetY : 0));
4992
+ return "L ".concat(params[1] + (useEndOffset ? endOffsetX : 0), ",").concat(params[2] + (useEndOffset ? endOffsetY : 0));
4995
4993
  case 'Q':
4996
- return ("Q ".concat(params[1] - defX, " ").concat(params[2] - defY, ",").concat(params[3] - defX, " ").concat(params[4] - defY) +
4994
+ return ("Q ".concat(params[1], " ").concat(params[2], ",").concat(params[3], " ").concat(params[4]) +
4997
4995
  (useEndOffset
4998
- ? " L ".concat(params[3] - defX + endOffsetX, ",").concat(params[4] - defY + endOffsetY)
4996
+ ? " L ".concat(params[3] + endOffsetX, ",").concat(params[4] + endOffsetY)
4999
4997
  : ''));
5000
4998
  case 'C':
5001
- return ("C ".concat(params[1] - defX, " ").concat(params[2] - defY, ",").concat(params[3] - defX, " ").concat(params[4] - defY, ",").concat(params[5] - defX, " ").concat(params[6] - defY) +
4999
+ return ("C ".concat(params[1], " ").concat(params[2], ",").concat(params[3], " ").concat(params[4], ",").concat(params[5], " ").concat(params[6]) +
5002
5000
  (useEndOffset
5003
- ? " L ".concat(params[5] - defX + endOffsetX, ",").concat(params[6] - defY + endOffsetY)
5001
+ ? " L ".concat(params[5] + endOffsetX, ",").concat(params[6] + endOffsetY)
5004
5002
  : ''));
5005
5003
  case 'A':
5006
- return ("A ".concat(params[1], " ").concat(params[2], " ").concat(params[3], " ").concat(params[4], " ").concat(params[5], " ").concat(params[6] - defX, " ").concat(params[7] - defY) +
5004
+ return ("A ".concat(params[1], " ").concat(params[2], " ").concat(params[3], " ").concat(params[4], " ").concat(params[5], " ").concat(params[6], " ").concat(params[7]) +
5007
5005
  (useEndOffset
5008
- ? " L ".concat(params[6] - defX + endOffsetX, ",").concat(params[7] - defY + endOffsetY)
5006
+ ? " L ".concat(params[6] + endOffsetX, ",").concat(params[7] + endOffsetY)
5009
5007
  : ''));
5010
5008
  case 'Z':
5011
5009
  return 'Z';
@@ -5135,12 +5133,8 @@ function parsePoints(pointsOrStr, object) {
5135
5133
  segments.push(segmentT);
5136
5134
  }
5137
5135
  });
5138
- var minX = Math.min.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[0]; })), false));
5139
- var minY = Math.min.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[1]; })), false));
5140
- if (object) {
5141
- object.parsedStyle.defX = minX;
5142
- object.parsedStyle.defY = minY;
5143
- }
5136
+ // const minX = Math.min(...points.map((point) => point[0]));
5137
+ // const minY = Math.min(...points.map((point) => point[1]));
5144
5138
  return {
5145
5139
  points: points,
5146
5140
  totalLength: totalLength,
@@ -6266,34 +6260,24 @@ var BUILT_IN_PROPERTIES = [
6266
6260
  l: true,
6267
6261
  syntax: exports.PropertySyntax.TRANSFORM_ORIGIN,
6268
6262
  },
6269
- {
6270
- n: 'anchor',
6271
- p: 99,
6272
- d: function (nodeName) {
6273
- if (nodeName === exports.Shape.CIRCLE || nodeName === exports.Shape.ELLIPSE) {
6274
- return '0.5 0.5';
6275
- }
6276
- return '0 0';
6277
- },
6278
- l: true,
6279
- syntax: exports.PropertySyntax.LENGTH_PERCENTAGE_12,
6280
- },
6281
- // <circle> & <ellipse>
6282
6263
  {
6283
6264
  n: 'cx',
6284
6265
  int: true,
6266
+ l: true,
6285
6267
  d: '0',
6286
6268
  syntax: exports.PropertySyntax.COORDINATE,
6287
6269
  },
6288
6270
  {
6289
6271
  n: 'cy',
6290
6272
  int: true,
6273
+ l: true,
6291
6274
  d: '0',
6292
6275
  syntax: exports.PropertySyntax.COORDINATE,
6293
6276
  },
6294
6277
  {
6295
6278
  n: 'cz',
6296
6279
  int: true,
6280
+ l: true,
6297
6281
  d: '0',
6298
6282
  syntax: exports.PropertySyntax.COORDINATE,
6299
6283
  },
@@ -6323,6 +6307,7 @@ var BUILT_IN_PROPERTIES = [
6323
6307
  // x in local space
6324
6308
  n: 'x',
6325
6309
  int: true,
6310
+ l: true,
6326
6311
  d: '0',
6327
6312
  syntax: exports.PropertySyntax.COORDINATE,
6328
6313
  },
@@ -6330,6 +6315,7 @@ var BUILT_IN_PROPERTIES = [
6330
6315
  // y in local space
6331
6316
  n: 'y',
6332
6317
  int: true,
6318
+ l: true,
6333
6319
  d: '0',
6334
6320
  syntax: exports.PropertySyntax.COORDINATE,
6335
6321
  },
@@ -6337,6 +6323,7 @@ var BUILT_IN_PROPERTIES = [
6337
6323
  // z in local space
6338
6324
  n: 'z',
6339
6325
  int: true,
6326
+ l: true,
6340
6327
  d: '0',
6341
6328
  syntax: exports.PropertySyntax.COORDINATE,
6342
6329
  },
@@ -6677,7 +6664,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6677
6664
  // @ts-ignore
6678
6665
  if (attributes.points) {
6679
6666
  // @ts-ignore
6680
- object.parsedStyle.points = parsePoints(attributes.points, object);
6667
+ object.parsedStyle.points = parsePoints(attributes.points);
6681
6668
  }
6682
6669
  // Path
6683
6670
  // @ts-ignore
@@ -6689,8 +6676,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6689
6676
  object.parsedStyle.path = parsePath(
6690
6677
  // @ts-ignore
6691
6678
  attributes.path);
6692
- object.parsedStyle.defX = object.parsedStyle.path.rect.x;
6693
- object.parsedStyle.defY = object.parsedStyle.path.rect.y;
6694
6679
  }
6695
6680
  // Text
6696
6681
  if (attributes.textTransform) {
@@ -6702,11 +6687,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6702
6687
  if (attributes.offsetPath) {
6703
6688
  this.runtime.CSSPropertySyntaxFactory['<defined-path>'].calculator('offsetPath', oldOffsetPath, attributes.offsetPath, object, this.runtime);
6704
6689
  }
6705
- if (attributes.anchor) {
6706
- object.parsedStyle.anchor = parseDimensionArrayFormat(
6707
- // @ts-ignorex
6708
- attributes.anchor, 2);
6709
- }
6710
6690
  if (attributes.transform) {
6711
6691
  object.parsedStyle.transform = parseTransform(attributes.transform);
6712
6692
  }
@@ -6738,53 +6718,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6738
6718
  // @ts-ignore
6739
6719
  attributes.markerMid, null, null);
6740
6720
  }
6741
- if (
6742
- // Circle & Ellipse
6743
- ((object.nodeName === exports.Shape.CIRCLE ||
6744
- object.nodeName === exports.Shape.ELLIPSE) &&
6745
- // @ts-ignore
6746
- (!util.isNil(attributes.cx) ||
6747
- // @ts-ignore
6748
- !util.isNil(attributes.cy))) ||
6749
- ((object.nodeName === exports.Shape.RECT ||
6750
- object.nodeName === exports.Shape.IMAGE ||
6751
- object.nodeName === exports.Shape.GROUP ||
6752
- object.nodeName === exports.Shape.HTML ||
6753
- object.nodeName === exports.Shape.TEXT ||
6754
- object.nodeName === exports.Shape.MESH) &&
6755
- // @ts-ignore
6756
- (!util.isNil(attributes.x) ||
6757
- // @ts-ignore
6758
- !util.isNil(attributes.y) ||
6759
- // @ts-ignore
6760
- !util.isNil(attributes.z))) ||
6761
- // Line
6762
- (object.nodeName === exports.Shape.LINE &&
6763
- // @ts-ignore
6764
- (!util.isNil(attributes.x1) ||
6765
- // @ts-ignore
6766
- !util.isNil(attributes.y1) ||
6767
- // @ts-ignore
6768
- !util.isNil(attributes.z1) ||
6769
- // @ts-ignore
6770
- !util.isNil(attributes.x2) ||
6771
- // @ts-ignore
6772
- !util.isNil(attributes.y2) ||
6773
- // @ts-ignore
6774
- !util.isNil(attributes.z2)))) {
6775
- this.runtime.CSSPropertySyntaxFactory['<coordinate>'].postProcessor(object, attributeNames_1);
6776
- }
6777
6721
  if (!util.isNil(attributes.zIndex)) {
6778
6722
  this.runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object, attributeNames_1);
6779
6723
  }
6780
- // @ts-ignore
6781
- if (attributes.path) {
6782
- this.runtime.CSSPropertySyntaxFactory['<path>'].postProcessor(object, attributeNames_1);
6783
- }
6784
- // @ts-ignore
6785
- if (attributes.points) {
6786
- this.runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object, attributeNames_1);
6787
- }
6788
6724
  if (!util.isNil(attributes.offsetDistance)) {
6789
6725
  this.runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object, attributeNames_1);
6790
6726
  }
@@ -6819,7 +6755,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6819
6755
  // points 50
6820
6756
  // text 50
6821
6757
  // textTransform 51
6822
- // anchor 99
6823
6758
  // transform 100
6824
6759
  // transformOrigin 100
6825
6760
  if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
@@ -6831,7 +6766,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6831
6766
  // 'points',
6832
6767
  // 'text',
6833
6768
  // 'textTransform',
6834
- // 'anchor',
6835
6769
  // 'transform',
6836
6770
  // 'transformOrigin',
6837
6771
  // ].forEach((name) => {
@@ -7052,12 +6986,12 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7052
6986
  geometry_1.renderBounds = new AABB();
7053
6987
  }
7054
6988
  var parsedStyle = object.parsedStyle;
7055
- var _a = geometryUpdater.update(parsedStyle, object), width = _a.width, height = _a.height, _b = _a.depth, depth = _b === void 0 ? 0 : _b, _c = _a.offsetX, offsetX = _c === void 0 ? 0 : _c, _d = _a.offsetY, offsetY = _d === void 0 ? 0 : _d, _e = _a.offsetZ, offsetZ = _e === void 0 ? 0 : _e;
6989
+ 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;
7056
6990
  // init with content box
7057
6991
  var halfExtents = [
7058
- Math.abs(width) / 2,
7059
- Math.abs(height) / 2,
7060
- depth / 2,
6992
+ Math.abs(hwidth),
6993
+ Math.abs(hheight),
6994
+ hdepth,
7061
6995
  ];
7062
6996
  // const halfExtents = vec3.set(
7063
6997
  // tmpVec3a,
@@ -7066,30 +7000,12 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7066
7000
  // depth / 2,
7067
7001
  // );
7068
7002
  // anchor is center by default, don't account for lineWidth here
7069
- var _f = parsedStyle, stroke = _f.stroke, lineWidth = _f.lineWidth,
7003
+ var _h = parsedStyle, stroke = _h.stroke, lineWidth = _h.lineWidth,
7070
7004
  // lineCap,
7071
7005
  // lineJoin,
7072
7006
  // miterLimit,
7073
- increasedLineWidthForHitTesting = _f.increasedLineWidthForHitTesting, shadowType = _f.shadowType, shadowColor = _f.shadowColor, _g = _f.filter, filter = _g === void 0 ? [] : _g, transformOrigin = _f.transformOrigin;
7074
- var anchor = parsedStyle.anchor;
7075
- // <Text> use textAlign & textBaseline instead of anchor
7076
- if (nodeName === exports.Shape.TEXT) {
7077
- delete parsedStyle.anchor;
7078
- }
7079
- else if (nodeName === exports.Shape.MESH) {
7080
- parsedStyle.anchor[2] = 0.5;
7081
- }
7082
- var center = [
7083
- ((1 - ((anchor && anchor[0]) || 0) * 2) * width) / 2 + offsetX,
7084
- ((1 - ((anchor && anchor[1]) || 0) * 2) * height) / 2 + offsetY,
7085
- (1 - ((anchor && anchor[2]) || 0) * 2) * halfExtents[2] + offsetZ,
7086
- ];
7087
- // const center = vec3.set(
7088
- // tmpVec3b,
7089
- // ((1 - ((anchor && anchor[0]) || 0) * 2) * width) / 2 + offsetX,
7090
- // ((1 - ((anchor && anchor[1]) || 0) * 2) * height) / 2 + offsetY,
7091
- // (1 - ((anchor && anchor[2]) || 0) * 2) * halfExtents[2] + offsetZ,
7092
- // );
7007
+ increasedLineWidthForHitTesting = _h.increasedLineWidthForHitTesting, shadowType = _h.shadowType, shadowColor = _h.shadowColor, _j = _h.filter, filter = _j === void 0 ? [] : _j, transformOrigin = _h.transformOrigin;
7008
+ var center = [cx, cy, cz];
7093
7009
  // update geometry's AABB
7094
7010
  geometry_1.contentBounds.update(center, halfExtents);
7095
7011
  // @see https://github.molgen.mpg.de/git-mirror/cairo/blob/master/src/cairo-stroke-style.c#L97..L128
@@ -7122,8 +7038,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7122
7038
  geometry_1.renderBounds.update(center, halfExtents);
7123
7039
  // account for shadow, only support constant value now
7124
7040
  if (shadowColor && shadowType && shadowType !== 'inner') {
7125
- var _h = geometry_1.renderBounds, min = _h.min, max = _h.max;
7126
- var _j = parsedStyle, shadowBlur = _j.shadowBlur, shadowOffsetX = _j.shadowOffsetX, shadowOffsetY = _j.shadowOffsetY;
7041
+ var _k = geometry_1.renderBounds, min = _k.min, max = _k.max;
7042
+ var _l = parsedStyle, shadowBlur = _l.shadowBlur, shadowOffsetX = _l.shadowOffsetX, shadowOffsetY = _l.shadowOffsetY;
7127
7043
  var shadowBlurInPixels = shadowBlur || 0;
7128
7044
  var shadowOffsetXInPixels = shadowOffsetX || 0;
7129
7045
  var shadowOffsetYInPixels = shadowOffsetY || 0;
@@ -7160,12 +7076,11 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7160
7076
  geometry_1.renderBounds.setMinMax(min, max);
7161
7077
  }
7162
7078
  });
7163
- anchor = parsedStyle.anchor;
7164
7079
  // if (nodeName === Shape.RECT) {
7165
7080
  // account for negative width / height of Rect
7166
7081
  // @see https://github.com/antvis/g/issues/957
7167
- var flipY = width < 0;
7168
- var flipX = height < 0;
7082
+ var flipY = hwidth < 0;
7083
+ var flipX = hheight < 0;
7169
7084
  // } else {
7170
7085
  // }
7171
7086
  // set transform origin
@@ -7177,19 +7092,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7177
7092
  (transformOrigin
7178
7093
  ? convertPercentUnit(transformOrigin[1], 1, object)
7179
7094
  : 0);
7180
- usedOriginXValue =
7181
- usedOriginXValue -
7182
- (flipY ? -1 : 1) *
7183
- ((anchor && anchor[0]) || 0) *
7184
- geometry_1.contentBounds.halfExtents[0] *
7185
- 2;
7186
- usedOriginYValue =
7187
- usedOriginYValue -
7188
- (flipX ? -1 : 1) *
7189
- ((anchor && anchor[1]) || 0) *
7190
- geometry_1.contentBounds.halfExtents[1] *
7191
- 2;
7192
- object.setOrigin(usedOriginXValue, usedOriginYValue);
7095
+ object.setOrigin(cx - hwidth + usedOriginXValue, cy - hheight + usedOriginYValue);
7193
7096
  // FIXME setOrigin may have already dirtified to root.
7194
7097
  this.runtime.sceneGraphService.dirtifyToRoot(object);
7195
7098
  }
@@ -7411,177 +7314,6 @@ var CSSPropertyLengthOrPercentage14 = /** @class */ (function () {
7411
7314
  return CSSPropertyLengthOrPercentage14;
7412
7315
  }());
7413
7316
 
7414
- var tmpMat4 = glMatrix.mat4.create();
7415
- function parsedTransformToMat4(transform, object) {
7416
- var defX = object.parsedStyle.defX || 0;
7417
- var defY = object.parsedStyle.defY || 0;
7418
- // reset transform
7419
- object.resetLocalTransform();
7420
- object.setLocalPosition(defX, defY);
7421
- transform.forEach(function (parsed) {
7422
- var t = parsed.t, d = parsed.d;
7423
- if (t === 'scale') {
7424
- // scale(1) scale(1, 1)
7425
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1];
7426
- object.scaleLocal(newScale[0], newScale[1], 1);
7427
- }
7428
- else if (t === 'scalex') {
7429
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7430
- object.scaleLocal(newScale[0], 1, 1);
7431
- }
7432
- else if (t === 'scaley') {
7433
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7434
- object.scaleLocal(1, newScale[0], 1);
7435
- }
7436
- else if (t === 'scalez') {
7437
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7438
- object.scaleLocal(1, 1, newScale[0]);
7439
- }
7440
- else if (t === 'scale3d') {
7441
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1, 1];
7442
- object.scaleLocal(newScale[0], newScale[1], newScale[2]);
7443
- }
7444
- else if (t === 'translate') {
7445
- var newTranslation = d || [Opx, Opx];
7446
- object.translateLocal(newTranslation[0].value, newTranslation[1].value, 0);
7447
- }
7448
- else if (t === 'translatex') {
7449
- var newTranslation = d || [Opx];
7450
- object.translateLocal(newTranslation[0].value, 0, 0);
7451
- }
7452
- else if (t === 'translatey') {
7453
- var newTranslation = d || [Opx];
7454
- object.translateLocal(0, newTranslation[0].value, 0);
7455
- }
7456
- else if (t === 'translatez') {
7457
- var newTranslation = d || [Opx];
7458
- object.translateLocal(0, 0, newTranslation[0].value);
7459
- }
7460
- else if (t === 'translate3d') {
7461
- var newTranslation = d || [Opx, Opx, Opx];
7462
- object.translateLocal(newTranslation[0].value, newTranslation[1].value, newTranslation[2].value);
7463
- }
7464
- else if (t === 'rotate') {
7465
- var newAngles = d || [Odeg];
7466
- object.rotateLocal(0, 0, convertAngleUnit(newAngles[0]));
7467
- }
7468
- else if (t === 'rotatex') {
7469
- var newAngles = d || [Odeg];
7470
- object.rotateLocal(convertAngleUnit(newAngles[0]), 0, 0);
7471
- }
7472
- else if (t === 'rotatey') {
7473
- var newAngles = d || [Odeg];
7474
- object.rotateLocal(0, convertAngleUnit(newAngles[0]), 0);
7475
- }
7476
- else if (t === 'rotatez') {
7477
- var newAngles = d || [Odeg];
7478
- object.rotateLocal(0, 0, convertAngleUnit(newAngles[0]));
7479
- }
7480
- else if (t === 'rotate3d') ;
7481
- else if (t === 'skew') {
7482
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0, 0];
7483
- object.setLocalSkew(deg2rad(newSkew[0]), deg2rad(newSkew[1]));
7484
- }
7485
- else if (t === 'skewx') {
7486
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7487
- object.setLocalSkew(deg2rad(newSkew[0]), object.getLocalSkew()[1]);
7488
- }
7489
- else if (t === 'skewy') {
7490
- var newSkew = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [0];
7491
- object.setLocalSkew(object.getLocalSkew()[0], deg2rad(newSkew[0]));
7492
- }
7493
- else if (t === 'matrix') {
7494
- 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];
7495
- object.setLocalTransform(glMatrix.mat4.set(tmpMat4, a, b, 0, 0, c, dd, 0, 0, 0, 0, 1, 0, tx + defX, ty + defY, 0, 1));
7496
- }
7497
- else if (t === 'matrix3d') {
7498
- // @ts-ignore
7499
- glMatrix.mat4.set.apply(glMatrix.mat4, tslib.__spreadArray([tmpMat4], tslib.__read(d.map(function (s) { return s.value; })), false));
7500
- tmpMat4[12] += defX;
7501
- tmpMat4[13] += defY;
7502
- object.setLocalTransform(tmpMat4);
7503
- }
7504
- });
7505
- return object.getLocalTransform();
7506
- }
7507
-
7508
- /**
7509
- * local position
7510
- */
7511
- var CSSPropertyLocalPosition = /** @class */ (function (_super) {
7512
- tslib.__extends(CSSPropertyLocalPosition, _super);
7513
- function CSSPropertyLocalPosition() {
7514
- return _super !== null && _super.apply(this, arguments) || this;
7515
- }
7516
- /**
7517
- * update local position
7518
- */
7519
- CSSPropertyLocalPosition.prototype.postProcessor = function (object, attributes) {
7520
- var x;
7521
- var y;
7522
- var z;
7523
- switch (object.nodeName) {
7524
- case exports.Shape.CIRCLE:
7525
- case exports.Shape.ELLIPSE:
7526
- var _a = object.parsedStyle, cx = _a.cx, cy = _a.cy, cz = _a.cz;
7527
- if (!util.isNil(cx)) {
7528
- x = cx;
7529
- }
7530
- if (!util.isNil(cy)) {
7531
- y = cy;
7532
- }
7533
- if (!util.isNil(cz)) {
7534
- z = cz;
7535
- }
7536
- break;
7537
- case exports.Shape.LINE:
7538
- var _b = object.parsedStyle, x1 = _b.x1, x2 = _b.x2, y1 = _b.y1, y2 = _b.y2;
7539
- var minX = Math.min(x1, x2);
7540
- var minY = Math.min(y1, y2);
7541
- x = minX;
7542
- y = minY;
7543
- z = 0;
7544
- break;
7545
- case exports.Shape.RECT:
7546
- case exports.Shape.IMAGE:
7547
- case exports.Shape.GROUP:
7548
- case exports.Shape.HTML:
7549
- case exports.Shape.TEXT:
7550
- case exports.Shape.MESH:
7551
- if (!util.isNil(object.parsedStyle.x)) {
7552
- x = object.parsedStyle.x;
7553
- }
7554
- if (!util.isNil(object.parsedStyle.y)) {
7555
- y = object.parsedStyle.y;
7556
- }
7557
- if (!util.isNil(object.parsedStyle.z)) {
7558
- z = object.parsedStyle.z;
7559
- }
7560
- break;
7561
- }
7562
- if (object.nodeName !== exports.Shape.PATH &&
7563
- object.nodeName !== exports.Shape.POLYLINE &&
7564
- object.nodeName !== exports.Shape.POLYGON) {
7565
- object.parsedStyle.defX = x || 0;
7566
- object.parsedStyle.defY = y || 0;
7567
- }
7568
- var needResetLocalPosition = !util.isNil(x) || !util.isNil(y) || !util.isNil(z);
7569
- // only if `transform` won't be processed later
7570
- if (needResetLocalPosition && attributes.indexOf('transform') === -1) {
7571
- // account for current transform if needed
7572
- var transform = object.parsedStyle.transform;
7573
- if (transform && transform.length) {
7574
- parsedTransformToMat4(transform, object);
7575
- }
7576
- else {
7577
- var _c = tslib.__read(object.getLocalPosition(), 3), ox = _c[0], oy = _c[1], oz = _c[2];
7578
- object.setLocalPosition(util.isNil(x) ? ox : x, util.isNil(y) ? oy : y, util.isNil(z) ? oz : z);
7579
- }
7580
- }
7581
- };
7582
- return CSSPropertyLocalPosition;
7583
- }(CSSPropertyLengthOrPercentage));
7584
-
7585
7317
  var CSSPropertyMarker = /** @class */ (function () {
7586
7318
  function CSSPropertyMarker() {
7587
7319
  }
@@ -7635,8 +7367,6 @@ var CSSPropertyOffsetDistance = /** @class */ (function () {
7635
7367
  // set position in world space
7636
7368
  var point = offsetPath.getPoint(offsetDistance);
7637
7369
  if (point) {
7638
- object.parsedStyle.defX = point.x;
7639
- object.parsedStyle.defY = point.y;
7640
7370
  object.setLocalPosition(point.x, point.y);
7641
7371
  }
7642
7372
  }
@@ -7685,18 +7415,6 @@ var CSSPropertyPath = /** @class */ (function () {
7685
7415
  }
7686
7416
  return parsed;
7687
7417
  };
7688
- /**
7689
- * update local position
7690
- */
7691
- CSSPropertyPath.prototype.postProcessor = function (object, attributes) {
7692
- object.parsedStyle.defX = object.parsedStyle.path.rect.x;
7693
- object.parsedStyle.defY = object.parsedStyle.path.rect.y;
7694
- if (object.nodeName === exports.Shape.PATH &&
7695
- attributes.indexOf('transform') === -1) {
7696
- var _a = object.parsedStyle, _b = _a.defX, defX = _b === void 0 ? 0 : _b, _c = _a.defY, defY = _c === void 0 ? 0 : _c;
7697
- object.setLocalPosition(defX, defY);
7698
- }
7699
- };
7700
7418
  return CSSPropertyPath;
7701
7419
  }());
7702
7420
 
@@ -7705,17 +7423,6 @@ var CSSPropertyPoints = /** @class */ (function () {
7705
7423
  this.parser = parsePoints;
7706
7424
  this.mixer = mergePoints;
7707
7425
  }
7708
- /**
7709
- * update local position
7710
- */
7711
- CSSPropertyPoints.prototype.postProcessor = function (object, attributes) {
7712
- if ((object.nodeName === exports.Shape.POLYGON ||
7713
- object.nodeName === exports.Shape.POLYLINE) &&
7714
- attributes.indexOf('transform') === -1) {
7715
- var _a = object.parsedStyle, defX = _a.defX, defY = _a.defY;
7716
- object.setLocalPosition(defX, defY);
7717
- }
7718
- };
7719
7426
  return CSSPropertyPoints;
7720
7427
  }());
7721
7428
 
@@ -8124,6 +7831,95 @@ function toFontString(attributes) {
8124
7831
  return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
8125
7832
  }
8126
7833
 
7834
+ var tmpMat4 = glMatrix.mat4.create();
7835
+ 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
+ });
7920
+ return object.getLocalTransform();
7921
+ }
7922
+
8127
7923
  /**
8128
7924
  * @see /zh/docs/api/animation#支持变换的属性
8129
7925
  *
@@ -8228,12 +8024,12 @@ var CircleUpdater = /** @class */ (function () {
8228
8024
  function CircleUpdater() {
8229
8025
  }
8230
8026
  CircleUpdater.prototype.update = function (parsedStyle, object) {
8231
- var r = parsedStyle.r;
8232
- var width = r * 2;
8233
- var height = r * 2;
8027
+ 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;
8234
8028
  return {
8235
- width: width,
8236
- height: height,
8029
+ cx: cx,
8030
+ cy: cy,
8031
+ hwidth: r,
8032
+ hheight: r,
8237
8033
  };
8238
8034
  };
8239
8035
  return CircleUpdater;
@@ -8243,12 +8039,12 @@ var EllipseUpdater = /** @class */ (function () {
8243
8039
  function EllipseUpdater() {
8244
8040
  }
8245
8041
  EllipseUpdater.prototype.update = function (parsedStyle, object) {
8246
- var rx = parsedStyle.rx, ry = parsedStyle.ry;
8247
- var width = rx * 2;
8248
- var height = ry * 2;
8042
+ 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;
8249
8043
  return {
8250
- width: width,
8251
- height: height,
8044
+ cx: cx,
8045
+ cy: cy,
8046
+ hwidth: rx,
8047
+ hheight: ry,
8252
8048
  };
8253
8049
  };
8254
8050
  return EllipseUpdater;
@@ -8265,9 +8061,13 @@ var LineUpdater = /** @class */ (function () {
8265
8061
  var maxY = Math.max(y1, y2);
8266
8062
  var width = maxX - minX;
8267
8063
  var height = maxY - minY;
8064
+ var hwidth = width / 2;
8065
+ var hheight = height / 2;
8268
8066
  return {
8269
- width: width,
8270
- height: height,
8067
+ cx: minX + hwidth,
8068
+ cy: minY + hheight,
8069
+ hwidth: hwidth,
8070
+ hheight: hheight,
8271
8071
  };
8272
8072
  };
8273
8073
  return LineUpdater;
@@ -8278,10 +8078,14 @@ var PathUpdater = /** @class */ (function () {
8278
8078
  }
8279
8079
  PathUpdater.prototype.update = function (parsedStyle) {
8280
8080
  var path = parsedStyle.path;
8281
- var _a = path.rect, width = _a.width, height = _a.height;
8081
+ var _a = path.rect, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
8082
+ var hwidth = width / 2;
8083
+ var hheight = height / 2;
8282
8084
  return {
8283
- width: width,
8284
- height: height,
8085
+ cx: x + hwidth,
8086
+ cy: y + hheight,
8087
+ hwidth: hwidth,
8088
+ hheight: hheight,
8285
8089
  };
8286
8090
  };
8287
8091
  return PathUpdater;
@@ -8300,14 +8104,20 @@ var PolylineUpdater = /** @class */ (function () {
8300
8104
  var maxY = Math.max.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[1]; })), false));
8301
8105
  var width = maxX - minX;
8302
8106
  var height = maxY - minY;
8107
+ var hwidth = width / 2;
8108
+ var hheight = height / 2;
8303
8109
  return {
8304
- width: width,
8305
- height: height,
8110
+ cx: minX + hwidth,
8111
+ cy: minY + hheight,
8112
+ hwidth: hwidth,
8113
+ hheight: hheight,
8306
8114
  };
8307
8115
  }
8308
8116
  return {
8309
- width: 0,
8310
- height: 0,
8117
+ cx: 0,
8118
+ cy: 0,
8119
+ hwidth: 0,
8120
+ hheight: 0,
8311
8121
  };
8312
8122
  };
8313
8123
  return PolylineUpdater;
@@ -8317,7 +8127,7 @@ var RectUpdater = /** @class */ (function () {
8317
8127
  function RectUpdater() {
8318
8128
  }
8319
8129
  RectUpdater.prototype.update = function (parsedStyle, object) {
8320
- var img = parsedStyle.img, _a = parsedStyle.width, width = _a === void 0 ? 0 : _a, _b = parsedStyle.height, height = _b === void 0 ? 0 : _b;
8130
+ 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;
8321
8131
  var contentWidth = width;
8322
8132
  var contentHeight = height;
8323
8133
  // resize with HTMLImageElement's size
@@ -8332,8 +8142,10 @@ var RectUpdater = /** @class */ (function () {
8332
8142
  }
8333
8143
  }
8334
8144
  return {
8335
- width: contentWidth,
8336
- height: contentHeight,
8145
+ cx: x + contentWidth / 2,
8146
+ cy: y + contentHeight / 2,
8147
+ hwidth: contentWidth / 2,
8148
+ hheight: contentHeight / 2,
8337
8149
  };
8338
8150
  };
8339
8151
  return RectUpdater;
@@ -8356,7 +8168,7 @@ var TextUpdater = /** @class */ (function () {
8356
8168
  };
8357
8169
  TextUpdater.prototype.update = function (parsedStyle, object) {
8358
8170
  var _a, _b;
8359
- var text = parsedStyle.text, textAlign = parsedStyle.textAlign, lineWidth = parsedStyle.lineWidth, textBaseline = parsedStyle.textBaseline, dx = parsedStyle.dx, dy = parsedStyle.dy;
8171
+ 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;
8360
8172
  if (!this.isReadyToMeasure(parsedStyle, object)) {
8361
8173
  parsedStyle.metrics = {
8362
8174
  font: '',
@@ -8374,47 +8186,42 @@ var TextUpdater = /** @class */ (function () {
8374
8186
  lineMetrics: [],
8375
8187
  };
8376
8188
  return {
8377
- width: 0,
8378
- height: 0,
8379
- x: 0,
8380
- y: 0,
8381
- offsetX: 0,
8382
- offsetY: 0,
8189
+ hwidth: 0,
8190
+ hheight: 0,
8191
+ cx: 0,
8192
+ cy: 0,
8383
8193
  };
8384
8194
  }
8385
8195
  var offscreenCanvas = (((_b = (_a = object === null || object === void 0 ? void 0 : object.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) === null || _b === void 0 ? void 0 : _b.getConfig()) || {}).offscreenCanvas;
8386
8196
  var metrics = this.globalRuntime.textService.measureText(text, parsedStyle, offscreenCanvas);
8387
8197
  parsedStyle.metrics = metrics;
8388
8198
  var width = metrics.width, height = metrics.height, lineHeight = metrics.lineHeight, fontProperties = metrics.fontProperties;
8389
- // anchor is left-top by default
8390
- var halfExtents = [width / 2, height / 2, 0];
8199
+ var hwidth = width / 2;
8200
+ var hheight = height / 2;
8391
8201
  // default 'left'
8392
- var anchor = [0, 1];
8393
- var lineXOffset = 0;
8202
+ var lineXOffset = x + hwidth;
8394
8203
  if (textAlign === 'center' || textAlign === 'middle') {
8395
- lineXOffset = lineWidth / 2;
8396
- anchor = [0.5, 1];
8204
+ lineXOffset += lineWidth / 2 - hwidth;
8397
8205
  }
8398
8206
  else if (textAlign === 'right' || textAlign === 'end') {
8399
- lineXOffset = lineWidth;
8400
- anchor = [1, 1];
8207
+ lineXOffset += lineWidth - hwidth * 2;
8401
8208
  }
8402
- var lineYOffset = 0;
8209
+ var lineYOffset = y - hheight;
8403
8210
  if (textBaseline === 'middle') {
8404
8211
  // eslint-disable-next-line prefer-destructuring
8405
- lineYOffset = halfExtents[1];
8212
+ lineYOffset += hheight;
8406
8213
  }
8407
8214
  else if (textBaseline === 'top' || textBaseline === 'hanging') {
8408
- lineYOffset = halfExtents[1] * 2;
8215
+ lineYOffset += hheight * 2;
8409
8216
  }
8410
8217
  else if (textBaseline === 'alphabetic') {
8411
8218
  // prevent calling getImageData for ascent metrics
8412
- lineYOffset = this.globalRuntime.enableCSSParsing
8219
+ lineYOffset += this.globalRuntime.enableCSSParsing
8413
8220
  ? lineHeight - fontProperties.ascent
8414
8221
  : 0;
8415
8222
  }
8416
8223
  else if (textBaseline === 'bottom' || textBaseline === 'ideographic') {
8417
- lineYOffset = 0;
8224
+ lineYOffset += 0;
8418
8225
  }
8419
8226
  // TODO: ideographic & bottom
8420
8227
  if (dx) {
@@ -8423,13 +8230,11 @@ var TextUpdater = /** @class */ (function () {
8423
8230
  if (dy) {
8424
8231
  lineYOffset += dy;
8425
8232
  }
8426
- // update anchor
8427
- parsedStyle.anchor = [anchor[0], anchor[1], 0];
8428
8233
  return {
8429
- width: halfExtents[0] * 2,
8430
- height: halfExtents[1] * 2,
8431
- offsetX: lineXOffset,
8432
- offsetY: lineYOffset,
8234
+ cx: lineXOffset,
8235
+ cy: lineYOffset,
8236
+ hwidth: hwidth,
8237
+ hheight: hheight,
8433
8238
  };
8434
8239
  };
8435
8240
  return TextUpdater;
@@ -11704,7 +11509,7 @@ var CSSPropertySyntaxFactory = (function () {
11704
11509
  _a[exports.PropertySyntax.LENGTH_PERCENTAGE] = length,
11705
11510
  _a[exports.PropertySyntax.LENGTH_PERCENTAGE_12] = new CSSPropertyLengthOrPercentage12(),
11706
11511
  _a[exports.PropertySyntax.LENGTH_PERCENTAGE_14] = new CSSPropertyLengthOrPercentage14(),
11707
- _a[exports.PropertySyntax.COORDINATE] = new CSSPropertyLocalPosition(),
11512
+ _a[exports.PropertySyntax.COORDINATE] = new CSSPropertyLengthOrPercentage(),
11708
11513
  _a[exports.PropertySyntax.OFFSET_DISTANCE] = new CSSPropertyOffsetDistance(),
11709
11514
  _a[exports.PropertySyntax.OPACITY_VALUE] = new CSSPropertyOpacity(),
11710
11515
  _a[exports.PropertySyntax.PATH] = new CSSPropertyPath(),
@@ -11843,7 +11648,6 @@ var Element = /** @class */ (function (_super) {
11843
11648
  _this.style = {};
11844
11649
  _this.computedStyle = runtime.enableCSSParsing
11845
11650
  ? {
11846
- anchor: unsetKeywordValue,
11847
11651
  opacity: unsetKeywordValue,
11848
11652
  fillOpacity: unsetKeywordValue,
11849
11653
  strokeOpacity: unsetKeywordValue,
@@ -12000,8 +11804,11 @@ var Element = /** @class */ (function (_super) {
12000
11804
  if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
12001
11805
  this.ownerDocument.defaultView.mountChildren(child);
12002
11806
  }
12003
- insertedEvent.relatedNode = this;
12004
- child.dispatchEvent(insertedEvent);
11807
+ // @ts-ignore
11808
+ if (child.isMutationObserved) {
11809
+ insertedEvent.relatedNode = this;
11810
+ child.dispatchEvent(insertedEvent);
11811
+ }
12005
11812
  return child;
12006
11813
  };
12007
11814
  Element.prototype.insertBefore = function (newChild, refChild) {
@@ -12306,7 +12113,7 @@ var Element = /** @class */ (function (_super) {
12306
12113
  /**
12307
12114
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
12308
12115
  */
12309
- Element.prototype.setAttribute = function (attributeName, value, force) {
12116
+ Element.prototype.setAttribute = function (attributeName, value, force, memoize) {
12310
12117
  this.attributes[attributeName] = value;
12311
12118
  };
12312
12119
  Element.prototype.getAttributeNS = function (namespace, localName) {
@@ -12347,7 +12154,6 @@ function isDisplayObject(value) {
12347
12154
  }
12348
12155
  var mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
12349
12156
  var DEFAULT_STYLE_PROPS = {
12350
- anchor: '',
12351
12157
  opacity: '',
12352
12158
  fillOpacity: '',
12353
12159
  strokeOpacity: '',
@@ -12374,7 +12180,6 @@ var DEFAULT_STYLE_PROPS = {
12374
12180
  shadowType: '',
12375
12181
  };
12376
12182
  var DEFAULT_PARSED_STYLE_PROPS = {
12377
- anchor: [0, 0],
12378
12183
  fill: noneColor,
12379
12184
  stroke: noneColor,
12380
12185
  transform: [],
@@ -12428,7 +12233,6 @@ var DATASET_PREFIX = 'data-';
12428
12233
  var DisplayObject = /** @class */ (function (_super) {
12429
12234
  tslib.__extends(DisplayObject, _super);
12430
12235
  function DisplayObject(config) {
12431
- var _a;
12432
12236
  var _this = _super.call(this) || this;
12433
12237
  _this.isCustomElement = false;
12434
12238
  _this.isMutationObserved = false;
@@ -12447,7 +12251,7 @@ var DisplayObject = /** @class */ (function (_super) {
12447
12251
  // eg. group.get('name')
12448
12252
  _this.config = config;
12449
12253
  // compatible with G 3.0
12450
- _this.config.interactive = (_a = _this.config.capture) !== null && _a !== void 0 ? _a : _this.config.interactive;
12254
+ // this.config.interactive = this.config.capture ?? this.config.interactive;
12451
12255
  // init scene graph node
12452
12256
  _this.id = _this.config.id || '';
12453
12257
  _this.name = _this.config.name || '';
@@ -12455,23 +12259,23 @@ var DisplayObject = /** @class */ (function (_super) {
12455
12259
  _this.className = _this.config.className || _this.config.class;
12456
12260
  }
12457
12261
  _this.nodeName = _this.config.type || exports.Shape.GROUP;
12458
- // compatible with G 3.0
12459
- _this.config.style =
12460
- _this.config.style || _this.config.attrs || {};
12461
- Object.assign(_this.config.style, _this.config.attrs);
12462
- // this.config.style = {
12463
- // // ...DEFAULT_STYLE_PROPS,
12464
- // ...this.config.style,
12465
- // ...this.config.attrs,
12466
- // };
12467
- if (_this.config.visible != null) {
12468
- _this.config.style.visibility =
12469
- _this.config.visible === false ? 'hidden' : 'visible';
12470
- }
12471
- if (_this.config.interactive != null) {
12472
- _this.config.style.pointerEvents =
12473
- _this.config.interactive === false ? 'none' : 'auto';
12474
- }
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
+ // }
12475
12279
  // merge parsed value
12476
12280
  Object.assign(_this.parsedStyle, runtime.enableCSSParsing
12477
12281
  ? DEFAULT_PARSED_STYLE_PROPS
@@ -13223,12 +13027,15 @@ var CSS = {
13223
13027
 
13224
13028
  var Circle = /** @class */ (function (_super) {
13225
13029
  tslib.__extends(Circle, _super);
13030
+ // constructor(options: DisplayObjectConfig<CircleStyleProps> = {}) {
13031
+ // super(options);
13032
+ // this.nodeName = Shape.CIRCLE;
13033
+ // }
13226
13034
  function Circle(_a) {
13227
13035
  if (_a === void 0) { _a = {}; }
13228
13036
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13229
13037
  return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE, style: runtime.enableCSSParsing
13230
13038
  ? tslib.__assign({ cx: '', cy: '', r: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
13231
- anchor: [0.5, 0.5],
13232
13039
  transformOrigin: runtime.enableCSSParsing
13233
13040
  ? null
13234
13041
  : [PECENTAGE_50, PECENTAGE_50],
@@ -13249,7 +13056,7 @@ var CustomElement = /** @class */ (function (_super) {
13249
13056
  var _this = this;
13250
13057
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13251
13058
  _this = _super.call(this, tslib.__assign({ style: runtime.enableCSSParsing
13252
- ? tslib.__assign({ x: '', y: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
13059
+ ? tslib.__assign({}, style) : tslib.__assign({}, style) }, rest)) || this;
13253
13060
  // static get observedAttributes(): string[] {
13254
13061
  // return [];
13255
13062
  // }
@@ -13266,7 +13073,6 @@ var Ellipse = /** @class */ (function (_super) {
13266
13073
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13267
13074
  return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE, style: runtime.enableCSSParsing
13268
13075
  ? tslib.__assign({ cx: '', cy: '', rx: '', ry: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
13269
- anchor: [0.5, 0.5],
13270
13076
  transformOrigin: runtime.enableCSSParsing
13271
13077
  ? null
13272
13078
  : [PECENTAGE_50, PECENTAGE_50],
@@ -13291,7 +13097,7 @@ var Group = /** @class */ (function (_super) {
13291
13097
  if (_a === void 0) { _a = {}; }
13292
13098
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13293
13099
  return _super.call(this, tslib.__assign({ type: exports.Shape.GROUP, style: runtime.enableCSSParsing
13294
- ? tslib.__assign({ x: '', y: '', width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
13100
+ ? tslib.__assign({ width: '', height: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
13295
13101
  }
13296
13102
  return Group;
13297
13103
  }(DisplayObject));
@@ -13436,7 +13242,7 @@ var Line = /** @class */ (function (_super) {
13436
13242
  }
13437
13243
  };
13438
13244
  Line.prototype.transformMarker = function (isStart) {
13439
- var _a = this.parsedStyle, markerStart = _a.markerStart, markerEnd = _a.markerEnd, markerStartOffset = _a.markerStartOffset, markerEndOffset = _a.markerEndOffset, x1 = _a.x1, x2 = _a.x2, y1 = _a.y1, y2 = _a.y2, defX = _a.defX, defY = _a.defY;
13245
+ var _a = this.parsedStyle, markerStart = _a.markerStart, markerEnd = _a.markerEnd, markerStartOffset = _a.markerStartOffset, markerEndOffset = _a.markerEndOffset, x1 = _a.x1, x2 = _a.x2, y1 = _a.y1, y2 = _a.y2;
13440
13246
  var marker = isStart ? markerStart : markerEnd;
13441
13247
  if (!marker || !isDisplayObject(marker)) {
13442
13248
  return;
@@ -13449,16 +13255,16 @@ var Line = /** @class */ (function (_super) {
13449
13255
  var offset;
13450
13256
  var originalAngle;
13451
13257
  if (isStart) {
13452
- ox = x1 - defX;
13453
- oy = y1 - defY;
13258
+ ox = x1;
13259
+ oy = y1;
13454
13260
  x = x2 - x1;
13455
13261
  y = y2 - y1;
13456
13262
  offset = markerStartOffset || 0;
13457
13263
  originalAngle = this.markerStartAngle;
13458
13264
  }
13459
13265
  else {
13460
- ox = x2 - defX;
13461
- oy = y2 - defY;
13266
+ ox = x2;
13267
+ oy = y2;
13462
13268
  x = x1 - x2;
13463
13269
  y = y1 - y2;
13464
13270
  offset = markerEndOffset || 0;
@@ -13472,9 +13278,9 @@ var Line = /** @class */ (function (_super) {
13472
13278
  Line.prototype.getPoint = function (ratio, inWorldSpace) {
13473
13279
  if (inWorldSpace === void 0) { inWorldSpace = false; }
13474
13280
  // TODO: account for z1/z2 in 3D line
13475
- var _a = this.parsedStyle, x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2, defX = _a.defX, defY = _a.defY;
13281
+ var _a = this.parsedStyle, x1 = _a.x1, y1 = _a.y1, x2 = _a.x2, y2 = _a.y2;
13476
13282
  var _b = gMath.linePointAt(x1, y1, x2, y2, ratio), x = _b.x, y = _b.y;
13477
- var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
13283
+ var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
13478
13284
  // apply local transformation
13479
13285
  return new Point(transformed[0], transformed[1]);
13480
13286
  };
@@ -13565,7 +13371,7 @@ var Path = /** @class */ (function (_super) {
13565
13371
  }
13566
13372
  };
13567
13373
  Path.prototype.transformMarker = function (isStart) {
13568
- var _a = this.parsedStyle, markerStart = _a.markerStart, markerEnd = _a.markerEnd, markerStartOffset = _a.markerStartOffset, markerEndOffset = _a.markerEndOffset, defX = _a.defX, defY = _a.defY;
13374
+ var _a = this.parsedStyle, markerStart = _a.markerStart, markerEnd = _a.markerEnd, markerStartOffset = _a.markerStartOffset, markerEndOffset = _a.markerEndOffset;
13569
13375
  var marker = isStart ? markerStart : markerEnd;
13570
13376
  if (!marker || !isDisplayObject(marker)) {
13571
13377
  return;
@@ -13579,8 +13385,8 @@ var Path = /** @class */ (function (_super) {
13579
13385
  var originalAngle;
13580
13386
  if (isStart) {
13581
13387
  var _b = tslib.__read(this.getStartTangent(), 2), p1 = _b[0], p2 = _b[1];
13582
- ox = p2[0] - defX;
13583
- oy = p2[1] - defY;
13388
+ ox = p2[0];
13389
+ oy = p2[1];
13584
13390
  x = p1[0] - p2[0];
13585
13391
  y = p1[1] - p2[1];
13586
13392
  offset = markerStartOffset || 0;
@@ -13588,8 +13394,8 @@ var Path = /** @class */ (function (_super) {
13588
13394
  }
13589
13395
  else {
13590
13396
  var _c = tslib.__read(this.getEndTangent(), 2), p1 = _c[0], p2 = _c[1];
13591
- ox = p2[0] - defX;
13592
- oy = p2[1] - defY;
13397
+ ox = p2[0];
13398
+ oy = p2[1];
13593
13399
  x = p1[0] - p2[0];
13594
13400
  y = p1[1] - p2[1];
13595
13401
  offset = markerEndOffset || 0;
@@ -13601,18 +13407,18 @@ var Path = /** @class */ (function (_super) {
13601
13407
  marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
13602
13408
  };
13603
13409
  Path.prototype.placeMarkerMid = function (marker) {
13604
- var _a = this.parsedStyle, segments = _a.path.segments, defX = _a.defX, defY = _a.defY;
13410
+ var segments = this.parsedStyle.path.segments;
13605
13411
  // clear all existed markers
13606
13412
  this.markerMidList.forEach(function (marker) {
13607
13413
  marker.remove();
13608
13414
  });
13609
13415
  if (marker && isDisplayObject(marker)) {
13610
13416
  for (var i = 1; i < segments.length - 1; i++) {
13611
- var _b = tslib.__read(segments[i].currentPoint, 2), ox = _b[0], oy = _b[1];
13417
+ var _a = tslib.__read(segments[i].currentPoint, 2), ox = _a[0], oy = _a[1];
13612
13418
  var cloned = i === 1 ? marker : marker.cloneNode(true);
13613
13419
  this.markerMidList.push(cloned);
13614
13420
  this.appendChild(cloned);
13615
- cloned.setLocalPosition(ox - defX, oy - defY);
13421
+ cloned.setLocalPosition(ox, oy);
13616
13422
  // TODO: orient of marker
13617
13423
  }
13618
13424
  }
@@ -13630,9 +13436,9 @@ var Path = /** @class */ (function (_super) {
13630
13436
  */
13631
13437
  Path.prototype.getPointAtLength = function (distance, inWorldSpace) {
13632
13438
  if (inWorldSpace === void 0) { inWorldSpace = false; }
13633
- var _a = this.parsedStyle, defX = _a.defX, defY = _a.defY, absolutePath = _a.path.absolutePath;
13634
- var _b = util.getPointAtLength(absolutePath, distance), x = _b.x, y = _b.y;
13635
- var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
13439
+ var absolutePath = this.parsedStyle.path.absolutePath;
13440
+ var _a = util.getPointAtLength(absolutePath, distance), x = _a.x, y = _a.y;
13441
+ var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
13636
13442
  // apply local transformation
13637
13443
  return new Point(transformed[0], transformed[1]);
13638
13444
  };
@@ -13771,7 +13577,7 @@ var Polygon = /** @class */ (function (_super) {
13771
13577
  }
13772
13578
  };
13773
13579
  Polygon.prototype.transformMarker = function (isStart) {
13774
- var _a = this.parsedStyle, markerStart = _a.markerStart, markerEnd = _a.markerEnd, markerStartOffset = _a.markerStartOffset, markerEndOffset = _a.markerEndOffset, P = _a.points, defX = _a.defX, defY = _a.defY;
13580
+ var _a = this.parsedStyle, markerStart = _a.markerStart, markerEnd = _a.markerEnd, markerStartOffset = _a.markerStartOffset, markerEndOffset = _a.markerEndOffset, P = _a.points;
13775
13581
  var points = (P || {}).points;
13776
13582
  var marker = isStart ? markerStart : markerEnd;
13777
13583
  if (!marker || !isDisplayObject(marker) || !points) {
@@ -13784,8 +13590,8 @@ var Polygon = /** @class */ (function (_super) {
13784
13590
  var oy;
13785
13591
  var offset;
13786
13592
  var originalAngle;
13787
- ox = points[0][0] - defX;
13788
- oy = points[0][1] - defY;
13593
+ ox = points[0][0];
13594
+ oy = points[0][1];
13789
13595
  if (isStart) {
13790
13596
  x = points[1][0] - points[0][0];
13791
13597
  y = points[1][1] - points[0][1];
@@ -13795,8 +13601,8 @@ var Polygon = /** @class */ (function (_super) {
13795
13601
  else {
13796
13602
  var length_1 = points.length;
13797
13603
  if (!this.parsedStyle.isClosed) {
13798
- ox = points[length_1 - 1][0] - defX;
13799
- oy = points[length_1 - 1][1] - defY;
13604
+ ox = points[length_1 - 1][0];
13605
+ oy = points[length_1 - 1][1];
13800
13606
  x = points[length_1 - 2][0] - points[length_1 - 1][0];
13801
13607
  y = points[length_1 - 2][1] - points[length_1 - 1][1];
13802
13608
  }
@@ -13813,7 +13619,7 @@ var Polygon = /** @class */ (function (_super) {
13813
13619
  marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
13814
13620
  };
13815
13621
  Polygon.prototype.placeMarkerMid = function (marker) {
13816
- var _a = this.parsedStyle, P = _a.points, defX = _a.defX, defY = _a.defY;
13622
+ var P = this.parsedStyle.points;
13817
13623
  var points = (P || {}).points;
13818
13624
  // clear all existed markers
13819
13625
  this.markerMidList.forEach(function (marker) {
@@ -13822,8 +13628,8 @@ var Polygon = /** @class */ (function (_super) {
13822
13628
  this.markerMidList = [];
13823
13629
  if (marker && isDisplayObject(marker) && points) {
13824
13630
  for (var i = 1; i < (this.parsedStyle.isClosed ? points.length : points.length - 1); i++) {
13825
- var ox = points[i][0] - defX;
13826
- var oy = points[i][1] - defY;
13631
+ var ox = points[i][0];
13632
+ var oy = points[i][1];
13827
13633
  var cloned = i === 1 ? marker : marker.cloneNode(true);
13828
13634
  this.markerMidList.push(cloned);
13829
13635
  this.appendChild(cloned);
@@ -13865,7 +13671,7 @@ var Polyline = /** @class */ (function (_super) {
13865
13671
  };
13866
13672
  Polyline.prototype.getPoint = function (ratio, inWorldSpace) {
13867
13673
  if (inWorldSpace === void 0) { inWorldSpace = false; }
13868
- var _a = this.parsedStyle, defX = _a.defX, defY = _a.defY, _b = _a.points, points = _b.points, segments = _b.segments;
13674
+ var _a = this.parsedStyle.points, points = _a.points, segments = _a.segments;
13869
13675
  var subt = 0;
13870
13676
  var index = 0;
13871
13677
  segments.forEach(function (v, i) {
@@ -13874,8 +13680,8 @@ var Polyline = /** @class */ (function (_super) {
13874
13680
  index = i;
13875
13681
  }
13876
13682
  });
13877
- var _c = gMath.linePointAt(points[index][0], points[index][1], points[index + 1][0], points[index + 1][1], subt), x = _c.x, y = _c.y;
13878
- var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
13683
+ var _b = gMath.linePointAt(points[index][0], points[index][1], points[index + 1][0], points[index + 1][1], subt), x = _b.x, y = _b.y;
13684
+ var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
13879
13685
  // apply local transformation
13880
13686
  return new Point(transformed[0], transformed[1]);
13881
13687
  };