@visactor/vrender 0.21.0-alpha.3 → 0.21.0-alpha.5

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
@@ -3997,7 +3997,8 @@
3997
3997
  globalZIndex: 1,
3998
3998
  globalCompositeOperation: "",
3999
3999
  overflow: "hidden",
4000
- shadowPickMode: "graphic"
4000
+ shadowPickMode: "graphic",
4001
+ keepStrokeScale: !1
4001
4002
  }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
4002
4003
  function addAttributeToPrototype(obj, c, keys) {
4003
4004
  keys.forEach(key => {
@@ -6501,7 +6502,7 @@
6501
6502
  }
6502
6503
  }
6503
6504
 
6504
- class DefaultTicker {
6505
+ class DefaultTicker extends EventEmitter {
6505
6506
  set mode(m) {
6506
6507
  this._mode !== m && (this._mode = m, this.setupTickHandler());
6507
6508
  }
@@ -6510,17 +6511,17 @@
6510
6511
  }
6511
6512
  constructor() {
6512
6513
  let timelines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6513
- this.handleTick = (handler, params) => {
6514
+ super(), this.handleTick = (handler, params) => {
6514
6515
  const {
6515
6516
  once = !1
6516
6517
  } = null != params ? params : {};
6517
- this.ifCanStop() ? this.stop() : (this._handlerTick(handler), once || handler.tick(this.interval, this.handleTick));
6518
- }, this._handlerTick = handler => {
6518
+ this.ifCanStop() ? this.stop() : (this._handlerTick(), once || handler.tick(this.interval, this.handleTick));
6519
+ }, this._handlerTick = () => {
6519
6520
  const time = this.tickerHandler.getTime();
6520
6521
  let delta = 0;
6521
6522
  this.lastFrameTime >= 0 && (delta = time - this.lastFrameTime), this.lastFrameTime = time, this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(t => {
6522
6523
  t.tick(delta);
6523
- }));
6524
+ }), this.emit("afterTick"));
6524
6525
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.timelines = timelines, this.autoStop = !0;
6525
6526
  }
6526
6527
  init() {
@@ -6616,6 +6617,9 @@
6616
6617
  stop() {
6617
6618
  this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
6618
6619
  }
6620
+ trySyncTickStatus() {
6621
+ this.status === STATUS$1.RUNNING && this._handlerTick();
6622
+ }
6619
6623
  }
6620
6624
 
6621
6625
  class ManualTickHandler {
@@ -7757,7 +7761,7 @@
7757
7761
  lastMatchedIndex = i, lastMatchedPoint = tagMap.get(this.toPoints[i].context);
7758
7762
  break;
7759
7763
  }
7760
- "clip" === this.newPointAnimateType && 0 !== this.toPoints.length && (Number.isFinite(lastMatchedIndex) ? (this.clipRange = this.toPoints[lastMatchedIndex][this.clipRangeByDimension] / this.toPoints[this.toPoints.length - 1][this.clipRangeByDimension], isValidNumber$1(this.clipRange) ? this.clipRange = clamp$1(this.clipRange, 0, 1) : this.clipRange = 0) : this.clipRange = 0);
7764
+ "clip" === this.newPointAnimateType && 0 !== this.toPoints.length && (Number.isFinite(lastMatchedIndex) ? (this.clipRange = this.toPoints[lastMatchedIndex][this.clipRangeByDimension] / this.toPoints[this.toPoints.length - 1][this.clipRangeByDimension], 1 === this.clipRange && (this.shrinkClipRange = this.toPoints[lastMatchedIndex][this.clipRangeByDimension] / this.fromPoints[this.fromPoints.length - 1][this.clipRangeByDimension]), isValidNumber$1(this.clipRange) ? this.clipRange = clamp$1(this.clipRange, 0, 1) : this.clipRange = 0) : this.clipRange = 0);
7761
7765
  let prevMatchedPoint = this.toPoints[0];
7762
7766
  this.interpolatePoints = this.toPoints.map((point, index) => {
7763
7767
  const matchedPoint = tagMap.get(point.context);
@@ -7769,11 +7773,19 @@
7769
7773
  return newPoint.defined = toPoint.defined, newPoint.context = toPoint.context, newPoint;
7770
7774
  });
7771
7775
  }
7776
+ onFirstRun() {
7777
+ const lastClipRange = this.target.attribute.clipRange;
7778
+ isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
7779
+ }
7772
7780
  onUpdate(end, ratio, out) {
7773
7781
  if (this.points = this.points.map((point, index) => {
7774
7782
  const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
7775
7783
  return newPoint.context = point.context, newPoint;
7776
- }), this.clipRange && (out.clipRange = this.clipRange + (1 - this.clipRange) * ratio), this.segmentsCache && this.to.segments) {
7784
+ }), this.clipRange) {
7785
+ if (this.shrinkClipRange) return void (end ? (out.points = this.toPoints, out.clipRange = 1) : (out.points = this.fromPoints, out.clipRange = this.clipRange - (this.clipRange - this.shrinkClipRange) * ratio));
7786
+ out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
7787
+ }
7788
+ if (this.segmentsCache && this.to.segments) {
7777
7789
  let start = 0;
7778
7790
  out.segments = this.to.segments.map((segment, index) => {
7779
7791
  const end = start + this.segmentsCache[index],
@@ -12127,7 +12139,8 @@
12127
12139
  x: originX = arcAttribute.x,
12128
12140
  y: originY = arcAttribute.y,
12129
12141
  scaleX = arcAttribute.scaleX,
12130
- scaleY = arcAttribute.scaleY
12142
+ scaleY = arcAttribute.scaleY,
12143
+ keepStrokeScale = arcAttribute.keepStrokeScale
12131
12144
  } = arc.attribute;
12132
12145
  let {
12133
12146
  innerRadius = arcAttribute.innerRadius,
@@ -12139,7 +12152,7 @@
12139
12152
  {
12140
12153
  distance = arcAttribute[key].distance
12141
12154
  } = borderStyle,
12142
- d = getScaledStroke(context, distance, context.dpr),
12155
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12143
12156
  deltaAngle = distance / outerRadius,
12144
12157
  sign = "outerBorder" === key ? 1 : -1;
12145
12158
  if (arc.setAttributes({
@@ -12184,14 +12197,15 @@
12184
12197
  x: originX = circleAttribute.x,
12185
12198
  y: originY = circleAttribute.y,
12186
12199
  scaleX = circleAttribute.scaleX,
12187
- scaleY = circleAttribute.scaleY
12200
+ scaleY = circleAttribute.scaleY,
12201
+ keepStrokeScale = circleAttribute.keepStrokeScale
12188
12202
  } = circle.attribute,
12189
12203
  renderBorder = (borderStyle, key) => {
12190
12204
  const doStroke = !(!borderStyle || !borderStyle.stroke),
12191
12205
  {
12192
12206
  distance = circleAttribute[key].distance
12193
12207
  } = borderStyle,
12194
- d = getScaledStroke(context, distance, context.dpr),
12208
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12195
12209
  sign = "outerBorder" === key ? 1 : -1;
12196
12210
  if (context.beginPath(), context.arc(x, y, radius + sign * d, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), strokeCb) strokeCb(context, borderStyle, circleAttribute[key]);else if (doStroke) {
12197
12211
  const lastOpacity = circleAttribute[key].opacity;
@@ -12310,7 +12324,8 @@
12310
12324
  scaleX = rectAttribute.scaleX,
12311
12325
  scaleY = rectAttribute.scaleY,
12312
12326
  x1: x1,
12313
- y1: y1
12327
+ y1: y1,
12328
+ keepStrokeScale = rectAttribute.keepStrokeScale
12314
12329
  } = rect.attribute;
12315
12330
  let {
12316
12331
  width: width,
@@ -12323,7 +12338,7 @@
12323
12338
  {
12324
12339
  distance = rectAttribute[key].distance
12325
12340
  } = borderStyle,
12326
- d = getScaledStroke(context, distance, context.dpr),
12341
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12327
12342
  nextX = x + sign * d,
12328
12343
  nextY = y + sign * d,
12329
12344
  dw = 2 * d;
@@ -12480,14 +12495,15 @@
12480
12495
  x: originX = symbolAttribute.x,
12481
12496
  y: originY = symbolAttribute.y,
12482
12497
  scaleX = symbolAttribute.scaleX,
12483
- scaleY = symbolAttribute.scaleY
12498
+ scaleY = symbolAttribute.scaleY,
12499
+ keepStrokeScale = symbolAttribute.keepStrokeScale
12484
12500
  } = symbol.attribute,
12485
12501
  renderBorder = (borderStyle, key) => {
12486
12502
  const doStroke = !(!borderStyle || !borderStyle.stroke),
12487
12503
  {
12488
12504
  distance = symbolAttribute[key].distance
12489
12505
  } = borderStyle,
12490
- d = getScaledStroke(context, distance, context.dpr),
12506
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12491
12507
  sign = "outerBorder" === key ? 1 : -1;
12492
12508
  if (context.beginPath(), !1 === parsedPath.drawOffset(context, size, x, y, sign * d) && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), strokeCb) strokeCb(context, borderStyle, symbolAttribute[key]);else if (doStroke) {
12493
12509
  const lastOpacity = symbolAttribute[key].opacity;
@@ -13765,16 +13781,8 @@
13765
13781
  verticalMode = textAttribute.verticalMode,
13766
13782
  x: originX = textAttribute.x,
13767
13783
  y: originY = textAttribute.y
13768
- } = text.attribute;
13769
- let {
13770
- textAlign = textAttribute.textAlign,
13771
- textBaseline = textAttribute.textBaseline
13772
- } = text.attribute;
13773
- if (!verticalMode && "vertical" === direction) {
13774
- const t = textAlign;
13775
- textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
13776
- }
13777
- const lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
13784
+ } = text.attribute,
13785
+ lineHeight = null !== (_a = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _a ? _a : fontSize,
13778
13786
  data = this.valid(text, textAttribute, fillCb, strokeCb);
13779
13787
  if (!data) return;
13780
13788
  const {
@@ -13794,7 +13802,7 @@
13794
13802
  const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
13795
13803
  matrix.rotateByCenter(Math.PI / 2, _x, _y), context.transformFromMatrix(matrix, !0), matrixAllocate.free(matrix);
13796
13804
  }
13797
- doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.strokeText(t, _x, _y, z))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.fillText(t, _x, _y, z), this.drawUnderLine(underline, lineThrough, text, _x, _y, z, textAttribute, context))), direction && (context.highPerformanceRestore(), context.setTransformForCurrent());
13805
+ doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.strokeText(t, _x, _y, z))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), context.fillText(t, _x, _y, z))), direction && (context.highPerformanceRestore(), context.setTransformForCurrent());
13798
13806
  };
13799
13807
  if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
13800
13808
  const {
@@ -13808,11 +13816,19 @@
13808
13816
  doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13809
13817
  context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
13810
13818
  }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13811
- context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY("bottom", fontSize) - .05 * fontSize, z, textAttribute, context, {
13819
+ context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, line.descent, (line.descent - line.ascent) / 2, z, textAttribute, context, {
13812
13820
  width: line.width
13813
13821
  });
13814
13822
  })));
13815
13823
  } else {
13824
+ let {
13825
+ textAlign = textAttribute.textAlign,
13826
+ textBaseline = textAttribute.textBaseline
13827
+ } = text.attribute;
13828
+ if (!verticalMode) {
13829
+ const t = textAlign;
13830
+ textAlign = null !== (_b = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = text.getAlignMapBaseline()[t]) && void 0 !== _c ? _c : "top";
13831
+ }
13816
13832
  text.tryUpdateAABBBounds();
13817
13833
  const cache = text.cache,
13818
13834
  {
@@ -13851,12 +13867,10 @@
13851
13867
  computed3dMatrix = !keepDirIn3d;
13852
13868
  this._draw(text, textAttribute, computed3dMatrix, drawContext, params);
13853
13869
  }
13854
- drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context, multiOption) {
13870
+ drawUnderLine(underline, lineThrough, text, anchorX, anchorY, offsetUnderLineY, offsetThroughLineY, z, textAttribute, context, multiOption) {
13855
13871
  if (lineThrough + underline <= 0) return;
13856
13872
  const {
13857
13873
  textAlign = textAttribute.textAlign,
13858
- textBaseline = textAttribute.textBaseline,
13859
- fontSize = textAttribute.fontSize,
13860
13874
  fill = textAttribute.fill,
13861
13875
  opacity = textAttribute.opacity,
13862
13876
  underlineOffset = textAttribute.underlineOffset,
@@ -13866,23 +13880,21 @@
13866
13880
  isMulti = !isNil$1(multiOption),
13867
13881
  w = isMulti ? multiOption.width : text.clipedWidth,
13868
13882
  offsetX = isMulti ? 0 : textDrawOffsetX(textAlign, w),
13869
- offsetY = textLayoutOffsetY(isMulti ? "alphabetic" : textBaseline, fontSize, fontSize),
13870
13883
  attribute = {
13871
13884
  lineWidth: 0,
13872
13885
  stroke: fill,
13873
13886
  opacity: opacity,
13874
13887
  strokeOpacity: fillOpacity
13875
13888
  };
13876
- let deltaY = isMulti ? -3 : 0;
13877
13889
  if (underline) {
13878
- attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
13879
- const dy = y + offsetY + fontSize + underlineOffset + deltaY;
13880
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
13890
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
13891
+ const dy = anchorY + offsetUnderLineY + underlineOffset;
13892
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13881
13893
  }
13882
- if (isMulti && (deltaY = -1), lineThrough) {
13883
- attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.beginPath();
13884
- const dy = y + offsetY + fontSize / 2 + deltaY;
13885
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
13894
+ if (lineThrough) {
13895
+ attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), context.beginPath();
13896
+ const dy = anchorY + offsetThroughLineY;
13897
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13886
13898
  }
13887
13899
  }
13888
13900
  };
@@ -14585,7 +14597,7 @@
14585
14597
  for (let i = 0, len = lines.length; i < len; i++) {
14586
14598
  const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
14587
14599
  width = Math.min(metrics.width, lineWidth), linesLayout.push({
14588
- str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14600
+ str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14589
14601
  width: width,
14590
14602
  ascent: metrics.ascent,
14591
14603
  descent: metrics.descent
@@ -14782,8 +14794,7 @@
14782
14794
  whiteSpace = textTheme.whiteSpace,
14783
14795
  suffixPosition = textTheme.suffixPosition
14784
14796
  } = attribute,
14785
- buf = ignoreBuf ? 0 : 2,
14786
- lineHeight = this.getLineHeight(attribute, textTheme) + buf;
14797
+ lineHeight = this.getLineHeight(attribute, textTheme);
14787
14798
  if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
14788
14799
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14789
14800
  const bbox = this.cache.layoutData.bbox;
@@ -14819,8 +14830,7 @@
14819
14830
  heightLimit = 0,
14820
14831
  lineClamp: lineClamp
14821
14832
  } = this.attribute,
14822
- buf = ignoreBuf ? 0 : 2,
14823
- lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
14833
+ lineHeight = this.getLineHeight(this.attribute, textTheme);
14824
14834
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14825
14835
  const bbox = this.cache.layoutData.bbox;
14826
14836
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
@@ -14851,8 +14861,8 @@
14851
14861
  });
14852
14862
  break;
14853
14863
  }
14854
- const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-word" === wordBreak);
14855
- if ("" !== str && "" === clip.str) {
14864
+ const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
14865
+ if ("" !== str && "" === clip.str || clip.wordBreaked) {
14856
14866
  if (ellipsis) {
14857
14867
  const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14858
14868
  clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
@@ -14860,13 +14870,15 @@
14860
14870
  needCut = !1;
14861
14871
  }
14862
14872
  const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
14863
- if (linesLayout.push({
14873
+ linesLayout.push({
14864
14874
  str: clip.str,
14865
14875
  width: clip.width,
14866
14876
  ascent: matrics.ascent,
14867
14877
  descent: matrics.descent
14868
- }), clip.str.length === str.length) ;else if (needCut) {
14869
- const newStr = str.substring(clip.str.length);
14878
+ });
14879
+ let cutLength = clip.str.length;
14880
+ if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
14881
+ const newStr = str.substring(cutLength);
14870
14882
  lines.splice(i + 1, 0, newStr);
14871
14883
  }
14872
14884
  }
@@ -15182,6 +15194,9 @@
15182
15194
  bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
15183
15195
  } else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
15184
15196
  }
15197
+ parseSize(size) {
15198
+ return isNumber$1(size) ? size : Math.min(size[0], size[1]);
15199
+ }
15185
15200
  }
15186
15201
 
15187
15202
  function circle(ctx, r, x, y, z) {
@@ -15192,13 +15207,13 @@
15192
15207
  super(...arguments), this.type = "circle", this.pathStr = "M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0";
15193
15208
  }
15194
15209
  draw(ctx, size, x, y, z) {
15195
- return circle(ctx, size / 2, x, y, z);
15210
+ return circle(ctx, this.parseSize(size) / 2, x, y, z);
15196
15211
  }
15197
15212
  drawOffset(ctx, size, x, y, offset, z) {
15198
- return circle(ctx, size / 2 + offset, x, y, z);
15213
+ return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
15199
15214
  }
15200
15215
  drawToSvgPath(size, x, y, z) {
15201
- const r = size / 2;
15216
+ const r = this.parseSize(size) / 2;
15202
15217
  return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
15203
15218
  }
15204
15219
  }
@@ -15215,10 +15230,10 @@
15215
15230
  super(...arguments), this.type = "cross", this.pathStr = "M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z";
15216
15231
  }
15217
15232
  draw(ctx, size, x, y, z) {
15218
- return cross(ctx, size / 6, x, y, z);
15233
+ return cross(ctx, this.parseSize(size) / 6, x, y, z);
15219
15234
  }
15220
15235
  drawOffset(ctx, size, x, y, offset, z) {
15221
- return crossOffset(ctx, size / 6, x, y, offset, z);
15236
+ return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
15222
15237
  }
15223
15238
  }
15224
15239
  var cross$1 = new CrossSymbol();
@@ -15231,13 +15246,13 @@
15231
15246
  super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
15232
15247
  }
15233
15248
  draw(ctx, size, x, y, z) {
15234
- return diamond(ctx, size / 2, x, y, z);
15249
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
15235
15250
  }
15236
15251
  drawFitDir(ctx, size, x, y, z) {
15237
- return diamond(ctx, size / 2, x, y, z);
15252
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
15238
15253
  }
15239
15254
  drawOffset(ctx, size, x, y, offset, z) {
15240
- return diamond(ctx, size / 2 + offset, x, y, z);
15255
+ return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
15241
15256
  }
15242
15257
  }
15243
15258
  var diamond$1 = new DiamondSymbol();
@@ -15251,10 +15266,10 @@
15251
15266
  super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
15252
15267
  }
15253
15268
  draw(ctx, size, x, y) {
15254
- return square(ctx, size / 2, x, y);
15269
+ return square(ctx, this.parseSize(size) / 2, x, y);
15255
15270
  }
15256
15271
  drawOffset(ctx, size, x, y, offset) {
15257
- return square(ctx, size / 2 + offset, x, y);
15272
+ return square(ctx, this.parseSize(size) / 2 + offset, x, y);
15258
15273
  }
15259
15274
  }
15260
15275
  var square$1 = new SquareSymbol();
@@ -15268,10 +15283,10 @@
15268
15283
  super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
15269
15284
  }
15270
15285
  draw(ctx, size, x, y) {
15271
- return trianglUpOffset(ctx, size / 2, x, y);
15286
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
15272
15287
  }
15273
15288
  drawOffset(ctx, size, x, y, offset) {
15274
- return trianglUpOffset(ctx, size / 2, x, y, offset);
15289
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15275
15290
  }
15276
15291
  }
15277
15292
  var triangleUp = new TriangleUpSymbol();
@@ -15303,10 +15318,10 @@
15303
15318
  super(...arguments), this.type = "star", this.pathStr = "M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z";
15304
15319
  }
15305
15320
  draw(ctx, size, transX, transY) {
15306
- return star(ctx, size / 2, transX, transY);
15321
+ return star(ctx, this.parseSize(size) / 2, transX, transY);
15307
15322
  }
15308
15323
  drawOffset(ctx, size, transX, transY, offset) {
15309
- return star(ctx, size / 2 + offset, transX, transY);
15324
+ return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15310
15325
  }
15311
15326
  }
15312
15327
  var star$1 = new StarSymbol();
@@ -15324,10 +15339,10 @@
15324
15339
  super(...arguments), this.type = "arrow", this.pathStr = "M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z";
15325
15340
  }
15326
15341
  draw(ctx, size, transX, transY) {
15327
- return arrow(ctx, size / 2, transX, transY);
15342
+ return arrow(ctx, this.parseSize(size) / 2, transX, transY);
15328
15343
  }
15329
15344
  drawOffset(ctx, size, transX, transY, offset) {
15330
- return arrow(ctx, size / 2 + offset, transX, transY);
15345
+ return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15331
15346
  }
15332
15347
  }
15333
15348
  var arrow$1 = new ArrowSymbol();
@@ -15341,10 +15356,10 @@
15341
15356
  super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
15342
15357
  }
15343
15358
  draw(ctx, size, transX, transY) {
15344
- return wedge(ctx, size / 2, transX, transY);
15359
+ return wedge(ctx, this.parseSize(size) / 2, transX, transY);
15345
15360
  }
15346
15361
  drawOffset(ctx, size, transX, transY, offset) {
15347
- return wedge(ctx, size / 2 + offset, transX, transY);
15362
+ return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15348
15363
  }
15349
15364
  }
15350
15365
  var wedge$1 = new WedgeSymbol();
@@ -15357,10 +15372,10 @@
15357
15372
  super(...arguments), this.type = "stroke", this.pathStr = "";
15358
15373
  }
15359
15374
  draw(ctx, size, transX, transY) {
15360
- return stroke(ctx, size / 2, transX, transY);
15375
+ return stroke(ctx, this.parseSize(size) / 2, transX, transY);
15361
15376
  }
15362
15377
  drawOffset(ctx, size, transX, transY, offset) {
15363
- return stroke(ctx, size / 2 + offset, transX, transY);
15378
+ return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15364
15379
  }
15365
15380
  }
15366
15381
  var stroke$1 = new StrokeSymbol();
@@ -15382,10 +15397,10 @@
15382
15397
  super(...arguments), this.type = "wye", this.pathStr = "M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z";
15383
15398
  }
15384
15399
  draw(ctx, size, transX, transY) {
15385
- return wye(ctx, size / 2, transX, transY);
15400
+ return wye(ctx, this.parseSize(size) / 2, transX, transY);
15386
15401
  }
15387
15402
  drawOffset(ctx, size, transX, transY, offset) {
15388
- return wye(ctx, size / 2 + offset, transX, transY);
15403
+ return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15389
15404
  }
15390
15405
  }
15391
15406
  var wye$1 = new WyeSymbol();
@@ -15398,10 +15413,10 @@
15398
15413
  super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
15399
15414
  }
15400
15415
  draw(ctx, size, x, y) {
15401
- return trianglLeftOffset(ctx, size / 2, x, y, 0);
15416
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
15402
15417
  }
15403
15418
  drawOffset(ctx, size, x, y, offset) {
15404
- return trianglLeftOffset(ctx, size / 2, x, y, offset);
15419
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15405
15420
  }
15406
15421
  }
15407
15422
  var triangleLeft = new TriangleLeftSymbol();
@@ -15415,10 +15430,10 @@
15415
15430
  super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
15416
15431
  }
15417
15432
  draw(ctx, size, x, y) {
15418
- return trianglRightOffset(ctx, size / 2, x, y);
15433
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
15419
15434
  }
15420
15435
  drawOffset(ctx, size, x, y, offset) {
15421
- return trianglRightOffset(ctx, size / 2, x, y, offset);
15436
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15422
15437
  }
15423
15438
  }
15424
15439
  var triangleRight = new TriangleRightSymbol();
@@ -15432,10 +15447,10 @@
15432
15447
  super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
15433
15448
  }
15434
15449
  draw(ctx, size, x, y) {
15435
- return trianglDownOffset(ctx, size / 2, x, y);
15450
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
15436
15451
  }
15437
15452
  drawOffset(ctx, size, x, y, offset) {
15438
- return trianglDownOffset(ctx, size / 2, x, y, offset);
15453
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15439
15454
  }
15440
15455
  }
15441
15456
  var triangleDown = new TriangleDownSymbol();
@@ -15450,10 +15465,10 @@
15450
15465
  super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
15451
15466
  }
15452
15467
  draw(ctx, size, x, y) {
15453
- return thinTriangle(ctx, size / 2 / sqrt3, x, y);
15468
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
15454
15469
  }
15455
15470
  drawOffset(ctx, size, x, y, offset) {
15456
- return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
15471
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
15457
15472
  }
15458
15473
  }
15459
15474
  var thinTriangle$1 = new ThinTriangleSymbol();
@@ -15467,10 +15482,10 @@
15467
15482
  super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
15468
15483
  }
15469
15484
  draw(ctx, size, transX, transY) {
15470
- return arrow2Left(ctx, size / 4, transX, transY);
15485
+ return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
15471
15486
  }
15472
15487
  drawOffset(ctx, size, transX, transY, offset) {
15473
- return arrow2Left(ctx, size / 4 + offset, transX, transY);
15488
+ return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15474
15489
  }
15475
15490
  }
15476
15491
  var arrow2Left$1 = new Arrow2LeftSymbol();
@@ -15484,10 +15499,10 @@
15484
15499
  super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
15485
15500
  }
15486
15501
  draw(ctx, size, transX, transY) {
15487
- return arrow2Right(ctx, size / 4, transX, transY);
15502
+ return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
15488
15503
  }
15489
15504
  drawOffset(ctx, size, transX, transY, offset) {
15490
- return arrow2Right(ctx, size / 4 + offset, transX, transY);
15505
+ return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15491
15506
  }
15492
15507
  }
15493
15508
  var arrow2Right$1 = new Arrow2RightSymbol();
@@ -15501,10 +15516,10 @@
15501
15516
  super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
15502
15517
  }
15503
15518
  draw(ctx, size, transX, transY) {
15504
- return arrow2Up(ctx, size / 4, transX, transY);
15519
+ return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
15505
15520
  }
15506
15521
  drawOffset(ctx, size, transX, transY, offset) {
15507
- return arrow2Up(ctx, size / 4 + offset, transX, transY);
15522
+ return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15508
15523
  }
15509
15524
  }
15510
15525
  var arrow2Up$1 = new Arrow2UpSymbol();
@@ -15518,10 +15533,10 @@
15518
15533
  super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
15519
15534
  }
15520
15535
  draw(ctx, size, transX, transY) {
15521
- return arrow2Down(ctx, size / 4, transX, transY);
15536
+ return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
15522
15537
  }
15523
15538
  drawOffset(ctx, size, transX, transY, offset) {
15524
- return arrow2Down(ctx, size / 4 + offset, transX, transY);
15539
+ return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15525
15540
  }
15526
15541
  }
15527
15542
  var arrow2Down$1 = new Arrow2DownSymbol();
@@ -15534,13 +15549,13 @@
15534
15549
  super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
15535
15550
  }
15536
15551
  draw(ctx, size, x, y, z) {
15537
- return lineV(ctx, size / 2, x, y);
15552
+ return lineV(ctx, this.parseSize(size) / 2, x, y);
15538
15553
  }
15539
15554
  drawOffset(ctx, size, x, y, offset, z) {
15540
- return lineV(ctx, size / 2 + offset, x, y);
15555
+ return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
15541
15556
  }
15542
15557
  drawToSvgPath(size, x, y, z) {
15543
- const r = size / 2;
15558
+ const r = this.parseSize(size) / 2;
15544
15559
  return `M ${x}, ${y - r} L ${x},${y + r}`;
15545
15560
  }
15546
15561
  }
@@ -15554,13 +15569,13 @@
15554
15569
  super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
15555
15570
  }
15556
15571
  draw(ctx, size, x, y, z) {
15557
- return lineH(ctx, size / 2, x, y);
15572
+ return lineH(ctx, this.parseSize(size) / 2, x, y);
15558
15573
  }
15559
15574
  drawOffset(ctx, size, x, y, offset, z) {
15560
- return lineH(ctx, size / 2 + offset, x, y);
15575
+ return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
15561
15576
  }
15562
15577
  drawToSvgPath(size, x, y, z) {
15563
- const r = size / 2;
15578
+ const r = this.parseSize(size) / 2;
15564
15579
  return `M ${x - r}, ${y} L ${x + r},${y}`;
15565
15580
  }
15566
15581
  }
@@ -15574,13 +15589,13 @@
15574
15589
  super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
15575
15590
  }
15576
15591
  draw(ctx, size, x, y, z) {
15577
- return close(ctx, size / 2, x, y);
15592
+ return close(ctx, this.parseSize(size) / 2, x, y);
15578
15593
  }
15579
15594
  drawOffset(ctx, size, x, y, offset, z) {
15580
- return close(ctx, size / 2 + offset, x, y);
15595
+ return close(ctx, this.parseSize(size) / 2 + offset, x, y);
15581
15596
  }
15582
15597
  drawToSvgPath(size, x, y, z) {
15583
- const r = size / 2;
15598
+ const r = this.parseSize(size) / 2;
15584
15599
  return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
15585
15600
  }
15586
15601
  }
@@ -15614,15 +15629,18 @@
15614
15629
  this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
15615
15630
  }
15616
15631
  drawOffset(ctx, size, x, y, offset, z, cb) {
15617
- return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
15632
+ return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
15618
15633
  ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
15619
15634
  }), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
15620
15635
  }
15621
15636
  draw(ctx, size, x, y, z, cb) {
15622
- return this.drawOffset(ctx, size, x, y, 0, z, cb);
15637
+ return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
15638
+ }
15639
+ parseSize(size) {
15640
+ return isNumber$1(size) ? size : Math.min(size[0], size[1]);
15623
15641
  }
15624
15642
  bounds(size, bounds) {
15625
- if (this.isSvg) {
15643
+ if (size = this.parseSize(size), this.isSvg) {
15626
15644
  if (!this.svgCache) return;
15627
15645
  return bounds.clear(), void this.svgCache.forEach(_ref => {
15628
15646
  let {
@@ -16305,7 +16323,11 @@
16305
16323
  case "sub":
16306
16324
  baseline += this.descent / 2;
16307
16325
  }
16308
- "vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0), this.character.stroke && (applyStrokeStyle(ctx, this.character), ctx.strokeText(text, left, baseline)), applyFillStyle(ctx, this.character), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill && ("boolean" == typeof this.character.lineThrough || "boolean" == typeof this.character.underline ? (this.character.underline && ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1), this.character.lineThrough && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)) : "underline" === this.character.textDecoration ? ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1) : "line-through" === this.character.textDecoration && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)), "vertical" === direction && ctx.restore();
16326
+ "vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0);
16327
+ const {
16328
+ lineWidth = 1
16329
+ } = this.character;
16330
+ this.character.stroke && lineWidth && (applyStrokeStyle(ctx, this.character), ctx.strokeText(text, left, baseline)), applyFillStyle(ctx, this.character), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill && ("boolean" == typeof this.character.lineThrough || "boolean" == typeof this.character.underline ? (this.character.underline && ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1), this.character.lineThrough && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)) : "underline" === this.character.textDecoration ? ctx.fillRect(left, 1 + baseline, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1) : "line-through" === this.character.textDecoration && ctx.fillRect(left, 1 + baseline - this.ascent / 2, this.widthOrigin || this.width, this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1)), "vertical" === direction && ctx.restore();
16309
16331
  }
16310
16332
  getWidthWithEllips(direction) {
16311
16333
  let text = this.text;
@@ -18522,7 +18544,7 @@
18522
18544
  constructor() {
18523
18545
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18524
18546
  var _a;
18525
- super({}), this._onVisibleChange = visible => {
18547
+ super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
18526
18548
  if (!(this._skipRender < 0)) if (visible) {
18527
18549
  if (this.dirtyBounds) {
18528
18550
  const b = this.window.getViewBox();
@@ -18533,7 +18555,10 @@
18533
18555
  }, this.beforeRender = stage => {
18534
18556
  this._beforeRender && this._beforeRender(stage);
18535
18557
  }, this.afterRender = stage => {
18536
- this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null;
18558
+ this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
18559
+ }, this.afterTickCb = () => {
18560
+ var _a;
18561
+ this.tickedBeforeRender = !0, "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) || "rendering" !== this.state && this.render();
18537
18562
  }, this.params = params, this.theme = new Theme(), this.hooks = {
18538
18563
  beforeRender: new SyncHook(["stage"]),
18539
18564
  afterRender: new SyncHook(["stage"])
@@ -18550,7 +18575,7 @@
18550
18575
  main: !0
18551
18576
  })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer, this.timeline = new DefaultTimeline(), this.ticker.addTimeline(this.timeline), this.timeline.pause(), params.optimize || (params.optimize = {}), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
18552
18577
  background: this._background
18553
- });
18578
+ }), this.ticker.on("afterTick", this.afterTickCb);
18554
18579
  }
18555
18580
  pauseRender() {
18556
18581
  let sr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
@@ -18779,7 +18804,7 @@
18779
18804
  if ("released" === this.releaseStatus) return;
18780
18805
  this.ticker.start(), this.timeline.resume();
18781
18806
  const state = this.state;
18782
- this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
18807
+ this.state = "rendering", this.tickedBeforeRender || this.ticker.trySyncTickStatus(), this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
18783
18808
  }
18784
18809
  combineLayersToWindow() {
18785
18810
  if ("harmony" === this.global.env) {
@@ -18885,7 +18910,7 @@
18885
18910
  layer.release();
18886
18911
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
18887
18912
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
18888
- }), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.renderService.renderTreeRoots = [];
18913
+ }), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.ticker.removeListener("afterTick", this.afterTickCb), this.renderService.renderTreeRoots = [];
18889
18914
  }
18890
18915
  setStage(stage) {}
18891
18916
  dirty(b, matrix) {
@@ -23864,7 +23889,7 @@
23864
23889
  startTime: startTime,
23865
23890
  startPoints: startPoints
23866
23891
  } = this;
23867
- if (eventType) return eventType;
23892
+ if ("press" === eventType) return eventType;
23868
23893
  let type;
23869
23894
  return type = clock.now() - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold ? "press" : "pan", this.eventType = type, type;
23870
23895
  }
@@ -24396,9 +24421,10 @@
24396
24421
  lineJoin = defaultParams.lineJoin,
24397
24422
  lineDash = defaultParams.lineDash,
24398
24423
  lineCap = defaultParams.lineCap,
24399
- miterLimit = defaultParams.miterLimit
24424
+ miterLimit = defaultParams.miterLimit,
24425
+ keepStrokeScale = defaultParams.keepStrokeScale
24400
24426
  } = attribute;
24401
- _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
24427
+ _context.lineWidth = keepStrokeScale ? lineWidth : getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
24402
24428
  }
24403
24429
  }
24404
24430
  setTextStyleWithoutAlignBaseline(params, defaultParams, z) {
@@ -25298,8 +25324,9 @@
25298
25324
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, (context, arcAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, arcAttribute, themeAttribute) => {
25299
25325
  if (picked) return !0;
25300
25326
  const lineWidth = arcAttribute.lineWidth || themeAttribute.lineWidth,
25301
- pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
25302
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25327
+ pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
25328
+ keepStrokeScale = arcAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
25329
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25303
25330
  }), pickContext.highPerformanceRestore(), picked;
25304
25331
  }
25305
25332
  }
@@ -25572,8 +25599,9 @@
25572
25599
  if (!onlyTranslate || rect.shadowRoot || isNumber$1(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
25573
25600
  if (picked) return !0;
25574
25601
  const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
25575
- pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
25576
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25602
+ pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
25603
+ keepStrokeScale = rectAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
25604
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25577
25605
  });else {
25578
25606
  const {
25579
25607
  fill = rectAttribute.fill,
@@ -25887,9 +25915,10 @@
25887
25915
  lineJoin = defaultParams.lineJoin,
25888
25916
  lineDash = defaultParams.lineDash,
25889
25917
  lineCap = defaultParams.lineCap,
25890
- miterLimit = defaultParams.miterLimit
25918
+ miterLimit = defaultParams.miterLimit,
25919
+ keepStrokeScale = defaultParams.keepStrokeScale
25891
25920
  } = attribute;
25892
- _context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
25921
+ _context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = keepStrokeScale ? lineWidth : getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
25893
25922
  }
25894
25923
  }
25895
25924
  measureText(text) {
@@ -26517,9 +26546,10 @@
26517
26546
  lineJoin = defaultParams.lineJoin,
26518
26547
  lineDash = defaultParams.lineDash,
26519
26548
  lineCap = defaultParams.lineCap,
26520
- miterLimit = defaultParams.miterLimit
26549
+ miterLimit = defaultParams.miterLimit,
26550
+ keepStrokeScale = defaultParams.keepStrokeScale
26521
26551
  } = attribute;
26522
- _context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(getScaledStroke(this, lineWidth, this.dpr)), _context.setStrokeStyle(createColor(this, stroke, params, offsetX, offsetY)), _context.setLineJoin(lineJoin), lineDash && _context.setLineDash(lineDash), _context.setLineCap(lineCap), _context.setMiterLimit(miterLimit);
26552
+ _context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(keepStrokeScale ? lineWidth : getScaledStroke(this, lineWidth, this.dpr)), _context.setStrokeStyle(createColor(this, stroke, params, offsetX, offsetY)), _context.setLineJoin(lineJoin), lineDash && _context.setLineDash(lineDash), _context.setLineCap(lineCap), _context.setMiterLimit(miterLimit);
26523
26553
  }
26524
26554
  }
26525
26555
  setTextStyleWithoutAlignBaseline(params, defaultParams) {
@@ -27559,9 +27589,10 @@
27559
27589
  lineJoin = defaultParams.lineJoin,
27560
27590
  lineDash = defaultParams.lineDash,
27561
27591
  lineCap = defaultParams.lineCap,
27562
- miterLimit = defaultParams.miterLimit
27592
+ miterLimit = defaultParams.miterLimit,
27593
+ keepStrokeScale = defaultParams.keepStrokeScale
27563
27594
  } = attribute;
27564
- _context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
27595
+ _context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = keepStrokeScale ? lineWidth : getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
27565
27596
  }
27566
27597
  }
27567
27598
  measureText(text) {
@@ -27968,8 +27999,9 @@
27968
27999
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, context => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, lineAttribute, themeAttribute) => {
27969
28000
  if (picked) return !0;
27970
28001
  const lineWidth = lineAttribute.lineWidth || themeAttribute.lineWidth,
27971
- pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
27972
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
28002
+ pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
28003
+ keepStrokeScale = lineAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
28004
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
27973
28005
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
27974
28006
  }
27975
28007
  }
@@ -28104,8 +28136,9 @@
28104
28136
  return this.canvasRenderer.drawShape(symbol, pickContext, x, y, {}, null, (context, symbolAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, symbolAttribute, themeAttribute) => {
28105
28137
  if (picked) return !0;
28106
28138
  const lineWidth = symbolAttribute.lineWidth || themeAttribute.lineWidth,
28107
- pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
28108
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
28139
+ pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
28140
+ keepStrokeScale = symbolAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
28141
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
28109
28142
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
28110
28143
  }
28111
28144
  };
@@ -28199,8 +28232,10 @@
28199
28232
  } = text.attribute,
28200
28233
  bounds = text.AABBBounds,
28201
28234
  height = bounds.height(),
28202
- width = bounds.width();
28203
- return context.rect(bounds.x1, bounds.y1, width, height, z), picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked;
28235
+ width = bounds.width(),
28236
+ offsetY = textLayoutOffsetY(textBaseline, height, fontSize),
28237
+ offsetX = textDrawOffsetX(textAlign, width);
28238
+ return context.rect(offsetX + x, offsetY + y, width, height, z), picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked;
28204
28239
  }, (context, symbolAttribute, themeAttribute) => picked), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
28205
28240
  }
28206
28241
  };
@@ -28540,7 +28575,7 @@
28540
28575
 
28541
28576
  const roughModule = _roughModule;
28542
28577
 
28543
- const version = "0.21.0-alpha.3";
28578
+ const version = "0.21.0-alpha.5";
28544
28579
  preLoadAllModule();
28545
28580
  if (isBrowserEnv()) {
28546
28581
  loadBrowserEnv(container);