@antv/g-lite 1.3.0-next.12 → 1.3.0-next.14

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
@@ -4241,10 +4241,10 @@ function mergeNumberLists(left, right) {
4241
4241
  }
4242
4242
 
4243
4243
  function getOrCalculatePathTotalLength(path) {
4244
- if (path.parsedStyle.path.totalLength === 0) {
4245
- path.parsedStyle.path.totalLength = util.getTotalLength(path.parsedStyle.path.absolutePath);
4244
+ if (path.parsedStyle.d.totalLength === 0) {
4245
+ path.parsedStyle.d.totalLength = util.getTotalLength(path.parsedStyle.d.absolutePath);
4246
4246
  }
4247
- return path.parsedStyle.path.totalLength;
4247
+ return path.parsedStyle.d.totalLength;
4248
4248
  }
4249
4249
  function removeRedundantMCommand(path) {
4250
4250
  for (var i = 0; i < path.length; i++) {
@@ -4954,7 +4954,7 @@ function convertToPath(object, transform) {
4954
4954
  }));
4955
4955
  break;
4956
4956
  case exports.Shape.PATH:
4957
- var absolutePath = object.parsedStyle.path.absolutePath;
4957
+ var absolutePath = object.parsedStyle.d.absolutePath;
4958
4958
  commands = tslib.__spreadArray([], tslib.__read(absolutePath), false);
4959
4959
  break;
4960
4960
  }
@@ -6394,11 +6394,10 @@ var BUILT_IN_PROPERTIES = [
6394
6394
  },
6395
6395
  // Path
6396
6396
  {
6397
- n: 'path',
6397
+ n: 'd',
6398
6398
  int: true,
6399
6399
  l: true,
6400
6400
  d: '',
6401
- a: ['d'],
6402
6401
  syntax: exports.PropertySyntax.PATH,
6403
6402
  p: 50,
6404
6403
  },
@@ -6565,7 +6564,7 @@ var BUILT_IN_PROPERTIES = [
6565
6564
  d: '0',
6566
6565
  },
6567
6566
  ];
6568
- BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
6567
+ var GEOMETRY_ATTRIBUTE_NAMES = BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
6569
6568
  var propertyMetadataCache = {};
6570
6569
  var unresolvedProperties = new WeakMap();
6571
6570
  // const uniqueAttributeSet = new Set<string>();
@@ -6628,14 +6627,14 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6628
6627
  var oldOffsetPath = object.parsedStyle.offsetPath;
6629
6628
  object.parsedStyle = Object.assign(object.parsedStyle, attributes);
6630
6629
  var needUpdateGeometry = !!options.forceUpdateGeometry;
6631
- // if (!needUpdateGeometry) {
6632
- // for (let i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
6633
- // if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
6634
- // needUpdateGeometry = true;
6635
- // break;
6636
- // }
6637
- // }
6638
- // }
6630
+ if (!needUpdateGeometry) {
6631
+ for (var i = 0; i < GEOMETRY_ATTRIBUTE_NAMES.length; i++) {
6632
+ if (GEOMETRY_ATTRIBUTE_NAMES[i] in attributes) {
6633
+ needUpdateGeometry = true;
6634
+ break;
6635
+ }
6636
+ }
6637
+ }
6639
6638
  if (attributes.fill) {
6640
6639
  object.parsedStyle.fill = parseColor(attributes.fill);
6641
6640
  }
@@ -6667,14 +6666,14 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6667
6666
  }
6668
6667
  // Path
6669
6668
  // @ts-ignore
6670
- if (attributes.path === '') {
6671
- object.parsedStyle.path = tslib.__assign({}, EMPTY_PARSED_PATH);
6669
+ if (attributes.d === '') {
6670
+ object.parsedStyle.d = tslib.__assign({}, EMPTY_PARSED_PATH);
6672
6671
  }
6673
6672
  // @ts-ignore
6674
- if (attributes.path) {
6675
- object.parsedStyle.path = parsePath(
6673
+ if (attributes.d) {
6674
+ object.parsedStyle.d = parsePath(
6676
6675
  // @ts-ignore
6677
- attributes.path);
6676
+ attributes.d);
6678
6677
  }
6679
6678
  // Text
6680
6679
  if (attributes.textTransform) {
@@ -6726,10 +6725,16 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6726
6725
  if (attributes.transform) {
6727
6726
  this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames);
6728
6727
  }
6728
+ if (attributes.transformOrigin) {
6729
+ this.runtime.CSSPropertySyntaxFactory['<transform-origin>'].postProcessor(object, attributeNames);
6730
+ }
6729
6731
  if (needUpdateGeometry) {
6730
6732
  object.geometry.dirty = true;
6731
- // FIXME setOrigin may have already dirtified to root.
6732
- // this.runtime.sceneGraphService.dirtifyToRoot(object);
6733
+ object.renderable.boundsDirty = true;
6734
+ object.renderable.renderBoundsDirty = true;
6735
+ if (!options.forceUpdateGeometry) {
6736
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6737
+ }
6733
6738
  }
6734
6739
  }
6735
6740
  else {
@@ -6789,8 +6794,11 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6789
6794
  // update geometry
6790
6795
  if (needUpdateGeometry_1) {
6791
6796
  object.geometry.dirty = true;
6792
- // FIXME setOrigin may have already dirtified to root.
6793
- this.runtime.sceneGraphService.dirtifyToRoot(object);
6797
+ object.renderable.boundsDirty = true;
6798
+ object.renderable.renderBoundsDirty = true;
6799
+ if (!options.forceUpdateGeometry) {
6800
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6801
+ }
6794
6802
  }
6795
6803
  attributeNames_1.forEach(function (name) {
6796
6804
  if (name in object.parsedStyle) {
@@ -7002,11 +7010,15 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7002
7010
  // depth / 2,
7003
7011
  // );
7004
7012
  // anchor is center by default, don't account for lineWidth here
7005
- var _h = parsedStyle, stroke = _h.stroke, lineWidth = _h.lineWidth,
7013
+ var _h = parsedStyle, stroke = _h.stroke, _j = _h.lineWidth, lineWidth = _j === void 0 ? 1 : _j,
7014
+ // lineCap,
7015
+ // lineJoin,
7016
+ // miterLimit,
7017
+ _k = _h.increasedLineWidthForHitTesting,
7006
7018
  // lineCap,
7007
7019
  // lineJoin,
7008
7020
  // miterLimit,
7009
- increasedLineWidthForHitTesting = _h.increasedLineWidthForHitTesting, shadowType = _h.shadowType, shadowColor = _h.shadowColor, _j = _h.filter, filter = _j === void 0 ? [] : _j, transformOrigin = _h.transformOrigin;
7021
+ increasedLineWidthForHitTesting = _k === void 0 ? 0 : _k, shadowType = _h.shadowType, shadowColor = _h.shadowColor, _l = _h.filter, filter = _l === void 0 ? [] : _l, transformOrigin = _h.transformOrigin;
7010
7022
  var center = [cx, cy, cz];
7011
7023
  // update geometry's AABB
7012
7024
  geometry_1.contentBounds.update(center, halfExtents);
@@ -7040,8 +7052,8 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7040
7052
  geometry_1.renderBounds.update(center, halfExtents);
7041
7053
  // account for shadow, only support constant value now
7042
7054
  if (shadowColor && shadowType && shadowType !== 'inner') {
7043
- var _k = geometry_1.renderBounds, min = _k.min, max = _k.max;
7044
- var _l = parsedStyle, shadowBlur = _l.shadowBlur, shadowOffsetX = _l.shadowOffsetX, shadowOffsetY = _l.shadowOffsetY;
7055
+ var _m = geometry_1.renderBounds, min = _m.min, max = _m.max;
7056
+ var _o = parsedStyle, shadowBlur = _o.shadowBlur, shadowOffsetX = _o.shadowOffsetX, shadowOffsetY = _o.shadowOffsetY;
7045
7057
  var shadowBlurInPixels = shadowBlur || 0;
7046
7058
  var shadowOffsetXInPixels = shadowOffsetX || 0;
7047
7059
  var shadowOffsetYInPixels = shadowOffsetY || 0;
@@ -7811,7 +7823,7 @@ var genericFontFamilies = [
7811
7823
  ];
7812
7824
  var stringRegExp = /([\"\'])[^\'\"]+\1/;
7813
7825
  function toFontString(attributes) {
7814
- var fontSize = attributes.fontSize, fontFamily = attributes.fontFamily, fontStyle = attributes.fontStyle, fontVariant = attributes.fontVariant, fontWeight = attributes.fontWeight;
7826
+ var _a = attributes.fontSize, fontSize = _a === void 0 ? 16 : _a, _b = attributes.fontFamily, fontFamily = _b === void 0 ? 'sans-serif' : _b, _c = attributes.fontStyle, fontStyle = _c === void 0 ? 'normal' : _c, _d = attributes.fontVariant, fontVariant = _d === void 0 ? 'normal' : _d, _e = attributes.fontWeight, fontWeight = _e === void 0 ? 'normal' : _e;
7815
7827
  // build canvas api font setting from individual components. Convert a numeric this.fontSize to px
7816
7828
  // const fontSizeString: string = isNumber(fontSize) ? `${fontSize}px` : fontSize.toString();
7817
7829
  var fontSizeString = (util.isNumber(fontSize) && "".concat(fontSize, "px")) || '16px';
@@ -7839,6 +7851,7 @@ function createSkewMatrix(skewMatrix, skewX, skewY) {
7839
7851
  skewMatrix[1] = Math.tan(skewY); // Skew X axis in Y direction
7840
7852
  return skewMatrix;
7841
7853
  }
7854
+ var SCALE_EPSILON = 0.00001;
7842
7855
  var tmpMat1 = glMatrix.mat4.create();
7843
7856
  var tmpMat2 = glMatrix.mat4.create();
7844
7857
  function parsedTransformToMat4(transform, object) {
@@ -7848,23 +7861,27 @@ function parsedTransformToMat4(transform, object) {
7848
7861
  var t = parsed.t, d = parsed.d;
7849
7862
  if (t === 'scale') {
7850
7863
  // scale(1) scale(1, 1)
7851
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1];
7864
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [
7865
+ 1, 1,
7866
+ ];
7852
7867
  glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], 1]);
7853
7868
  }
7854
7869
  else if (t === 'scalex') {
7855
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7870
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
7856
7871
  glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], 1, 1]);
7857
7872
  }
7858
7873
  else if (t === 'scaley') {
7859
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7874
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
7860
7875
  glMatrix.mat4.fromScaling(tmpMat2, [1, newScale[0], 1]);
7861
7876
  }
7862
7877
  else if (t === 'scalez') {
7863
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1];
7878
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [1];
7864
7879
  glMatrix.mat4.fromScaling(tmpMat2, [1, 1, newScale[0]]);
7865
7880
  }
7866
7881
  else if (t === 'scale3d') {
7867
- var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return s.value; })) || [1, 1, 1];
7882
+ var newScale = (d === null || d === void 0 ? void 0 : d.map(function (s) { return Math.max(s.value, SCALE_EPSILON); })) || [
7883
+ 1, 1, 1,
7884
+ ];
7868
7885
  glMatrix.mat4.fromScaling(tmpMat2, [newScale[0], newScale[1], newScale[2]]);
7869
7886
  }
7870
7887
  else if (t === 'translate') {
@@ -8107,8 +8124,8 @@ var PathUpdater = /** @class */ (function () {
8107
8124
  function PathUpdater() {
8108
8125
  }
8109
8126
  PathUpdater.prototype.update = function (parsedStyle) {
8110
- var path = parsedStyle.path;
8111
- var _a = path.rect, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
8127
+ var d = parsedStyle.d;
8128
+ var _a = d.rect, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
8112
8129
  var hwidth = width / 2;
8113
8130
  var hheight = height / 2;
8114
8131
  return {
@@ -8157,17 +8174,17 @@ var RectUpdater = /** @class */ (function () {
8157
8174
  function RectUpdater() {
8158
8175
  }
8159
8176
  RectUpdater.prototype.update = function (parsedStyle, object) {
8160
- 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;
8177
+ var _a = parsedStyle.x, x = _a === void 0 ? 0 : _a, _b = parsedStyle.y, y = _b === void 0 ? 0 : _b, src = parsedStyle.src, _c = parsedStyle.width, width = _c === void 0 ? 0 : _c, _d = parsedStyle.height, height = _d === void 0 ? 0 : _d;
8161
8178
  var contentWidth = width;
8162
8179
  var contentHeight = height;
8163
8180
  // resize with HTMLImageElement's size
8164
- if (img && !util.isString(img)) {
8181
+ if (src && !util.isString(src)) {
8165
8182
  if (!contentWidth) {
8166
- contentWidth = img.width;
8183
+ contentWidth = src.width;
8167
8184
  parsedStyle.width = contentWidth;
8168
8185
  }
8169
8186
  if (!contentHeight) {
8170
- contentHeight = img.height;
8187
+ contentHeight = src.height;
8171
8188
  parsedStyle.height = contentHeight;
8172
8189
  }
8173
8190
  }
@@ -8187,18 +8204,20 @@ var TextUpdater = /** @class */ (function () {
8187
8204
  }
8188
8205
  TextUpdater.prototype.isReadyToMeasure = function (parsedStyle, object) {
8189
8206
  var text = parsedStyle.text, textAlign = parsedStyle.textAlign, textBaseline = parsedStyle.textBaseline, fontSize = parsedStyle.fontSize, fontStyle = parsedStyle.fontStyle, fontWeight = parsedStyle.fontWeight, fontVariant = parsedStyle.fontVariant, lineWidth = parsedStyle.lineWidth;
8190
- return (text &&
8191
- fontSize &&
8192
- fontStyle &&
8193
- fontWeight &&
8194
- fontVariant &&
8195
- textAlign &&
8196
- textBaseline &&
8197
- !util.isNil(lineWidth));
8207
+ return runtime.enableCSSParsing
8208
+ ? text &&
8209
+ fontSize &&
8210
+ fontStyle &&
8211
+ fontWeight &&
8212
+ fontVariant &&
8213
+ textAlign &&
8214
+ textBaseline &&
8215
+ !util.isNil(lineWidth)
8216
+ : text;
8198
8217
  };
8199
8218
  TextUpdater.prototype.update = function (parsedStyle, object) {
8200
8219
  var _a, _b;
8201
- 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;
8220
+ var text = parsedStyle.text, _c = parsedStyle.textAlign, textAlign = _c === void 0 ? 'start' : _c, _d = parsedStyle.lineWidth, lineWidth = _d === void 0 ? 1 : _d, _e = parsedStyle.textBaseline, textBaseline = _e === void 0 ? 'alphabetic' : _e, _f = parsedStyle.dx, dx = _f === void 0 ? 0 : _f, _g = parsedStyle.dy, dy = _g === void 0 ? 0 : _g, _h = parsedStyle.x, x = _h === void 0 ? 0 : _h, _j = parsedStyle.y, y = _j === void 0 ? 0 : _j;
8202
8221
  if (!this.isReadyToMeasure(parsedStyle, object)) {
8203
8222
  parsedStyle.metrics = {
8204
8223
  font: '',
@@ -11298,13 +11317,13 @@ var TextService = /** @class */ (function () {
11298
11317
  return properties;
11299
11318
  };
11300
11319
  TextService.prototype.measureText = function (text, parsedStyle, offscreenCanvas) {
11301
- var fontSize = parsedStyle.fontSize, wordWrap = parsedStyle.wordWrap, strokeHeight = parsedStyle.lineHeight, lineWidth = parsedStyle.lineWidth, textBaseline = parsedStyle.textBaseline, textAlign = parsedStyle.textAlign, letterSpacing = parsedStyle.letterSpacing, textPath = parsedStyle.textPath; parsedStyle.textPathSide; parsedStyle.textPathStartOffset;
11320
+ var _a = parsedStyle.fontSize, fontSize = _a === void 0 ? 16 : _a, _b = parsedStyle.wordWrap, wordWrap = _b === void 0 ? false : _b, strokeHeight = parsedStyle.lineHeight, _c = parsedStyle.lineWidth, lineWidth = _c === void 0 ? 1 : _c, _d = parsedStyle.textBaseline, textBaseline = _d === void 0 ? 'alphabetic' : _d, _e = parsedStyle.textAlign, textAlign = _e === void 0 ? 'start' : _e, _f = parsedStyle.letterSpacing, letterSpacing = _f === void 0 ? 0 : _f, textPath = parsedStyle.textPath; parsedStyle.textPathSide; parsedStyle.textPathStartOffset;
11302
11321
  var // dropShadow = 0,
11303
11322
  // dropShadowDistance = 0,
11304
- _a = parsedStyle.leading,
11323
+ _g = parsedStyle.leading,
11305
11324
  // dropShadow = 0,
11306
11325
  // dropShadowDistance = 0,
11307
- leading = _a === void 0 ? 0 : _a;
11326
+ leading = _g === void 0 ? 0 : _g;
11308
11327
  var font = toFontString(parsedStyle);
11309
11328
  // if (runtime.enableCSSParsing) {
11310
11329
  var fontProperties = this.measureFont(font, offscreenCanvas);
@@ -11416,7 +11435,7 @@ var TextService = /** @class */ (function () {
11416
11435
  TextService.prototype.setGraphemeOnPath = function () { };
11417
11436
  TextService.prototype.wordWrap = function (text, parsedStyle, offscreenCanvas) {
11418
11437
  var _this = this;
11419
- var _a = parsedStyle.wordWrapWidth, wordWrapWidth = _a === void 0 ? 0 : _a, letterSpacing = parsedStyle.letterSpacing, _b = parsedStyle.maxLines, maxLines = _b === void 0 ? Infinity : _b, textOverflow = parsedStyle.textOverflow;
11438
+ var _a = parsedStyle.wordWrapWidth, wordWrapWidth = _a === void 0 ? 0 : _a, _b = parsedStyle.letterSpacing, letterSpacing = _b === void 0 ? 0 : _b, _c = parsedStyle.maxLines, maxLines = _c === void 0 ? Infinity : _c, textOverflow = parsedStyle.textOverflow;
11420
11439
  var context = this.runtime.offscreenCanvasCreator.getOrCreateContext(offscreenCanvas);
11421
11440
  var maxWidth = wordWrapWidth + letterSpacing;
11422
11441
  var ellipsis = '';
@@ -11649,7 +11668,16 @@ var entityCounter = 0;
11649
11668
  function resetEntityCounter() {
11650
11669
  entityCounter = 0;
11651
11670
  }
11652
- new MutationEvent(exports.ElementEvent.INSERTED, null, '', '', '', 0, '', '');
11671
+ // const insertedEvent = new MutationEvent(
11672
+ // ElementEvent.INSERTED,
11673
+ // null,
11674
+ // '',
11675
+ // '',
11676
+ // '',
11677
+ // 0,
11678
+ // '',
11679
+ // '',
11680
+ // );
11653
11681
  var removedEvent = new MutationEvent(exports.ElementEvent.REMOVED, null, '', '', '', 0, '', '');
11654
11682
  var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
11655
11683
  /**
@@ -12354,6 +12382,11 @@ var DisplayObject = /** @class */ (function (_super) {
12354
12382
  Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
12355
12383
  Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
12356
12384
  }
12385
+ else if (_this.config.initialParsedStyle) {
12386
+ Object.assign(_this.parsedStyle,
12387
+ // DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED,
12388
+ _this.config.initialParsedStyle);
12389
+ }
12357
12390
  // start to process attributes
12358
12391
  _this.initAttributes(_this.config.style);
12359
12392
  if (runtime.enableDataset) {
@@ -12995,9 +13028,7 @@ var Circle = /** @class */ (function (_super) {
12995
13028
  tslib.__extends(Circle, _super);
12996
13029
  function Circle(options) {
12997
13030
  if (options === void 0) { options = {}; }
12998
- var _this = _super.call(this, options) || this;
12999
- _this.nodeName = exports.Shape.CIRCLE;
13000
- return _this;
13031
+ return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE }, options)) || this;
13001
13032
  }
13002
13033
  return Circle;
13003
13034
  }(DisplayObject));
@@ -13028,9 +13059,7 @@ var Ellipse = /** @class */ (function (_super) {
13028
13059
  tslib.__extends(Ellipse, _super);
13029
13060
  function Ellipse(options) {
13030
13061
  if (options === void 0) { options = {}; }
13031
- var _this = _super.call(this, options) || this;
13032
- _this.nodeName = exports.Shape.ELLIPSE;
13033
- return _this;
13062
+ return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE }, options)) || this;
13034
13063
  }
13035
13064
  return Ellipse;
13036
13065
  }(DisplayObject));
@@ -13049,9 +13078,7 @@ var Group = /** @class */ (function (_super) {
13049
13078
  tslib.__extends(Group, _super);
13050
13079
  function Group(options) {
13051
13080
  if (options === void 0) { options = {}; }
13052
- var _this = _super.call(this, options) || this;
13053
- _this.nodeName = exports.Shape.GROUP;
13054
- return _this;
13081
+ return _super.call(this, tslib.__assign({ type: exports.Shape.GROUP }, options)) || this;
13055
13082
  }
13056
13083
  return Group;
13057
13084
  }(DisplayObject));
@@ -13126,9 +13153,7 @@ var Image = /** @class */ (function (_super) {
13126
13153
  tslib.__extends(Image, _super);
13127
13154
  function Image(options) {
13128
13155
  if (options === void 0) { options = {}; }
13129
- var _this = _super.call(this, options) || this;
13130
- _this.nodeName = exports.Shape.IMAGE;
13131
- return _this;
13156
+ return _super.call(this, tslib.__assign({ type: exports.Shape.IMAGE }, options)) || this;
13132
13157
  }
13133
13158
  return Image;
13134
13159
  }(DisplayObject));
@@ -13257,11 +13282,11 @@ var Path = /** @class */ (function (_super) {
13257
13282
  var _this = this;
13258
13283
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13259
13284
  _this = _super.call(this, tslib.__assign({ type: exports.Shape.PATH, style: runtime.enableCSSParsing
13260
- ? tslib.__assign({ path: '', miterLimit: '' }, style) : tslib.__assign({}, style), initialParsedStyle: runtime.enableCSSParsing
13285
+ ? tslib.__assign({ d: '', miterLimit: '' }, style) : tslib.__assign({}, style), initialParsedStyle: runtime.enableCSSParsing
13261
13286
  ? null
13262
13287
  : {
13263
13288
  miterLimit: 4,
13264
- path: tslib.__assign({}, EMPTY_PARSED_PATH),
13289
+ d: tslib.__assign({}, EMPTY_PARSED_PATH),
13265
13290
  } }, rest)) || this;
13266
13291
  _this.markerStartAngle = 0;
13267
13292
  _this.markerEndAngle = 0;
@@ -13286,7 +13311,7 @@ var Path = /** @class */ (function (_super) {
13286
13311
  return _this;
13287
13312
  }
13288
13313
  Path.prototype.attributeChangedCallback = function (attrName, oldValue, newValue, prevParsedValue, newParsedValue) {
13289
- if (attrName === 'path') {
13314
+ if (attrName === 'd') {
13290
13315
  // recalc markers
13291
13316
  this.transformMarker(true);
13292
13317
  this.transformMarker(false);
@@ -13361,7 +13386,7 @@ var Path = /** @class */ (function (_super) {
13361
13386
  marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
13362
13387
  };
13363
13388
  Path.prototype.placeMarkerMid = function (marker) {
13364
- var segments = this.parsedStyle.path.segments;
13389
+ var segments = this.parsedStyle.d.segments;
13365
13390
  // clear all existed markers
13366
13391
  this.markerMidList.forEach(function (marker) {
13367
13392
  marker.remove();
@@ -13390,7 +13415,7 @@ var Path = /** @class */ (function (_super) {
13390
13415
  */
13391
13416
  Path.prototype.getPointAtLength = function (distance, inWorldSpace) {
13392
13417
  if (inWorldSpace === void 0) { inWorldSpace = false; }
13393
- var absolutePath = this.parsedStyle.path.absolutePath;
13418
+ var absolutePath = this.parsedStyle.d.absolutePath;
13394
13419
  var _a = util.getPointAtLength(absolutePath, distance), x = _a.x, y = _a.y;
13395
13420
  var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x, y, 0), inWorldSpace ? this.getWorldTransform() : this.getLocalTransform());
13396
13421
  // apply local transformation
@@ -13407,7 +13432,7 @@ var Path = /** @class */ (function (_super) {
13407
13432
  * Get start tangent vector
13408
13433
  */
13409
13434
  Path.prototype.getStartTangent = function () {
13410
- var segments = this.parsedStyle.path.segments;
13435
+ var segments = this.parsedStyle.d.segments;
13411
13436
  var result = [];
13412
13437
  if (segments.length > 1) {
13413
13438
  var startPoint = segments[0].currentPoint;
@@ -13429,7 +13454,7 @@ var Path = /** @class */ (function (_super) {
13429
13454
  * Get end tangent vector
13430
13455
  */
13431
13456
  Path.prototype.getEndTangent = function () {
13432
- var segments = this.parsedStyle.path.segments;
13457
+ var segments = this.parsedStyle.d.segments;
13433
13458
  var length = segments.length;
13434
13459
  var result = [];
13435
13460
  if (length > 1) {
@@ -13661,9 +13686,7 @@ var Rect = /** @class */ (function (_super) {
13661
13686
  tslib.__extends(Rect, _super);
13662
13687
  function Rect(options) {
13663
13688
  if (options === void 0) { options = {}; }
13664
- var _this = _super.call(this, options) || this;
13665
- _this.nodeName = exports.Shape.RECT;
13666
- return _this;
13689
+ return _super.call(this, tslib.__assign({ type: exports.Shape.RECT }, options)) || this;
13667
13690
  }
13668
13691
  return Rect;
13669
13692
  }(DisplayObject));
@@ -13685,26 +13708,7 @@ var Text = /** @class */ (function (_super) {
13685
13708
  return _super.call(this, tslib.__assign({ type: exports.Shape.TEXT, style: runtime.enableCSSParsing
13686
13709
  ? tslib.__assign({ x: '', y: '', text: '', fontSize: '', fontFamily: '', fontStyle: '', fontWeight: '', fontVariant: '', textAlign: '', textBaseline: '', textTransform: '', fill: 'black', letterSpacing: '', lineHeight: '', miterLimit: '',
13687
13710
  // whiteSpace: 'pre',
13688
- wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : tslib.__assign({ fill: 'black' }, style), initialParsedStyle: runtime.enableCSSParsing
13689
- ? {}
13690
- : {
13691
- x: 0,
13692
- y: 0,
13693
- fontSize: 16,
13694
- fontFamily: 'sans-serif',
13695
- fontStyle: 'normal',
13696
- fontWeight: 'normal',
13697
- fontVariant: 'normal',
13698
- lineHeight: 0,
13699
- letterSpacing: 0,
13700
- textBaseline: 'alphabetic',
13701
- textAlign: 'start',
13702
- wordWrap: false,
13703
- wordWrapWidth: 0,
13704
- leading: 0,
13705
- dx: 0,
13706
- dy: 0,
13707
- } }, rest)) || this;
13711
+ wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : tslib.__assign({ fill: 'black' }, style) }, rest)) || this;
13708
13712
  }
13709
13713
  // lengthAdjust: SVGAnimatedEnumeration;
13710
13714
  // textLength: SVGAnimatedLength;
@@ -14724,7 +14728,7 @@ var PrepareRendererPlugin = /** @class */ (function () {
14724
14728
  * sync to RBush later
14725
14729
  */
14726
14730
  this.toSync = new Set();
14727
- // private isFirstTimeRendering = true;
14731
+ this.isFirstTimeRendering = true;
14728
14732
  this.syncing = false;
14729
14733
  }
14730
14734
  PrepareRendererPlugin.prototype.apply = function (context) {
@@ -14788,14 +14792,22 @@ var PrepareRendererPlugin = /** @class */ (function () {
14788
14792
  _this.toSync.clear();
14789
14793
  });
14790
14794
  renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
14791
- requestIdleCallback(function () {
14795
+ if (_this.isFirstTimeRendering) {
14796
+ _this.isFirstTimeRendering = false;
14797
+ _this.syncing = true;
14798
+ requestIdleCallback(function () {
14799
+ _this.syncRTree(true);
14800
+ });
14801
+ }
14802
+ else {
14792
14803
  _this.syncRTree();
14793
- });
14804
+ }
14794
14805
  });
14795
14806
  };
14796
- PrepareRendererPlugin.prototype.syncRTree = function () {
14807
+ PrepareRendererPlugin.prototype.syncRTree = function (force) {
14797
14808
  var _this = this;
14798
- if (this.syncing || this.toSync.size === 0) {
14809
+ if (force === void 0) { force = false; }
14810
+ if (!force && (this.syncing || this.toSync.size === 0)) {
14799
14811
  return;
14800
14812
  }
14801
14813
  this.syncing = true;