@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.es.js CHANGED
@@ -3991,7 +3991,8 @@ const DefaultAttribute = Object.assign(Object.assign(Object.assign({
3991
3991
  globalZIndex: 1,
3992
3992
  globalCompositeOperation: "",
3993
3993
  overflow: "hidden",
3994
- shadowPickMode: "graphic"
3994
+ shadowPickMode: "graphic",
3995
+ keepStrokeScale: !1
3995
3996
  }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
3996
3997
  function addAttributeToPrototype(obj, c, keys) {
3997
3998
  keys.forEach(key => {
@@ -6495,7 +6496,7 @@ class TimeOutTickHandler {
6495
6496
  }
6496
6497
  }
6497
6498
 
6498
- class DefaultTicker {
6499
+ class DefaultTicker extends EventEmitter {
6499
6500
  set mode(m) {
6500
6501
  this._mode !== m && (this._mode = m, this.setupTickHandler());
6501
6502
  }
@@ -6504,17 +6505,17 @@ class DefaultTicker {
6504
6505
  }
6505
6506
  constructor() {
6506
6507
  let timelines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6507
- this.handleTick = (handler, params) => {
6508
+ super(), this.handleTick = (handler, params) => {
6508
6509
  const {
6509
6510
  once = !1
6510
6511
  } = null != params ? params : {};
6511
- this.ifCanStop() ? this.stop() : (this._handlerTick(handler), once || handler.tick(this.interval, this.handleTick));
6512
- }, this._handlerTick = handler => {
6512
+ this.ifCanStop() ? this.stop() : (this._handlerTick(), once || handler.tick(this.interval, this.handleTick));
6513
+ }, this._handlerTick = () => {
6513
6514
  const time = this.tickerHandler.getTime();
6514
6515
  let delta = 0;
6515
6516
  this.lastFrameTime >= 0 && (delta = time - this.lastFrameTime), this.lastFrameTime = time, this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(t => {
6516
6517
  t.tick(delta);
6517
- }));
6518
+ }), this.emit("afterTick"));
6518
6519
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.timelines = timelines, this.autoStop = !0;
6519
6520
  }
6520
6521
  init() {
@@ -6610,6 +6611,9 @@ class DefaultTicker {
6610
6611
  stop() {
6611
6612
  this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
6612
6613
  }
6614
+ trySyncTickStatus() {
6615
+ this.status === STATUS$1.RUNNING && this._handlerTick();
6616
+ }
6613
6617
  }
6614
6618
 
6615
6619
  class ManualTickHandler {
@@ -7751,7 +7755,7 @@ class TagPointsUpdate extends ACustomAnimate {
7751
7755
  lastMatchedIndex = i, lastMatchedPoint = tagMap.get(this.toPoints[i].context);
7752
7756
  break;
7753
7757
  }
7754
- "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);
7758
+ "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);
7755
7759
  let prevMatchedPoint = this.toPoints[0];
7756
7760
  this.interpolatePoints = this.toPoints.map((point, index) => {
7757
7761
  const matchedPoint = tagMap.get(point.context);
@@ -7763,11 +7767,19 @@ class TagPointsUpdate extends ACustomAnimate {
7763
7767
  return newPoint.defined = toPoint.defined, newPoint.context = toPoint.context, newPoint;
7764
7768
  });
7765
7769
  }
7770
+ onFirstRun() {
7771
+ const lastClipRange = this.target.attribute.clipRange;
7772
+ isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
7773
+ }
7766
7774
  onUpdate(end, ratio, out) {
7767
7775
  if (this.points = this.points.map((point, index) => {
7768
7776
  const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
7769
7777
  return newPoint.context = point.context, newPoint;
7770
- }), this.clipRange && (out.clipRange = this.clipRange + (1 - this.clipRange) * ratio), this.segmentsCache && this.to.segments) {
7778
+ }), this.clipRange) {
7779
+ 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));
7780
+ out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
7781
+ }
7782
+ if (this.segmentsCache && this.to.segments) {
7771
7783
  let start = 0;
7772
7784
  out.segments = this.to.segments.map((segment, index) => {
7773
7785
  const end = start + this.segmentsCache[index],
@@ -12121,7 +12133,8 @@ class DefaultArcRenderContribution {
12121
12133
  x: originX = arcAttribute.x,
12122
12134
  y: originY = arcAttribute.y,
12123
12135
  scaleX = arcAttribute.scaleX,
12124
- scaleY = arcAttribute.scaleY
12136
+ scaleY = arcAttribute.scaleY,
12137
+ keepStrokeScale = arcAttribute.keepStrokeScale
12125
12138
  } = arc.attribute;
12126
12139
  let {
12127
12140
  innerRadius = arcAttribute.innerRadius,
@@ -12133,7 +12146,7 @@ class DefaultArcRenderContribution {
12133
12146
  {
12134
12147
  distance = arcAttribute[key].distance
12135
12148
  } = borderStyle,
12136
- d = getScaledStroke(context, distance, context.dpr),
12149
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12137
12150
  deltaAngle = distance / outerRadius,
12138
12151
  sign = "outerBorder" === key ? 1 : -1;
12139
12152
  if (arc.setAttributes({
@@ -12178,14 +12191,15 @@ class DefaultCircleRenderContribution {
12178
12191
  x: originX = circleAttribute.x,
12179
12192
  y: originY = circleAttribute.y,
12180
12193
  scaleX = circleAttribute.scaleX,
12181
- scaleY = circleAttribute.scaleY
12194
+ scaleY = circleAttribute.scaleY,
12195
+ keepStrokeScale = circleAttribute.keepStrokeScale
12182
12196
  } = circle.attribute,
12183
12197
  renderBorder = (borderStyle, key) => {
12184
12198
  const doStroke = !(!borderStyle || !borderStyle.stroke),
12185
12199
  {
12186
12200
  distance = circleAttribute[key].distance
12187
12201
  } = borderStyle,
12188
- d = getScaledStroke(context, distance, context.dpr),
12202
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12189
12203
  sign = "outerBorder" === key ? 1 : -1;
12190
12204
  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) {
12191
12205
  const lastOpacity = circleAttribute[key].opacity;
@@ -12304,7 +12318,8 @@ class DefaultRectRenderContribution {
12304
12318
  scaleX = rectAttribute.scaleX,
12305
12319
  scaleY = rectAttribute.scaleY,
12306
12320
  x1: x1,
12307
- y1: y1
12321
+ y1: y1,
12322
+ keepStrokeScale = rectAttribute.keepStrokeScale
12308
12323
  } = rect.attribute;
12309
12324
  let {
12310
12325
  width: width,
@@ -12317,7 +12332,7 @@ class DefaultRectRenderContribution {
12317
12332
  {
12318
12333
  distance = rectAttribute[key].distance
12319
12334
  } = borderStyle,
12320
- d = getScaledStroke(context, distance, context.dpr),
12335
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12321
12336
  nextX = x + sign * d,
12322
12337
  nextY = y + sign * d,
12323
12338
  dw = 2 * d;
@@ -12474,14 +12489,15 @@ class DefaultSymbolRenderContribution {
12474
12489
  x: originX = symbolAttribute.x,
12475
12490
  y: originY = symbolAttribute.y,
12476
12491
  scaleX = symbolAttribute.scaleX,
12477
- scaleY = symbolAttribute.scaleY
12492
+ scaleY = symbolAttribute.scaleY,
12493
+ keepStrokeScale = symbolAttribute.keepStrokeScale
12478
12494
  } = symbol.attribute,
12479
12495
  renderBorder = (borderStyle, key) => {
12480
12496
  const doStroke = !(!borderStyle || !borderStyle.stroke),
12481
12497
  {
12482
12498
  distance = symbolAttribute[key].distance
12483
12499
  } = borderStyle,
12484
- d = getScaledStroke(context, distance, context.dpr),
12500
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12485
12501
  sign = "outerBorder" === key ? 1 : -1;
12486
12502
  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) {
12487
12503
  const lastOpacity = symbolAttribute[key].opacity;
@@ -13759,16 +13775,8 @@ let DefaultCanvasTextRender = class extends BaseRender {
13759
13775
  verticalMode = textAttribute.verticalMode,
13760
13776
  x: originX = textAttribute.x,
13761
13777
  y: originY = textAttribute.y
13762
- } = text.attribute;
13763
- let {
13764
- textAlign = textAttribute.textAlign,
13765
- textBaseline = textAttribute.textBaseline
13766
- } = text.attribute;
13767
- if (!verticalMode && "vertical" === direction) {
13768
- const t = textAlign;
13769
- textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
13770
- }
13771
- const lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
13778
+ } = text.attribute,
13779
+ lineHeight = null !== (_a = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _a ? _a : fontSize,
13772
13780
  data = this.valid(text, textAttribute, fillCb, strokeCb);
13773
13781
  if (!data) return;
13774
13782
  const {
@@ -13788,7 +13796,7 @@ let DefaultCanvasTextRender = class extends BaseRender {
13788
13796
  const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
13789
13797
  matrix.rotateByCenter(Math.PI / 2, _x, _y), context.transformFromMatrix(matrix, !0), matrixAllocate.free(matrix);
13790
13798
  }
13791
- 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());
13799
+ 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());
13792
13800
  };
13793
13801
  if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
13794
13802
  const {
@@ -13802,11 +13810,19 @@ let DefaultCanvasTextRender = class extends BaseRender {
13802
13810
  doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13803
13811
  context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
13804
13812
  }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13805
- 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, {
13813
+ 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, {
13806
13814
  width: line.width
13807
13815
  });
13808
13816
  })));
13809
13817
  } else {
13818
+ let {
13819
+ textAlign = textAttribute.textAlign,
13820
+ textBaseline = textAttribute.textBaseline
13821
+ } = text.attribute;
13822
+ if (!verticalMode) {
13823
+ const t = textAlign;
13824
+ textAlign = null !== (_b = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = text.getAlignMapBaseline()[t]) && void 0 !== _c ? _c : "top";
13825
+ }
13810
13826
  text.tryUpdateAABBBounds();
13811
13827
  const cache = text.cache,
13812
13828
  {
@@ -13845,12 +13861,10 @@ let DefaultCanvasTextRender = class extends BaseRender {
13845
13861
  computed3dMatrix = !keepDirIn3d;
13846
13862
  this._draw(text, textAttribute, computed3dMatrix, drawContext, params);
13847
13863
  }
13848
- drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context, multiOption) {
13864
+ drawUnderLine(underline, lineThrough, text, anchorX, anchorY, offsetUnderLineY, offsetThroughLineY, z, textAttribute, context, multiOption) {
13849
13865
  if (lineThrough + underline <= 0) return;
13850
13866
  const {
13851
13867
  textAlign = textAttribute.textAlign,
13852
- textBaseline = textAttribute.textBaseline,
13853
- fontSize = textAttribute.fontSize,
13854
13868
  fill = textAttribute.fill,
13855
13869
  opacity = textAttribute.opacity,
13856
13870
  underlineOffset = textAttribute.underlineOffset,
@@ -13860,23 +13874,21 @@ let DefaultCanvasTextRender = class extends BaseRender {
13860
13874
  isMulti = !isNil$1(multiOption),
13861
13875
  w = isMulti ? multiOption.width : text.clipedWidth,
13862
13876
  offsetX = isMulti ? 0 : textDrawOffsetX(textAlign, w),
13863
- offsetY = textLayoutOffsetY(isMulti ? "alphabetic" : textBaseline, fontSize, fontSize),
13864
13877
  attribute = {
13865
13878
  lineWidth: 0,
13866
13879
  stroke: fill,
13867
13880
  opacity: opacity,
13868
13881
  strokeOpacity: fillOpacity
13869
13882
  };
13870
- let deltaY = isMulti ? -3 : 0;
13871
13883
  if (underline) {
13872
- attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
13873
- const dy = y + offsetY + fontSize + underlineOffset + deltaY;
13874
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
13884
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
13885
+ const dy = anchorY + offsetUnderLineY + underlineOffset;
13886
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13875
13887
  }
13876
- if (isMulti && (deltaY = -1), lineThrough) {
13877
- attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.beginPath();
13878
- const dy = y + offsetY + fontSize / 2 + deltaY;
13879
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
13888
+ if (lineThrough) {
13889
+ attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), context.beginPath();
13890
+ const dy = anchorY + offsetThroughLineY;
13891
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13880
13892
  }
13881
13893
  }
13882
13894
  };
@@ -14579,7 +14591,7 @@ class CanvasTextLayout {
14579
14591
  for (let i = 0, len = lines.length; i < len; i++) {
14580
14592
  const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions);
14581
14593
  width = Math.min(metrics.width, lineWidth), linesLayout.push({
14582
- str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14594
+ str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14583
14595
  width: width,
14584
14596
  ascent: metrics.ascent,
14585
14597
  descent: metrics.descent
@@ -14776,8 +14788,7 @@ class Text extends Graphic {
14776
14788
  whiteSpace = textTheme.whiteSpace,
14777
14789
  suffixPosition = textTheme.suffixPosition
14778
14790
  } = attribute,
14779
- buf = ignoreBuf ? 0 : 2,
14780
- lineHeight = this.getLineHeight(attribute, textTheme) + buf;
14791
+ lineHeight = this.getLineHeight(attribute, textTheme);
14781
14792
  if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
14782
14793
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14783
14794
  const bbox = this.cache.layoutData.bbox;
@@ -14813,8 +14824,7 @@ class Text extends Graphic {
14813
14824
  heightLimit = 0,
14814
14825
  lineClamp: lineClamp
14815
14826
  } = this.attribute,
14816
- buf = ignoreBuf ? 0 : 2,
14817
- lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
14827
+ lineHeight = this.getLineHeight(this.attribute, textTheme);
14818
14828
  if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14819
14829
  const bbox = this.cache.layoutData.bbox;
14820
14830
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
@@ -14845,8 +14855,8 @@ class Text extends Graphic {
14845
14855
  });
14846
14856
  break;
14847
14857
  }
14848
- const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-word" === wordBreak);
14849
- if ("" !== str && "" === clip.str) {
14858
+ const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
14859
+ if ("" !== str && "" === clip.str || clip.wordBreaked) {
14850
14860
  if (ellipsis) {
14851
14861
  const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14852
14862
  clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
@@ -14854,13 +14864,15 @@ class Text extends Graphic {
14854
14864
  needCut = !1;
14855
14865
  }
14856
14866
  const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions);
14857
- if (linesLayout.push({
14867
+ linesLayout.push({
14858
14868
  str: clip.str,
14859
14869
  width: clip.width,
14860
14870
  ascent: matrics.ascent,
14861
14871
  descent: matrics.descent
14862
- }), clip.str.length === str.length) ;else if (needCut) {
14863
- const newStr = str.substring(clip.str.length);
14872
+ });
14873
+ let cutLength = clip.str.length;
14874
+ if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
14875
+ const newStr = str.substring(cutLength);
14864
14876
  lines.splice(i + 1, 0, newStr);
14865
14877
  }
14866
14878
  }
@@ -15176,6 +15188,9 @@ class BaseSymbol {
15176
15188
  bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
15177
15189
  } else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
15178
15190
  }
15191
+ parseSize(size) {
15192
+ return isNumber$1(size) ? size : Math.min(size[0], size[1]);
15193
+ }
15179
15194
  }
15180
15195
 
15181
15196
  function circle(ctx, r, x, y, z) {
@@ -15186,13 +15201,13 @@ class CircleSymbol extends BaseSymbol {
15186
15201
  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";
15187
15202
  }
15188
15203
  draw(ctx, size, x, y, z) {
15189
- return circle(ctx, size / 2, x, y, z);
15204
+ return circle(ctx, this.parseSize(size) / 2, x, y, z);
15190
15205
  }
15191
15206
  drawOffset(ctx, size, x, y, offset, z) {
15192
- return circle(ctx, size / 2 + offset, x, y, z);
15207
+ return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
15193
15208
  }
15194
15209
  drawToSvgPath(size, x, y, z) {
15195
- const r = size / 2;
15210
+ const r = this.parseSize(size) / 2;
15196
15211
  return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
15197
15212
  }
15198
15213
  }
@@ -15209,10 +15224,10 @@ class CrossSymbol extends BaseSymbol {
15209
15224
  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";
15210
15225
  }
15211
15226
  draw(ctx, size, x, y, z) {
15212
- return cross(ctx, size / 6, x, y, z);
15227
+ return cross(ctx, this.parseSize(size) / 6, x, y, z);
15213
15228
  }
15214
15229
  drawOffset(ctx, size, x, y, offset, z) {
15215
- return crossOffset(ctx, size / 6, x, y, offset, z);
15230
+ return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
15216
15231
  }
15217
15232
  }
15218
15233
  var cross$1 = new CrossSymbol();
@@ -15225,13 +15240,13 @@ class DiamondSymbol extends BaseSymbol {
15225
15240
  super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
15226
15241
  }
15227
15242
  draw(ctx, size, x, y, z) {
15228
- return diamond(ctx, size / 2, x, y, z);
15243
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
15229
15244
  }
15230
15245
  drawFitDir(ctx, size, x, y, z) {
15231
- return diamond(ctx, size / 2, x, y, z);
15246
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
15232
15247
  }
15233
15248
  drawOffset(ctx, size, x, y, offset, z) {
15234
- return diamond(ctx, size / 2 + offset, x, y, z);
15249
+ return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
15235
15250
  }
15236
15251
  }
15237
15252
  var diamond$1 = new DiamondSymbol();
@@ -15245,10 +15260,10 @@ class SquareSymbol extends BaseSymbol {
15245
15260
  super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
15246
15261
  }
15247
15262
  draw(ctx, size, x, y) {
15248
- return square(ctx, size / 2, x, y);
15263
+ return square(ctx, this.parseSize(size) / 2, x, y);
15249
15264
  }
15250
15265
  drawOffset(ctx, size, x, y, offset) {
15251
- return square(ctx, size / 2 + offset, x, y);
15266
+ return square(ctx, this.parseSize(size) / 2 + offset, x, y);
15252
15267
  }
15253
15268
  }
15254
15269
  var square$1 = new SquareSymbol();
@@ -15262,10 +15277,10 @@ class TriangleUpSymbol extends BaseSymbol {
15262
15277
  super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
15263
15278
  }
15264
15279
  draw(ctx, size, x, y) {
15265
- return trianglUpOffset(ctx, size / 2, x, y);
15280
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
15266
15281
  }
15267
15282
  drawOffset(ctx, size, x, y, offset) {
15268
- return trianglUpOffset(ctx, size / 2, x, y, offset);
15283
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15269
15284
  }
15270
15285
  }
15271
15286
  var triangleUp = new TriangleUpSymbol();
@@ -15297,10 +15312,10 @@ class StarSymbol extends BaseSymbol {
15297
15312
  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";
15298
15313
  }
15299
15314
  draw(ctx, size, transX, transY) {
15300
- return star(ctx, size / 2, transX, transY);
15315
+ return star(ctx, this.parseSize(size) / 2, transX, transY);
15301
15316
  }
15302
15317
  drawOffset(ctx, size, transX, transY, offset) {
15303
- return star(ctx, size / 2 + offset, transX, transY);
15318
+ return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15304
15319
  }
15305
15320
  }
15306
15321
  var star$1 = new StarSymbol();
@@ -15318,10 +15333,10 @@ class ArrowSymbol extends BaseSymbol {
15318
15333
  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";
15319
15334
  }
15320
15335
  draw(ctx, size, transX, transY) {
15321
- return arrow(ctx, size / 2, transX, transY);
15336
+ return arrow(ctx, this.parseSize(size) / 2, transX, transY);
15322
15337
  }
15323
15338
  drawOffset(ctx, size, transX, transY, offset) {
15324
- return arrow(ctx, size / 2 + offset, transX, transY);
15339
+ return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15325
15340
  }
15326
15341
  }
15327
15342
  var arrow$1 = new ArrowSymbol();
@@ -15335,10 +15350,10 @@ class WedgeSymbol extends BaseSymbol {
15335
15350
  super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
15336
15351
  }
15337
15352
  draw(ctx, size, transX, transY) {
15338
- return wedge(ctx, size / 2, transX, transY);
15353
+ return wedge(ctx, this.parseSize(size) / 2, transX, transY);
15339
15354
  }
15340
15355
  drawOffset(ctx, size, transX, transY, offset) {
15341
- return wedge(ctx, size / 2 + offset, transX, transY);
15356
+ return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15342
15357
  }
15343
15358
  }
15344
15359
  var wedge$1 = new WedgeSymbol();
@@ -15351,10 +15366,10 @@ class StrokeSymbol extends BaseSymbol {
15351
15366
  super(...arguments), this.type = "stroke", this.pathStr = "";
15352
15367
  }
15353
15368
  draw(ctx, size, transX, transY) {
15354
- return stroke(ctx, size / 2, transX, transY);
15369
+ return stroke(ctx, this.parseSize(size) / 2, transX, transY);
15355
15370
  }
15356
15371
  drawOffset(ctx, size, transX, transY, offset) {
15357
- return stroke(ctx, size / 2 + offset, transX, transY);
15372
+ return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15358
15373
  }
15359
15374
  }
15360
15375
  var stroke$1 = new StrokeSymbol();
@@ -15376,10 +15391,10 @@ class WyeSymbol extends BaseSymbol {
15376
15391
  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";
15377
15392
  }
15378
15393
  draw(ctx, size, transX, transY) {
15379
- return wye(ctx, size / 2, transX, transY);
15394
+ return wye(ctx, this.parseSize(size) / 2, transX, transY);
15380
15395
  }
15381
15396
  drawOffset(ctx, size, transX, transY, offset) {
15382
- return wye(ctx, size / 2 + offset, transX, transY);
15397
+ return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15383
15398
  }
15384
15399
  }
15385
15400
  var wye$1 = new WyeSymbol();
@@ -15392,10 +15407,10 @@ class TriangleLeftSymbol extends BaseSymbol {
15392
15407
  super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
15393
15408
  }
15394
15409
  draw(ctx, size, x, y) {
15395
- return trianglLeftOffset(ctx, size / 2, x, y, 0);
15410
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
15396
15411
  }
15397
15412
  drawOffset(ctx, size, x, y, offset) {
15398
- return trianglLeftOffset(ctx, size / 2, x, y, offset);
15413
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15399
15414
  }
15400
15415
  }
15401
15416
  var triangleLeft = new TriangleLeftSymbol();
@@ -15409,10 +15424,10 @@ class TriangleRightSymbol extends BaseSymbol {
15409
15424
  super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
15410
15425
  }
15411
15426
  draw(ctx, size, x, y) {
15412
- return trianglRightOffset(ctx, size / 2, x, y);
15427
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
15413
15428
  }
15414
15429
  drawOffset(ctx, size, x, y, offset) {
15415
- return trianglRightOffset(ctx, size / 2, x, y, offset);
15430
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15416
15431
  }
15417
15432
  }
15418
15433
  var triangleRight = new TriangleRightSymbol();
@@ -15426,10 +15441,10 @@ class TriangleDownSymbol extends BaseSymbol {
15426
15441
  super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
15427
15442
  }
15428
15443
  draw(ctx, size, x, y) {
15429
- return trianglDownOffset(ctx, size / 2, x, y);
15444
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
15430
15445
  }
15431
15446
  drawOffset(ctx, size, x, y, offset) {
15432
- return trianglDownOffset(ctx, size / 2, x, y, offset);
15447
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15433
15448
  }
15434
15449
  }
15435
15450
  var triangleDown = new TriangleDownSymbol();
@@ -15444,10 +15459,10 @@ class ThinTriangleSymbol extends BaseSymbol {
15444
15459
  super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
15445
15460
  }
15446
15461
  draw(ctx, size, x, y) {
15447
- return thinTriangle(ctx, size / 2 / sqrt3, x, y);
15462
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
15448
15463
  }
15449
15464
  drawOffset(ctx, size, x, y, offset) {
15450
- return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
15465
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
15451
15466
  }
15452
15467
  }
15453
15468
  var thinTriangle$1 = new ThinTriangleSymbol();
@@ -15461,10 +15476,10 @@ class Arrow2LeftSymbol extends BaseSymbol {
15461
15476
  super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
15462
15477
  }
15463
15478
  draw(ctx, size, transX, transY) {
15464
- return arrow2Left(ctx, size / 4, transX, transY);
15479
+ return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
15465
15480
  }
15466
15481
  drawOffset(ctx, size, transX, transY, offset) {
15467
- return arrow2Left(ctx, size / 4 + offset, transX, transY);
15482
+ return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15468
15483
  }
15469
15484
  }
15470
15485
  var arrow2Left$1 = new Arrow2LeftSymbol();
@@ -15478,10 +15493,10 @@ class Arrow2RightSymbol extends BaseSymbol {
15478
15493
  super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
15479
15494
  }
15480
15495
  draw(ctx, size, transX, transY) {
15481
- return arrow2Right(ctx, size / 4, transX, transY);
15496
+ return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
15482
15497
  }
15483
15498
  drawOffset(ctx, size, transX, transY, offset) {
15484
- return arrow2Right(ctx, size / 4 + offset, transX, transY);
15499
+ return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15485
15500
  }
15486
15501
  }
15487
15502
  var arrow2Right$1 = new Arrow2RightSymbol();
@@ -15495,10 +15510,10 @@ class Arrow2UpSymbol extends BaseSymbol {
15495
15510
  super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
15496
15511
  }
15497
15512
  draw(ctx, size, transX, transY) {
15498
- return arrow2Up(ctx, size / 4, transX, transY);
15513
+ return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
15499
15514
  }
15500
15515
  drawOffset(ctx, size, transX, transY, offset) {
15501
- return arrow2Up(ctx, size / 4 + offset, transX, transY);
15516
+ return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15502
15517
  }
15503
15518
  }
15504
15519
  var arrow2Up$1 = new Arrow2UpSymbol();
@@ -15512,10 +15527,10 @@ class Arrow2DownSymbol extends BaseSymbol {
15512
15527
  super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
15513
15528
  }
15514
15529
  draw(ctx, size, transX, transY) {
15515
- return arrow2Down(ctx, size / 4, transX, transY);
15530
+ return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
15516
15531
  }
15517
15532
  drawOffset(ctx, size, transX, transY, offset) {
15518
- return arrow2Down(ctx, size / 4 + offset, transX, transY);
15533
+ return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15519
15534
  }
15520
15535
  }
15521
15536
  var arrow2Down$1 = new Arrow2DownSymbol();
@@ -15528,13 +15543,13 @@ class LineVSymbol extends BaseSymbol {
15528
15543
  super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
15529
15544
  }
15530
15545
  draw(ctx, size, x, y, z) {
15531
- return lineV(ctx, size / 2, x, y);
15546
+ return lineV(ctx, this.parseSize(size) / 2, x, y);
15532
15547
  }
15533
15548
  drawOffset(ctx, size, x, y, offset, z) {
15534
- return lineV(ctx, size / 2 + offset, x, y);
15549
+ return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
15535
15550
  }
15536
15551
  drawToSvgPath(size, x, y, z) {
15537
- const r = size / 2;
15552
+ const r = this.parseSize(size) / 2;
15538
15553
  return `M ${x}, ${y - r} L ${x},${y + r}`;
15539
15554
  }
15540
15555
  }
@@ -15548,13 +15563,13 @@ class LineHSymbol extends BaseSymbol {
15548
15563
  super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
15549
15564
  }
15550
15565
  draw(ctx, size, x, y, z) {
15551
- return lineH(ctx, size / 2, x, y);
15566
+ return lineH(ctx, this.parseSize(size) / 2, x, y);
15552
15567
  }
15553
15568
  drawOffset(ctx, size, x, y, offset, z) {
15554
- return lineH(ctx, size / 2 + offset, x, y);
15569
+ return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
15555
15570
  }
15556
15571
  drawToSvgPath(size, x, y, z) {
15557
- const r = size / 2;
15572
+ const r = this.parseSize(size) / 2;
15558
15573
  return `M ${x - r}, ${y} L ${x + r},${y}`;
15559
15574
  }
15560
15575
  }
@@ -15568,13 +15583,13 @@ class CloseSymbol extends BaseSymbol {
15568
15583
  super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
15569
15584
  }
15570
15585
  draw(ctx, size, x, y, z) {
15571
- return close(ctx, size / 2, x, y);
15586
+ return close(ctx, this.parseSize(size) / 2, x, y);
15572
15587
  }
15573
15588
  drawOffset(ctx, size, x, y, offset, z) {
15574
- return close(ctx, size / 2 + offset, x, y);
15589
+ return close(ctx, this.parseSize(size) / 2 + offset, x, y);
15575
15590
  }
15576
15591
  drawToSvgPath(size, x, y, z) {
15577
- const r = size / 2;
15592
+ const r = this.parseSize(size) / 2;
15578
15593
  return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
15579
15594
  }
15580
15595
  }
@@ -15608,15 +15623,18 @@ class CustomSymbolClass {
15608
15623
  this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
15609
15624
  }
15610
15625
  drawOffset(ctx, size, x, y, offset, z, cb) {
15611
- return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
15626
+ return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
15612
15627
  ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
15613
15628
  }), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
15614
15629
  }
15615
15630
  draw(ctx, size, x, y, z, cb) {
15616
- return this.drawOffset(ctx, size, x, y, 0, z, cb);
15631
+ return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
15632
+ }
15633
+ parseSize(size) {
15634
+ return isNumber$1(size) ? size : Math.min(size[0], size[1]);
15617
15635
  }
15618
15636
  bounds(size, bounds) {
15619
- if (this.isSvg) {
15637
+ if (size = this.parseSize(size), this.isSvg) {
15620
15638
  if (!this.svgCache) return;
15621
15639
  return bounds.clear(), void this.svgCache.forEach(_ref => {
15622
15640
  let {
@@ -16299,7 +16317,11 @@ class Paragraph {
16299
16317
  case "sub":
16300
16318
  baseline += this.descent / 2;
16301
16319
  }
16302
- "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();
16320
+ "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);
16321
+ const {
16322
+ lineWidth = 1
16323
+ } = this.character;
16324
+ 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();
16303
16325
  }
16304
16326
  getWidthWithEllips(direction) {
16305
16327
  let text = this.text;
@@ -18516,7 +18538,7 @@ class Stage extends Group {
18516
18538
  constructor() {
18517
18539
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18518
18540
  var _a;
18519
- super({}), this._onVisibleChange = visible => {
18541
+ super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
18520
18542
  if (!(this._skipRender < 0)) if (visible) {
18521
18543
  if (this.dirtyBounds) {
18522
18544
  const b = this.window.getViewBox();
@@ -18527,7 +18549,10 @@ class Stage extends Group {
18527
18549
  }, this.beforeRender = stage => {
18528
18550
  this._beforeRender && this._beforeRender(stage);
18529
18551
  }, this.afterRender = stage => {
18530
- this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null;
18552
+ this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
18553
+ }, this.afterTickCb = () => {
18554
+ var _a;
18555
+ this.tickedBeforeRender = !0, "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) || "rendering" !== this.state && this.render();
18531
18556
  }, this.params = params, this.theme = new Theme(), this.hooks = {
18532
18557
  beforeRender: new SyncHook(["stage"]),
18533
18558
  afterRender: new SyncHook(["stage"])
@@ -18544,7 +18569,7 @@ class Stage extends Group {
18544
18569
  main: !0
18545
18570
  })), 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({
18546
18571
  background: this._background
18547
- });
18572
+ }), this.ticker.on("afterTick", this.afterTickCb);
18548
18573
  }
18549
18574
  pauseRender() {
18550
18575
  let sr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
@@ -18773,7 +18798,7 @@ class Stage extends Group {
18773
18798
  if ("released" === this.releaseStatus) return;
18774
18799
  this.ticker.start(), this.timeline.resume();
18775
18800
  const state = this.state;
18776
- 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++;
18801
+ 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++;
18777
18802
  }
18778
18803
  combineLayersToWindow() {
18779
18804
  if ("harmony" === this.global.env) {
@@ -18879,7 +18904,7 @@ class Stage extends Group {
18879
18904
  layer.release();
18880
18905
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
18881
18906
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
18882
- }), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.renderService.renderTreeRoots = [];
18907
+ }), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.ticker.removeListener("afterTick", this.afterTickCb), this.renderService.renderTreeRoots = [];
18883
18908
  }
18884
18909
  setStage(stage) {}
18885
18910
  dirty(b, matrix) {
@@ -23858,7 +23883,7 @@ class Gesture extends EventEmitter {
23858
23883
  startTime: startTime,
23859
23884
  startPoints: startPoints
23860
23885
  } = this;
23861
- if (eventType) return eventType;
23886
+ if ("press" === eventType) return eventType;
23862
23887
  let type;
23863
23888
  return type = clock.now() - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold ? "press" : "pan", this.eventType = type, type;
23864
23889
  }
@@ -24390,9 +24415,10 @@ let BrowserContext2d = class {
24390
24415
  lineJoin = defaultParams.lineJoin,
24391
24416
  lineDash = defaultParams.lineDash,
24392
24417
  lineCap = defaultParams.lineCap,
24393
- miterLimit = defaultParams.miterLimit
24418
+ miterLimit = defaultParams.miterLimit,
24419
+ keepStrokeScale = defaultParams.keepStrokeScale
24394
24420
  } = attribute;
24395
- _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;
24421
+ _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;
24396
24422
  }
24397
24423
  }
24398
24424
  setTextStyleWithoutAlignBaseline(params, defaultParams, z) {
@@ -25292,8 +25318,9 @@ class PickerBase {
25292
25318
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, (context, arcAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, arcAttribute, themeAttribute) => {
25293
25319
  if (picked) return !0;
25294
25320
  const lineWidth = arcAttribute.lineWidth || themeAttribute.lineWidth,
25295
- pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
25296
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25321
+ pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
25322
+ keepStrokeScale = arcAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
25323
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25297
25324
  }), pickContext.highPerformanceRestore(), picked;
25298
25325
  }
25299
25326
  }
@@ -25566,8 +25593,9 @@ class RectPickerBase {
25566
25593
  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) => {
25567
25594
  if (picked) return !0;
25568
25595
  const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
25569
- pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
25570
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25596
+ pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
25597
+ keepStrokeScale = rectAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
25598
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25571
25599
  });else {
25572
25600
  const {
25573
25601
  fill = rectAttribute.fill,
@@ -25881,9 +25909,10 @@ let LynxContext2d = class extends BrowserContext2d {
25881
25909
  lineJoin = defaultParams.lineJoin,
25882
25910
  lineDash = defaultParams.lineDash,
25883
25911
  lineCap = defaultParams.lineCap,
25884
- miterLimit = defaultParams.miterLimit
25912
+ miterLimit = defaultParams.miterLimit,
25913
+ keepStrokeScale = defaultParams.keepStrokeScale
25885
25914
  } = attribute;
25886
- _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;
25915
+ _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;
25887
25916
  }
25888
25917
  }
25889
25918
  measureText(text) {
@@ -26511,9 +26540,10 @@ let TaroContext2d = class extends BrowserContext2d {
26511
26540
  lineJoin = defaultParams.lineJoin,
26512
26541
  lineDash = defaultParams.lineDash,
26513
26542
  lineCap = defaultParams.lineCap,
26514
- miterLimit = defaultParams.miterLimit
26543
+ miterLimit = defaultParams.miterLimit,
26544
+ keepStrokeScale = defaultParams.keepStrokeScale
26515
26545
  } = attribute;
26516
- _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);
26546
+ _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);
26517
26547
  }
26518
26548
  }
26519
26549
  setTextStyleWithoutAlignBaseline(params, defaultParams) {
@@ -27553,9 +27583,10 @@ let HarmonyContext2d = class extends BrowserContext2d {
27553
27583
  lineJoin = defaultParams.lineJoin,
27554
27584
  lineDash = defaultParams.lineDash,
27555
27585
  lineCap = defaultParams.lineCap,
27556
- miterLimit = defaultParams.miterLimit
27586
+ miterLimit = defaultParams.miterLimit,
27587
+ keepStrokeScale = defaultParams.keepStrokeScale
27557
27588
  } = attribute;
27558
- _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;
27589
+ _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;
27559
27590
  }
27560
27591
  }
27561
27592
  measureText(text) {
@@ -27962,8 +27993,9 @@ class BaseLinePicker extends BaseRender {
27962
27993
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, context => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, lineAttribute, themeAttribute) => {
27963
27994
  if (picked) return !0;
27964
27995
  const lineWidth = lineAttribute.lineWidth || themeAttribute.lineWidth,
27965
- pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
27966
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
27996
+ pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
27997
+ keepStrokeScale = lineAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
27998
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
27967
27999
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
27968
28000
  }
27969
28001
  }
@@ -28098,8 +28130,9 @@ let DefaultCanvasSymbolPicker = class extends Base3dPicker {
28098
28130
  return this.canvasRenderer.drawShape(symbol, pickContext, x, y, {}, null, (context, symbolAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, symbolAttribute, themeAttribute) => {
28099
28131
  if (picked) return !0;
28100
28132
  const lineWidth = symbolAttribute.lineWidth || themeAttribute.lineWidth,
28101
- pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
28102
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
28133
+ pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
28134
+ keepStrokeScale = symbolAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
28135
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
28103
28136
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
28104
28137
  }
28105
28138
  };
@@ -28193,8 +28226,10 @@ let DefaultCanvasTextPicker = class extends Base3dPicker {
28193
28226
  } = text.attribute,
28194
28227
  bounds = text.AABBBounds,
28195
28228
  height = bounds.height(),
28196
- width = bounds.width();
28197
- return context.rect(bounds.x1, bounds.y1, width, height, z), picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked;
28229
+ width = bounds.width(),
28230
+ offsetY = textLayoutOffsetY(textBaseline, height, fontSize),
28231
+ offsetX = textDrawOffsetX(textAlign, width);
28232
+ return context.rect(offsetX + x, offsetY + y, width, height, z), picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked;
28198
28233
  }, (context, symbolAttribute, themeAttribute) => picked), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
28199
28234
  }
28200
28235
  };
@@ -28534,7 +28569,7 @@ const registerWrapText = _registerWrapText;
28534
28569
 
28535
28570
  const roughModule = _roughModule;
28536
28571
 
28537
- const version = "0.21.0-alpha.3";
28572
+ const version = "0.21.0-alpha.5";
28538
28573
  preLoadAllModule();
28539
28574
  if (isBrowserEnv()) {
28540
28575
  loadBrowserEnv(container);