@visactor/vrender 0.21.0-alpha.1 → 0.21.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -748,6 +748,13 @@
748
748
  };
749
749
  exports.DefaultGlobal = __decorate$1H([injectable(), __param$T(0, inject(ContributionProvider)), __param$T(0, named(EnvContribution)), __metadata$1h("design:paramtypes", [Object])], exports.DefaultGlobal);
750
750
 
751
+ exports.MeasureModeEnum = void 0;
752
+ !function (MeasureModeEnum) {
753
+ MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
754
+ }(exports.MeasureModeEnum || (exports.MeasureModeEnum = {}));
755
+
756
+ const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
757
+
751
758
  function getDefaultExportFromCjs (x) {
752
759
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
753
760
  }
@@ -1702,7 +1709,9 @@
1702
1709
  } = this.textSpec;
1703
1710
  return {
1704
1711
  width: metrics.width,
1705
- height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
1712
+ height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize,
1713
+ fontBoundingBoxAscent: metrics.fontBoundingBoxAscent,
1714
+ fontBoundingBoxDescent: metrics.fontBoundingBoxDescent
1706
1715
  };
1707
1716
  }
1708
1717
  quickMeasure(text) {
@@ -1716,7 +1725,7 @@
1716
1725
  for (let i = 0; i < text.length; i++) {
1717
1726
  const char = text[i];
1718
1727
  let size = this._measureSpecialChar(char);
1719
- isNil$1(size) && TextMeasure.NUMBERS_CHAR_SET.includes(char) && (size = this._measureNumberChar()), isNil$1(size) && ["F", "W"].includes(eastAsianCharacterInfo(char)) && (size = this._measureFullSizeChar()), isNil$1(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height);
1728
+ isNil$1(size) && TextMeasure.NUMBERS_CHAR_SET.includes(char) && (size = this._measureNumberChar()), isNil$1(size) && ["F", "W"].includes(eastAsianCharacterInfo(char)) && (size = this._measureFullSizeChar()), isNil$1(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height), !isNil$1(size.fontBoundingBoxAscent) && (totalSize.fontBoundingBoxAscent = size.fontBoundingBoxAscent), !isNil$1(size.fontBoundingBoxDescent) && (totalSize.fontBoundingBoxDescent = size.fontBoundingBoxDescent);
1720
1729
  }
1721
1730
  return totalSize;
1722
1731
  }
@@ -1765,7 +1774,9 @@
1765
1774
  const numberBounds = this._standardMethod(TextMeasure.NUMBERS_CHAR_SET);
1766
1775
  this._numberCharSize = {
1767
1776
  width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length,
1768
- height: numberBounds.height
1777
+ height: numberBounds.height,
1778
+ fontBoundingBoxAscent: numberBounds.fontBoundingBoxAscent,
1779
+ fontBoundingBoxDescent: numberBounds.fontBoundingBoxDescent
1769
1780
  };
1770
1781
  }
1771
1782
  return this._numberCharSize;
@@ -1778,7 +1789,9 @@
1778
1789
  const alphabetBounds = this._standardMethod(TextMeasure.ALPHABET_CHAR_SET);
1779
1790
  this._letterCharSize = {
1780
1791
  width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length,
1781
- height: alphabetBounds.height
1792
+ height: alphabetBounds.height,
1793
+ fontBoundingBoxAscent: alphabetBounds.fontBoundingBoxAscent,
1794
+ fontBoundingBoxDescent: alphabetBounds.fontBoundingBoxDescent
1782
1795
  };
1783
1796
  }
1784
1797
  return this._letterCharSize;
@@ -2732,11 +2745,12 @@
2732
2745
  for (let i = 0, len = paths.length; i < len; i++) if (currPath = paths[i], coordsStr = currPath.slice(1), commandChar = currPath[0], currCommandData = [commandChar], coordsStrArr = coordsStr.match(rePathCommand), null !== coordsStrArr) {
2733
2746
  for (let i = 0, len = coordsStrArr.length; i < len; i++) coordStr = coordsStrArr[i], coordNumber = parseFloat(coordStr), Number.isNaN(coordNumber) || currCommandData.push(coordNumber);
2734
2747
  if (standardCommandLen = commandLengths[commandChar], currCommandData.length - 1 > standardCommandLen) {
2735
- let subCommand;
2748
+ let subCommand,
2749
+ bestCommandChar = commandChar;
2736
2750
  for (let i = 1, len = currCommandData.length; i < len; i += standardCommandLen) {
2737
- subCommand = [commandChar];
2751
+ subCommand = [bestCommandChar];
2738
2752
  for (let j = i, subLen = i + standardCommandLen; j < subLen; j++) subCommand.push(currCommandData[j]);
2739
- result.push(subCommand);
2753
+ result.push(subCommand), "m" === bestCommandChar ? bestCommandChar = "l" : "M" === bestCommandChar && (bestCommandChar = "L");
2740
2754
  }
2741
2755
  } else result.push(currCommandData);
2742
2756
  } else result.push(currCommandData);
@@ -3918,6 +3932,7 @@
3918
3932
  const DefaultTextStyle = {
3919
3933
  text: "",
3920
3934
  maxLineWidth: 1 / 0,
3935
+ maxWidth: 1 / 0,
3921
3936
  textAlign: "left",
3922
3937
  textBaseline: "alphabetic",
3923
3938
  fontSize: 16,
@@ -3941,7 +3956,8 @@
3941
3956
  suffixPosition: "end",
3942
3957
  underlineDash: [],
3943
3958
  underlineOffset: 0,
3944
- disableAutoClipedPoptip: void 0
3959
+ disableAutoClipedPoptip: void 0,
3960
+ measureMode: exports.MeasureModeEnum.fontBounding
3945
3961
  };
3946
3962
  const DefaultPickStyle = {
3947
3963
  pickStrokeBuffer: 0
@@ -3985,6 +4001,7 @@
3985
4001
  zIndex: 0,
3986
4002
  layout: null,
3987
4003
  boundsPadding: 0,
4004
+ fillStrokeOrder: 0,
3988
4005
  renderStyle: "default",
3989
4006
  pickMode: "accurate",
3990
4007
  customPickShape: null,
@@ -3994,7 +4011,8 @@
3994
4011
  globalZIndex: 1,
3995
4012
  globalCompositeOperation: "",
3996
4013
  overflow: "hidden",
3997
- shadowPickMode: "graphic"
4014
+ shadowPickMode: "graphic",
4015
+ keepStrokeScale: !1
3998
4016
  }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
3999
4017
  function addAttributeToPrototype(obj, c, keys) {
4000
4018
  keys.forEach(key => {
@@ -4063,6 +4081,7 @@
4063
4081
  });
4064
4082
  const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4065
4083
  path: new CustomPath2D(),
4084
+ fillStrokeOrder: 1,
4066
4085
  customPath: () => {
4067
4086
  Logger.getInstance().warn("空函数");
4068
4087
  }
@@ -4268,10 +4287,32 @@
4268
4287
  configure(service, env) {
4269
4288
  this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
4270
4289
  }
4271
- measureTextWidth(text, options) {
4272
- if (!this.context) return this.estimate(text, options).width;
4290
+ _measureTextWithoutAlignBaseline(text, options, compatible) {
4273
4291
  this.context.setTextStyleWithoutAlignBaseline(options);
4274
- return this.context.measureText(text).width;
4292
+ const metrics = this.context.measureText(text);
4293
+ return compatible ? this.compatibleMetrics(metrics, options) : metrics;
4294
+ }
4295
+ _measureTextWithAlignBaseline(text, options, compatible) {
4296
+ this.context.setTextStyle(options);
4297
+ const metrics = this.context.measureText(text);
4298
+ return compatible ? this.compatibleMetrics(metrics, options) : metrics;
4299
+ }
4300
+ compatibleMetrics(metrics, options) {
4301
+ if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
4302
+ const {
4303
+ ascent: ascent,
4304
+ descent: descent
4305
+ } = this.measureTextBoundADscentEstimate(options);
4306
+ metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
4307
+ }
4308
+ if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
4309
+ const {
4310
+ left: left,
4311
+ right: right
4312
+ } = this.measureTextBoundLeftRightEstimate(options);
4313
+ metrics.actualBoundingBoxLeft = left, metrics.actualBoundingBoxRight = right;
4314
+ }
4315
+ return metrics;
4275
4316
  }
4276
4317
  estimate(text, _ref) {
4277
4318
  let {
@@ -4285,19 +4326,97 @@
4285
4326
  height: fontSize
4286
4327
  };
4287
4328
  }
4288
- measureTextPixelHeight(text, options) {
4329
+ measureTextWidth(text, options, textMeasure) {
4330
+ return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
4331
+ }
4332
+ measureTextBoundsWidth(text, options, textMeasure) {
4333
+ return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
4334
+ }
4335
+ measureTextBoundsLeftRight(text, options, textMeasure) {
4336
+ return this.context ? {
4337
+ left: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxLeft,
4338
+ right: textMeasure.actualBoundingBoxRight
4339
+ } : this.measureTextBoundLeftRightEstimate(options);
4340
+ }
4341
+ measureTextPixelHeight(text, options, textMeasure) {
4289
4342
  var _a;
4290
- if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4291
- this.context.setTextStyleWithoutAlignBaseline(options);
4292
- const textMeasure = this.context.measureText(text);
4293
- return Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent);
4343
+ return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options, !0), Math.abs(textMeasure.actualBoundingBoxAscent - textMeasure.actualBoundingBoxDescent)) : null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4294
4344
  }
4295
- measureTextBoundHieght(text, options) {
4345
+ measureTextPixelADscent(text, options, textMeasure) {
4346
+ return this.context ? {
4347
+ ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxAscent,
4348
+ descent: textMeasure.actualBoundingBoxDescent
4349
+ } : this.measureTextBoundADscentEstimate(options);
4350
+ }
4351
+ measureTextBoundHieght(text, options, textMeasure) {
4296
4352
  var _a;
4297
- if (!this.context) return null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4298
- this.context.setTextStyleWithoutAlignBaseline(options);
4299
- const textMeasure = this.context.measureText(text);
4300
- return Math.abs(textMeasure.fontBoundingBoxAscent - textMeasure.fontBoundingBoxDescent);
4353
+ return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options, !0), Math.abs(textMeasure.fontBoundingBoxAscent - textMeasure.fontBoundingBoxDescent)) : null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4354
+ }
4355
+ measureTextBoundADscent(text, options, textMeasure) {
4356
+ return this.context ? {
4357
+ ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).fontBoundingBoxAscent,
4358
+ descent: textMeasure.fontBoundingBoxDescent
4359
+ } : this.measureTextBoundADscentEstimate(options);
4360
+ }
4361
+ measureTextBoundADscentEstimate(options) {
4362
+ var _a;
4363
+ const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4364
+ return {
4365
+ ascent: .79 * fontSize,
4366
+ descent: .21 * fontSize
4367
+ };
4368
+ }
4369
+ measureTextBoundLeftRightEstimate(options) {
4370
+ var _a;
4371
+ const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize,
4372
+ {
4373
+ textAlign: textAlign
4374
+ } = options;
4375
+ return "center" === textAlign ? {
4376
+ left: fontSize / 2,
4377
+ right: fontSize / 2
4378
+ } : "right" === textAlign || "end" === textAlign ? {
4379
+ left: fontSize,
4380
+ right: 0
4381
+ } : {
4382
+ left: 0,
4383
+ right: fontSize
4384
+ };
4385
+ }
4386
+ measureTextPixelADscentAndWidth(text, options, mode) {
4387
+ if (!this.context) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4388
+ width: this.estimate(text, options).width
4389
+ });
4390
+ const out = this._measureTextWithoutAlignBaseline(text, options, !0);
4391
+ if (mode === exports.MeasureModeEnum.actualBounding) return {
4392
+ ascent: out.actualBoundingBoxAscent,
4393
+ descent: out.actualBoundingBoxDescent,
4394
+ width: out.width
4395
+ };
4396
+ if (mode === exports.MeasureModeEnum.estimate) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4397
+ width: out.width
4398
+ });
4399
+ if (mode === exports.MeasureModeEnum.fontBounding) {
4400
+ let ascent = out.fontBoundingBoxAscent,
4401
+ descent = out.fontBoundingBoxDescent;
4402
+ if (out.actualBoundingBoxDescent && descent < out.actualBoundingBoxDescent) {
4403
+ const delta = out.actualBoundingBoxDescent - descent;
4404
+ descent += delta, ascent -= delta;
4405
+ } else if (out.actualBoundingBoxAscent && ascent < out.actualBoundingBoxAscent) {
4406
+ const delta = out.actualBoundingBoxAscent - ascent;
4407
+ ascent += delta, descent -= delta;
4408
+ }
4409
+ return {
4410
+ ascent: ascent,
4411
+ descent: descent,
4412
+ width: out.width
4413
+ };
4414
+ }
4415
+ return {
4416
+ ascent: out.actualBoundingBoxAscent,
4417
+ descent: out.actualBoundingBoxDescent,
4418
+ width: out.width
4419
+ };
4301
4420
  }
4302
4421
  measureText(text, options) {
4303
4422
  return this.context ? (this.context.setTextStyleWithoutAlignBaseline(options), this.context.measureText(text)) : this.estimate(text, options);
@@ -4375,6 +4494,14 @@
4375
4494
  return data;
4376
4495
  }
4377
4496
  _clipTextEnd(text, options, width, leftIdx, rightIdx) {
4497
+ if (leftIdx === rightIdx) {
4498
+ Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${text}, ${leftIdx}, ${rightIdx}`);
4499
+ const subText = text.substring(0, rightIdx + 1);
4500
+ return {
4501
+ str: subText,
4502
+ width: this.measureTextWidth(subText, options)
4503
+ };
4504
+ }
4378
4505
  const middleIdx = Math.floor((leftIdx + rightIdx) / 2),
4379
4506
  subText = text.substring(0, middleIdx + 1),
4380
4507
  strWidth = this.measureTextWidth(subText, options);
@@ -4408,7 +4535,7 @@
4408
4535
  }
4409
4536
  _clipTextStart(text, options, width, leftIdx, rightIdx) {
4410
4537
  const middleIdx = Math.ceil((leftIdx + rightIdx) / 2),
4411
- subText = text.substring(middleIdx - 1, text.length - 1),
4538
+ subText = text.substring(middleIdx - 1, text.length),
4412
4539
  strWidth = this.measureTextWidth(subText, options);
4413
4540
  let length;
4414
4541
  if (strWidth > width) {
@@ -4416,18 +4543,18 @@
4416
4543
  str: "",
4417
4544
  width: 0
4418
4545
  };
4419
- const str = text.substring(middleIdx, text.length - 1);
4546
+ const str = text.substring(middleIdx, text.length);
4420
4547
  return length = this.measureTextWidth(str, options), length <= width ? {
4421
4548
  str: str,
4422
4549
  width: length
4423
- } : this._clipTextStart(text, options, width, middleIdx, text.length - 1);
4550
+ } : this._clipTextStart(text, options, width, middleIdx, text.length);
4424
4551
  }
4425
4552
  if (strWidth < width) {
4426
4553
  if (middleIdx <= 0) return {
4427
4554
  str: text,
4428
4555
  width: this.measureTextWidth(text, options)
4429
4556
  };
4430
- const str = text.substring(middleIdx - 2, text.length - 1);
4557
+ const str = text.substring(middleIdx - 2, text.length);
4431
4558
  return length = this.measureTextWidth(str, options), length >= width ? {
4432
4559
  str: subText,
4433
4560
  width: strWidth
@@ -5088,7 +5215,7 @@
5088
5215
  }
5089
5216
  hasSubView() {
5090
5217
  const viewBox = this._handler.getViewBox();
5091
- return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
5218
+ return !(0 === viewBox.x1 && 0 === viewBox.y1 && isNumberClose(this.width, viewBox.width()) && isNumberClose(this.height, viewBox.height()));
5092
5219
  }
5093
5220
  isVisible(bbox) {
5094
5221
  return this._handler.isVisible(bbox);
@@ -6012,7 +6139,7 @@
6012
6139
  timeStamp: now
6013
6140
  });
6014
6141
  const clickHistory = trackingData.clicksByButton[from.button];
6015
- clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < (null !== (_a = this._config.clickInterval) && void 0 !== _a ? _a : 200) ? ++clickHistory.clickCount : clickHistory.clickCount = 1, clickHistory.target = clickEvent.target, clickHistory.timeStamp = now, clickEvent.detail = clickHistory.clickCount, isMouseLike(clickEvent.pointerType) ? (this.dispatchEvent(clickEvent, "click"), 2 === clickHistory.clickCount && this.dispatchEvent(clickEvent, "dblclick")) : "touch" === clickEvent.pointerType && (this.dispatchEvent(clickEvent, "tap"), 2 === clickHistory.clickCount && this.dispatchEvent(clickEvent, "dbltap")), this.dispatchEvent(clickEvent, "pointertap"), this.freeEvent(clickEvent);
6142
+ clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < (null !== (_a = this._config.clickInterval) && void 0 !== _a ? _a : 200) ? ++clickHistory.clickCount : clickHistory.clickCount = 1, clickHistory.target = clickEvent.target, clickHistory.timeStamp = now, clickEvent.detail = clickHistory.clickCount, isMouseLike(clickEvent.pointerType) ? (this.dispatchEvent(clickEvent, "click"), 2 === clickHistory.clickCount && this.dispatchEvent(clickEvent, "dblclick")) : "touch" === clickEvent.pointerType && this._config.supportsTouchEvents && (this.dispatchEvent(clickEvent, "tap"), 2 === clickHistory.clickCount && this.dispatchEvent(clickEvent, "dbltap")), this.dispatchEvent(clickEvent, "pointertap"), this.freeEvent(clickEvent);
6016
6143
  }
6017
6144
  this.freeEvent(e);
6018
6145
  }, this.onPointerUpOutside = (from, target) => {
@@ -6229,7 +6356,8 @@
6229
6356
  supportsPointerEvents = global.supportsPointerEvents
6230
6357
  } = params;
6231
6358
  this.manager = new EventManager(rootNode, {
6232
- clickInterval: clickInterval
6359
+ clickInterval: clickInterval,
6360
+ supportsTouchEvents: supportsTouchEvents
6233
6361
  }), this.globalObj = global, this.supportsPointerEvents = supportsPointerEvents, this.supportsTouchEvents = supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
6234
6362
  default: "inherit",
6235
6363
  pointer: "pointer"
@@ -6400,7 +6528,7 @@
6400
6528
  }
6401
6529
  }
6402
6530
 
6403
- class DefaultTicker {
6531
+ class DefaultTicker extends EventEmitter {
6404
6532
  set mode(m) {
6405
6533
  this._mode !== m && (this._mode = m, this.setupTickHandler());
6406
6534
  }
@@ -6409,17 +6537,17 @@
6409
6537
  }
6410
6538
  constructor() {
6411
6539
  let timelines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6412
- this.handleTick = (handler, params) => {
6540
+ super(), this.handleTick = (handler, params) => {
6413
6541
  const {
6414
6542
  once = !1
6415
6543
  } = null != params ? params : {};
6416
- this.ifCanStop() ? this.stop() : (this._handlerTick(handler), once || handler.tick(this.interval, this.handleTick));
6417
- }, this._handlerTick = handler => {
6544
+ this.ifCanStop() ? this.stop() : (this._handlerTick(), once || handler.tick(this.interval, this.handleTick));
6545
+ }, this._handlerTick = () => {
6418
6546
  const time = this.tickerHandler.getTime();
6419
6547
  let delta = 0;
6420
6548
  this.lastFrameTime >= 0 && (delta = time - this.lastFrameTime), this.lastFrameTime = time, this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(t => {
6421
6549
  t.tick(delta);
6422
- }));
6550
+ }), this.emit("afterTick"));
6423
6551
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.timelines = timelines, this.autoStop = !0;
6424
6552
  }
6425
6553
  init() {
@@ -6515,6 +6643,9 @@
6515
6643
  stop() {
6516
6644
  this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
6517
6645
  }
6646
+ trySyncTickStatus() {
6647
+ this.status === STATUS$1.RUNNING && this._handlerTick();
6648
+ }
6518
6649
  }
6519
6650
 
6520
6651
  class ManualTickHandler {
@@ -7656,7 +7787,7 @@
7656
7787
  lastMatchedIndex = i, lastMatchedPoint = tagMap.get(this.toPoints[i].context);
7657
7788
  break;
7658
7789
  }
7659
- "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);
7790
+ "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);
7660
7791
  let prevMatchedPoint = this.toPoints[0];
7661
7792
  this.interpolatePoints = this.toPoints.map((point, index) => {
7662
7793
  const matchedPoint = tagMap.get(point.context);
@@ -7668,11 +7799,19 @@
7668
7799
  return newPoint.defined = toPoint.defined, newPoint.context = toPoint.context, newPoint;
7669
7800
  });
7670
7801
  }
7802
+ onFirstRun() {
7803
+ const lastClipRange = this.target.attribute.clipRange;
7804
+ isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
7805
+ }
7671
7806
  onUpdate(end, ratio, out) {
7672
7807
  if (this.points = this.points.map((point, index) => {
7673
7808
  const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
7674
7809
  return newPoint.context = point.context, newPoint;
7675
- }), this.clipRange && (out.clipRange = this.clipRange + (1 - this.clipRange) * ratio), this.segmentsCache && this.to.segments) {
7810
+ }), this.clipRange) {
7811
+ 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));
7812
+ out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
7813
+ }
7814
+ if (this.segmentsCache && this.to.segments) {
7676
7815
  let start = 0;
7677
7816
  out.segments = this.to.segments.map((segment, index) => {
7678
7817
  const end = start + this.segmentsCache[index],
@@ -12026,7 +12165,8 @@
12026
12165
  x: originX = arcAttribute.x,
12027
12166
  y: originY = arcAttribute.y,
12028
12167
  scaleX = arcAttribute.scaleX,
12029
- scaleY = arcAttribute.scaleY
12168
+ scaleY = arcAttribute.scaleY,
12169
+ keepStrokeScale = arcAttribute.keepStrokeScale
12030
12170
  } = arc.attribute;
12031
12171
  let {
12032
12172
  innerRadius = arcAttribute.innerRadius,
@@ -12038,7 +12178,7 @@
12038
12178
  {
12039
12179
  distance = arcAttribute[key].distance
12040
12180
  } = borderStyle,
12041
- d = getScaledStroke(context, distance, context.dpr),
12181
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12042
12182
  deltaAngle = distance / outerRadius,
12043
12183
  sign = "outerBorder" === key ? 1 : -1;
12044
12184
  if (arc.setAttributes({
@@ -12083,14 +12223,15 @@
12083
12223
  x: originX = circleAttribute.x,
12084
12224
  y: originY = circleAttribute.y,
12085
12225
  scaleX = circleAttribute.scaleX,
12086
- scaleY = circleAttribute.scaleY
12226
+ scaleY = circleAttribute.scaleY,
12227
+ keepStrokeScale = circleAttribute.keepStrokeScale
12087
12228
  } = circle.attribute,
12088
12229
  renderBorder = (borderStyle, key) => {
12089
12230
  const doStroke = !(!borderStyle || !borderStyle.stroke),
12090
12231
  {
12091
12232
  distance = circleAttribute[key].distance
12092
12233
  } = borderStyle,
12093
- d = getScaledStroke(context, distance, context.dpr),
12234
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12094
12235
  sign = "outerBorder" === key ? 1 : -1;
12095
12236
  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) {
12096
12237
  const lastOpacity = circleAttribute[key].opacity;
@@ -12209,7 +12350,8 @@
12209
12350
  scaleX = rectAttribute.scaleX,
12210
12351
  scaleY = rectAttribute.scaleY,
12211
12352
  x1: x1,
12212
- y1: y1
12353
+ y1: y1,
12354
+ keepStrokeScale = rectAttribute.keepStrokeScale
12213
12355
  } = rect.attribute;
12214
12356
  let {
12215
12357
  width: width,
@@ -12222,7 +12364,7 @@
12222
12364
  {
12223
12365
  distance = rectAttribute[key].distance
12224
12366
  } = borderStyle,
12225
- d = getScaledStroke(context, distance, context.dpr),
12367
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12226
12368
  nextX = x + sign * d,
12227
12369
  nextY = y + sign * d,
12228
12370
  dw = 2 * d;
@@ -12379,14 +12521,15 @@
12379
12521
  x: originX = symbolAttribute.x,
12380
12522
  y: originY = symbolAttribute.y,
12381
12523
  scaleX = symbolAttribute.scaleX,
12382
- scaleY = symbolAttribute.scaleY
12524
+ scaleY = symbolAttribute.scaleY,
12525
+ keepStrokeScale = symbolAttribute.keepStrokeScale
12383
12526
  } = symbol.attribute,
12384
12527
  renderBorder = (borderStyle, key) => {
12385
12528
  const doStroke = !(!borderStyle || !borderStyle.stroke),
12386
12529
  {
12387
12530
  distance = symbolAttribute[key].distance
12388
12531
  } = borderStyle,
12389
- d = getScaledStroke(context, distance, context.dpr),
12532
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12390
12533
  sign = "outerBorder" === key ? 1 : -1;
12391
12534
  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) {
12392
12535
  const lastOpacity = symbolAttribute[key].opacity;
@@ -12506,7 +12649,8 @@
12506
12649
  fill = arcAttribute.fill,
12507
12650
  stroke = arcAttribute.stroke,
12508
12651
  x: originX = arcAttribute.x,
12509
- y: originY = arcAttribute.y
12652
+ y: originY = arcAttribute.y,
12653
+ fillStrokeOrder = arcAttribute.fillStrokeOrder
12510
12654
  } = arc.attribute,
12511
12655
  data = this.valid(arc, arcAttribute, fillCb, strokeCb);
12512
12656
  if (!data) return;
@@ -12542,7 +12686,17 @@
12542
12686
  isFullStroke: isFullStroke,
12543
12687
  stroke: arrayStroke
12544
12688
  } = parseStroke(stroke);
12545
- if ((doFill || isFullStroke) && (context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill())), doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()))), !isFullStroke && doStroke) {
12689
+ if (doFill || isFullStroke) {
12690
+ context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
12691
+ const _runFill = () => {
12692
+ doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
12693
+ },
12694
+ _runStroke = () => {
12695
+ doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()));
12696
+ };
12697
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
12698
+ }
12699
+ if (!isFullStroke && doStroke) {
12546
12700
  context.beginPath();
12547
12701
  drawArcPath$1(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
12548
12702
  beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke());
@@ -12560,14 +12714,20 @@
12560
12714
  fill = arcAttribute.fill
12561
12715
  } = arc.attribute,
12562
12716
  startAngle = endAngle;
12563
- if (this.drawArcTailCapPath(arc, context, x, y, outerRadius, innerRadius, startAngle, startAngle + capAngle), beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), doFill) {
12564
- const color = fill;
12565
- if ("conical" === color.gradient) {
12566
- const lastColor = getConicGradientAt(0, 0, endAngle, color);
12567
- fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
12568
- }
12569
- }
12570
- doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
12717
+ this.drawArcTailCapPath(arc, context, x, y, outerRadius, innerRadius, startAngle, startAngle + capAngle), beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
12718
+ const _runFill = () => {
12719
+ if (doFill) {
12720
+ const color = fill;
12721
+ if ("conical" === color.gradient) {
12722
+ const lastColor = getConicGradientAt(0, 0, endAngle, color);
12723
+ fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
12724
+ }
12725
+ }
12726
+ },
12727
+ _runStroke = () => {
12728
+ doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
12729
+ };
12730
+ _runFill(), _runStroke();
12571
12731
  }
12572
12732
  }
12573
12733
  this.afterRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), tempChangeConicalColor && (fill.startAngle += conicalOffset, fill.endAngle += conicalOffset);
@@ -12605,7 +12765,8 @@
12605
12765
  startAngle = circleAttribute.startAngle,
12606
12766
  endAngle = circleAttribute.endAngle,
12607
12767
  x: originX = circleAttribute.x,
12608
- y: originY = circleAttribute.y
12768
+ y: originY = circleAttribute.y,
12769
+ fillStrokeOrder = circleAttribute.fillStrokeOrder
12609
12770
  } = circle.attribute,
12610
12771
  data = this.valid(circle, circleAttribute, fillCb, strokeCb);
12611
12772
  if (!data) return;
@@ -12615,7 +12776,14 @@
12615
12776
  doFill: doFill,
12616
12777
  doStroke: doStroke
12617
12778
  } = data;
12618
- context.beginPath(), context.arc(x, y, radius, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), this.beforeRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb), doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.fill())), doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.stroke())), this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
12779
+ context.beginPath(), context.arc(x, y, radius, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), this.beforeRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
12780
+ const _runFill = () => {
12781
+ doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.fill()));
12782
+ },
12783
+ _runStroke = () => {
12784
+ doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.stroke()));
12785
+ };
12786
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
12619
12787
  }
12620
12788
  draw(circle, renderService, drawContext, params) {
12621
12789
  const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle;
@@ -13056,7 +13224,7 @@
13056
13224
  super(), this.areaRenderContribitions = areaRenderContribitions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(areaRenderContribitions);
13057
13225
  }
13058
13226
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
13059
- var _a, _b, _c, _d, _e;
13227
+ var _a, _b, _c;
13060
13228
  const {
13061
13229
  points: points
13062
13230
  } = area.attribute;
@@ -13080,28 +13248,31 @@
13080
13248
  x: originX = 0,
13081
13249
  x: originY = 0
13082
13250
  } = area.attribute;
13083
- if (!1 !== fill && (fillCb ? fillCb(context, area.attribute, areaAttribute) : fillOpacity && (context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, areaAttribute, drawContext, fillCb, null, {
13251
+ !1 !== fill && (fillCb ? fillCb(context, area.attribute, areaAttribute) : fillOpacity && (context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, areaAttribute, drawContext, fillCb, null, {
13084
13252
  attribute: area.attribute
13085
- }), stroke) {
13086
- const {
13087
- stroke = areaAttribute && areaAttribute.stroke
13088
- } = area.attribute;
13089
- if (isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
13090
- context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13091
- for (let i = 1; i < points.length; i++) {
13092
- const p = points[i];
13093
- context.lineTo(p.x + offsetX, p.y + offsetY, z);
13094
- }
13095
- } else if (stroke[2]) {
13096
- const endP = points[points.length - 1];
13097
- context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
13098
- for (let i = points.length - 2; i >= 0; i--) {
13099
- const p = points[i];
13100
- context.lineTo((null !== (_d = p.x1) && void 0 !== _d ? _d : p.x) + offsetX, (null !== (_e = p.y1) && void 0 !== _e ? _e : p.y) + offsetY, z);
13253
+ }), (() => {
13254
+ var _a, _b;
13255
+ if (stroke) {
13256
+ const {
13257
+ stroke = areaAttribute && areaAttribute.stroke
13258
+ } = area.attribute;
13259
+ if (isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
13260
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13261
+ for (let i = 1; i < points.length; i++) {
13262
+ const p = points[i];
13263
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
13264
+ }
13265
+ } else if (stroke[2]) {
13266
+ const endP = points[points.length - 1];
13267
+ context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
13268
+ for (let i = points.length - 2; i >= 0; i--) {
13269
+ const p = points[i];
13270
+ context.lineTo((null !== (_a = p.x1) && void 0 !== _a ? _a : p.x) + offsetX, (null !== (_b = p.y1) && void 0 !== _b ? _b : p.y) + offsetY, z);
13271
+ }
13101
13272
  }
13273
+ strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13102
13274
  }
13103
- strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13104
- }
13275
+ })();
13105
13276
  }
13106
13277
  drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
13107
13278
  var _a, _b, _c, _d, _e, _f;
@@ -13266,23 +13437,24 @@
13266
13437
  x: originX = 0,
13267
13438
  x: originY = 0
13268
13439
  } = attribute;
13269
- if (!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
13440
+ return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
13270
13441
  attribute: attribute
13271
- }), !1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
13272
- const {
13273
- stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
13274
- } = attribute;
13275
- isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === exports.Direction.ROW ? "x" : "y", {
13276
- offsetX: offsetX,
13277
- offsetY: offsetY,
13278
- offsetZ: offsetZ,
13279
- drawConnect: connect,
13280
- mode: connectedType,
13281
- zeroX: connectedX,
13282
- zeroY: connectedY
13283
- })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
13284
- }
13285
- return !1;
13442
+ }), (() => {
13443
+ if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
13444
+ const {
13445
+ stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
13446
+ } = attribute;
13447
+ isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === exports.Direction.ROW ? "x" : "y", {
13448
+ offsetX: offsetX,
13449
+ offsetY: offsetY,
13450
+ offsetZ: offsetZ,
13451
+ drawConnect: connect,
13452
+ mode: connectedType,
13453
+ zeroX: connectedX,
13454
+ zeroY: connectedY
13455
+ })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
13456
+ }
13457
+ })(), !1;
13286
13458
  }
13287
13459
  };
13288
13460
  exports.DefaultCanvasAreaRender = __decorate$1v([injectable(), __param$N(0, inject(ContributionProvider)), __param$N(0, named(AreaRenderContribution)), __metadata$19("design:paramtypes", [Object])], exports.DefaultCanvasAreaRender);
@@ -13314,7 +13486,8 @@
13314
13486
  const pathAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : getTheme(path, null == params ? void 0 : params.theme).path,
13315
13487
  {
13316
13488
  x: originX = pathAttribute.x,
13317
- y: originY = pathAttribute.y
13489
+ y: originY = pathAttribute.y,
13490
+ fillStrokeOrder = pathAttribute.fillStrokeOrder
13318
13491
  } = path.attribute,
13319
13492
  z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
13320
13493
  data = this.valid(path, pathAttribute, fillCb, strokeCb);
@@ -13329,7 +13502,14 @@
13329
13502
  const path2D = null !== (_c = path.attribute.path) && void 0 !== _c ? _c : pathAttribute.path;
13330
13503
  renderCommandList(path2D.commandList, context, x, y, 1, 1, z);
13331
13504
  }
13332
- context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute), this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb), doStroke && (strokeCb ? strokeCb(context, path.attribute, pathAttribute) : sVisible && (context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.stroke())), doFill && (fillCb ? fillCb(context, path.attribute, pathAttribute) : fVisible && (context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.fill())), this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13505
+ context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute), this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13506
+ const _runStroke = () => {
13507
+ doStroke && (strokeCb ? strokeCb(context, path.attribute, pathAttribute) : sVisible && (context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.stroke()));
13508
+ },
13509
+ _runFill = () => {
13510
+ doFill && (fillCb ? fillCb(context, path.attribute, pathAttribute) : fVisible && (context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.fill()));
13511
+ };
13512
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13333
13513
  }
13334
13514
  draw(path, renderService, drawContext, params) {
13335
13515
  const pathAttribute = getTheme(path, null == params ? void 0 : params.theme).path;
@@ -13373,7 +13553,8 @@
13373
13553
  x1: x1,
13374
13554
  y1: y1,
13375
13555
  x: originX = rectAttribute.x,
13376
- y: originY = rectAttribute.y
13556
+ y: originY = rectAttribute.y,
13557
+ fillStrokeOrder = rectAttribute.fillStrokeOrder
13377
13558
  } = rect.attribute;
13378
13559
  let {
13379
13560
  width: width,
@@ -13392,7 +13573,14 @@
13392
13573
  doFill: doFill,
13393
13574
  doStroke: doStroke
13394
13575
  };
13395
- context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke), doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill())), doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke())), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
13576
+ context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
13577
+ const _runFill = () => {
13578
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
13579
+ },
13580
+ _runStroke = () => {
13581
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
13582
+ };
13583
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
13396
13584
  }
13397
13585
  draw(rect, renderService, drawContext, params) {
13398
13586
  const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect;
@@ -13428,7 +13616,8 @@
13428
13616
  x: originX = symbolAttribute.x,
13429
13617
  y: originY = symbolAttribute.y,
13430
13618
  scaleX = symbolAttribute.scaleX,
13431
- scaleY = symbolAttribute.scaleY
13619
+ scaleY = symbolAttribute.scaleY,
13620
+ fillStrokeOrder = symbolAttribute.fillStrokeOrder
13432
13621
  } = symbol.attribute,
13433
13622
  data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
13434
13623
  if (!data) return;
@@ -13451,14 +13640,27 @@
13451
13640
  const obj = Object.assign({}, a);
13452
13641
  obj.fill = null !== (_a = a.fill) && void 0 !== _a ? _a : symbol.attribute.fill, obj.opacity = null !== (_b = a.opacity) && void 0 !== _b ? _b : symbol.attribute.opacity, obj.fillOpacity = symbol.attribute.fillOpacity, obj.stroke = null !== (_c = a.stroke) && void 0 !== _c ? _c : symbol.attribute.stroke, a = obj;
13453
13642
  }
13454
- a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill())), a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13643
+ const _runFill = () => {
13644
+ a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill()));
13645
+ },
13646
+ _runStroke = () => {
13647
+ a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13648
+ };
13649
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
13455
13650
  };
13456
13651
  if (keepDirIn3d && context.camera && context.project) {
13457
13652
  const p = context.project(x, y, z),
13458
13653
  camera = context.camera;
13459
13654
  context.camera = null, !1 === parsedPath.draw(context, isArray$1(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX, p.x, p.y, void 0, callback) && context.closePath(), context.camera = camera;
13460
13655
  } else !1 === parsedPath.draw(context, size, x, y, z, callback) && context.closePath();
13461
- context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb), doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill())), doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke())), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13656
+ context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13657
+ const _runFill = () => {
13658
+ doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
13659
+ },
13660
+ _runStroke = () => {
13661
+ doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13662
+ };
13663
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13462
13664
  }
13463
13665
  draw(symbol, renderService, drawContext, params) {
13464
13666
  const symbolAttribute = getTheme(symbol, null == params ? void 0 : params.theme).symbol;
@@ -13605,16 +13807,8 @@
13605
13807
  verticalMode = textAttribute.verticalMode,
13606
13808
  x: originX = textAttribute.x,
13607
13809
  y: originY = textAttribute.y
13608
- } = text.attribute;
13609
- let {
13610
- textAlign = textAttribute.textAlign,
13611
- textBaseline = textAttribute.textBaseline
13612
- } = text.attribute;
13613
- if (!verticalMode && "vertical" === direction) {
13614
- const t = textAlign;
13615
- textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
13616
- }
13617
- const lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
13810
+ } = text.attribute,
13811
+ lineHeight = null !== (_a = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _a ? _a : fontSize,
13618
13812
  data = this.valid(text, textAttribute, fillCb, strokeCb);
13619
13813
  if (!data) return;
13620
13814
  const {
@@ -13634,79 +13828,60 @@
13634
13828
  const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
13635
13829
  matrix.rotateByCenter(Math.PI / 2, _x, _y), context.transformFromMatrix(matrix, !0), matrixAllocate.free(matrix);
13636
13830
  }
13637
- 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());
13831
+ 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());
13638
13832
  };
13639
- if (text.isMultiLine) {
13640
- if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
13641
- const {
13642
- multilineLayout: multilineLayout
13643
- } = text;
13644
- if (!multilineLayout) return void context.highPerformanceRestore();
13645
- const {
13646
- xOffset: xOffset,
13647
- yOffset: yOffset
13648
- } = multilineLayout.bbox;
13649
- doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13650
- context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
13651
- }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13652
- 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, {
13653
- width: line.width
13654
- });
13655
- })));
13656
- } else {
13657
- text.tryUpdateAABBBounds();
13658
- const cache = text.cache,
13659
- {
13660
- verticalList: verticalList
13661
- } = cache;
13662
- context.textAlign = "left", context.textBaseline = "top";
13663
- const totalHeight = lineHeight * verticalList.length;
13664
- let totalW = 0;
13665
- verticalList.forEach(verticalData => {
13666
- const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
13667
- totalW = max(_w, totalW);
13668
- });
13669
- let offsetY = 0,
13670
- offsetX = 0;
13671
- "bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
13672
- const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
13673
- dw = totalW - currentW;
13674
- let currentOffsetY = offsetY;
13675
- "center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
13676
- const {
13677
- text: text,
13678
- width: width,
13679
- direction: direction
13680
- } = item;
13681
- drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
13682
- });
13833
+ if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
13834
+ const {
13835
+ multilineLayout: multilineLayout
13836
+ } = text;
13837
+ if (!multilineLayout) return void context.highPerformanceRestore();
13838
+ const {
13839
+ xOffset: xOffset,
13840
+ yOffset: yOffset
13841
+ } = multilineLayout.bbox;
13842
+ doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13843
+ context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
13844
+ }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13845
+ 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, {
13846
+ width: line.width
13683
13847
  });
13684
- }
13685
- } else if ("horizontal" === direction) {
13686
- context.setTextStyle(text.attribute, textAttribute, z);
13687
- const t = text.clipedText;
13688
- let dy = 0;
13689
- lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)), drawText(t, 0, dy, 0);
13848
+ })));
13690
13849
  } else {
13850
+ let {
13851
+ textAlign = textAttribute.textAlign,
13852
+ textBaseline = textAttribute.textBaseline
13853
+ } = text.attribute;
13854
+ if (!verticalMode) {
13855
+ const t = textAlign;
13856
+ textAlign = null !== (_b = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = text.getAlignMapBaseline()[t]) && void 0 !== _c ? _c : "top";
13857
+ }
13691
13858
  text.tryUpdateAABBBounds();
13692
- const cache = text.cache;
13693
- if (cache) {
13694
- context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
13695
- const {
13859
+ const cache = text.cache,
13860
+ {
13696
13861
  verticalList: verticalList
13697
13862
  } = cache;
13698
- let offsetY = 0;
13699
- const totalW = verticalList[0].reduce((a, b) => a + (b.width || 0), 0);
13700
- let offsetX = 0;
13701
- "bottom" === textBaseline ? offsetX = -lineHeight : "middle" === textBaseline && (offsetX = -lineHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), context.textAlign = "left", context.textBaseline = "top", verticalList[0].forEach(item => {
13863
+ context.textAlign = "left", context.textBaseline = "top";
13864
+ const totalHeight = lineHeight * verticalList.length;
13865
+ let totalW = 0;
13866
+ verticalList.forEach(verticalData => {
13867
+ const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
13868
+ totalW = max(_w, totalW);
13869
+ });
13870
+ let offsetY = 0,
13871
+ offsetX = 0;
13872
+ "bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
13873
+ const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
13874
+ dw = totalW - currentW;
13875
+ let currentOffsetY = offsetY;
13876
+ "center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
13702
13877
  const {
13703
13878
  text: text,
13704
13879
  width: width,
13705
13880
  direction: direction
13706
13881
  } = item;
13707
- drawText(text, offsetX, offsetY, direction), offsetY += width;
13882
+ drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
13708
13883
  });
13709
- }
13884
+ });
13710
13885
  }
13711
13886
  transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context), this.afterRenderStep(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb);
13712
13887
  }
@@ -13718,12 +13893,10 @@
13718
13893
  computed3dMatrix = !keepDirIn3d;
13719
13894
  this._draw(text, textAttribute, computed3dMatrix, drawContext, params);
13720
13895
  }
13721
- drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context, multiOption) {
13896
+ drawUnderLine(underline, lineThrough, text, anchorX, anchorY, offsetUnderLineY, offsetThroughLineY, z, textAttribute, context, multiOption) {
13722
13897
  if (lineThrough + underline <= 0) return;
13723
13898
  const {
13724
13899
  textAlign = textAttribute.textAlign,
13725
- textBaseline = textAttribute.textBaseline,
13726
- fontSize = textAttribute.fontSize,
13727
13900
  fill = textAttribute.fill,
13728
13901
  opacity = textAttribute.opacity,
13729
13902
  underlineOffset = textAttribute.underlineOffset,
@@ -13733,23 +13906,21 @@
13733
13906
  isMulti = !isNil$1(multiOption),
13734
13907
  w = isMulti ? multiOption.width : text.clipedWidth,
13735
13908
  offsetX = isMulti ? 0 : textDrawOffsetX(textAlign, w),
13736
- offsetY = textLayoutOffsetY(isMulti ? "alphabetic" : textBaseline, fontSize, fontSize),
13737
13909
  attribute = {
13738
13910
  lineWidth: 0,
13739
13911
  stroke: fill,
13740
13912
  opacity: opacity,
13741
13913
  strokeOpacity: fillOpacity
13742
13914
  };
13743
- let deltaY = isMulti ? -3 : 0;
13744
13915
  if (underline) {
13745
- attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
13746
- const dy = y + offsetY + fontSize + underlineOffset + deltaY;
13747
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
13916
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
13917
+ const dy = anchorY + offsetUnderLineY + underlineOffset;
13918
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13748
13919
  }
13749
- if (isMulti && (deltaY = -1), lineThrough) {
13750
- attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.beginPath();
13751
- const dy = y + offsetY + fontSize / 2 + deltaY;
13752
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
13920
+ if (lineThrough) {
13921
+ attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), context.beginPath();
13922
+ const dy = anchorY + offsetThroughLineY;
13923
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13753
13924
  }
13754
13925
  }
13755
13926
  };
@@ -13845,7 +14016,8 @@
13845
14016
  cornerRadius = polygonAttribute.cornerRadius,
13846
14017
  x: originX = polygonAttribute.x,
13847
14018
  y: originY = polygonAttribute.y,
13848
- closePath = polygonAttribute.closePath
14019
+ closePath = polygonAttribute.closePath,
14020
+ fillStrokeOrder = polygonAttribute.fillStrokeOrder
13849
14021
  } = polygon.attribute,
13850
14022
  data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
13851
14023
  if (!data) return;
@@ -13855,7 +14027,14 @@
13855
14027
  doFill: doFill,
13856
14028
  doStroke: doStroke
13857
14029
  } = data;
13858
- context.beginPath(), cornerRadius <= 0 || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? drawPolygon(context.camera ? context : context.nativeContext, points, x, y) : drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath), closePath && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute), this.beforeRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb), doFill && (fillCb ? fillCb(context, polygon.attribute, polygonAttribute) : fVisible && (context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.fill())), doStroke && (strokeCb ? strokeCb(context, polygon.attribute, polygonAttribute) : sVisible && (context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.stroke())), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
14030
+ context.beginPath(), cornerRadius <= 0 || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? drawPolygon(context.camera ? context : context.nativeContext, points, x, y) : drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath), closePath && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute), this.beforeRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
14031
+ const _runFill = () => {
14032
+ doFill && (fillCb ? fillCb(context, polygon.attribute, polygonAttribute) : fVisible && (context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.fill()));
14033
+ },
14034
+ _runStroke = () => {
14035
+ doStroke && (strokeCb ? strokeCb(context, polygon.attribute, polygonAttribute) : sVisible && (context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.stroke()));
14036
+ };
14037
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
13859
14038
  }
13860
14039
  draw(polygon, renderService, drawContext, params) {
13861
14040
  const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon;
@@ -13898,7 +14077,10 @@
13898
14077
  cornerRadius = groupAttribute.cornerRadius,
13899
14078
  path = groupAttribute.path,
13900
14079
  lineWidth = groupAttribute.lineWidth,
13901
- visible = groupAttribute.visible
14080
+ visible = groupAttribute.visible,
14081
+ fillStrokeOrder = groupAttribute.fillStrokeOrder,
14082
+ x: originX = groupAttribute.x,
14083
+ y: originY = groupAttribute.y
13902
14084
  } = group.attribute,
13903
14085
  fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
13904
14086
  sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
@@ -13924,7 +14106,14 @@
13924
14106
  };
13925
14107
  this._groupRenderContribitions.forEach(c => {
13926
14108
  c.time === exports.BaseRenderContributionTime.beforeFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
13927
- }), clip && context.clip(), context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute), doFillOrStroke.doFill && (fillCb ? fillCb(context, group.attribute, groupAttribute) : fVisible && (context.setCommonStyle(group, group.attribute, x, y, groupAttribute), context.fill())), doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, group.attribute, groupAttribute) : sVisible && (context.setStrokeStyle(group, group.attribute, x, y, groupAttribute), context.stroke())), this._groupRenderContribitions.forEach(c => {
14109
+ }), clip && context.clip(), context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
14110
+ const _runFill = () => {
14111
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, group.attribute, groupAttribute) : fVisible && (context.setCommonStyle(group, group.attribute, originX - x, originY - y, groupAttribute), context.fill()));
14112
+ },
14113
+ _runStroke = () => {
14114
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, group.attribute, groupAttribute) : sVisible && (context.setStrokeStyle(group, group.attribute, originX - x, originY - y, groupAttribute), context.stroke()));
14115
+ };
14116
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this._groupRenderContribitions.forEach(c => {
13928
14117
  c.time === exports.BaseRenderContributionTime.afterFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb);
13929
14118
  });
13930
14119
  }
@@ -13990,6 +14179,7 @@
13990
14179
  x: originX = imageAttribute.x,
13991
14180
  y: originY = imageAttribute.y,
13992
14181
  cornerRadius = imageAttribute.cornerRadius,
14182
+ fillStrokeOrder = imageAttribute.fillStrokeOrder,
13993
14183
  image: url
13994
14184
  } = image.attribute,
13995
14185
  data = this.valid(image, imageAttribute, fillCb);
@@ -14000,20 +14190,26 @@
14000
14190
  doFill: doFill,
14001
14191
  doStroke: doStroke
14002
14192
  } = data;
14003
- if (context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
14004
- if (!url || !image.resources) return;
14005
- const res = image.resources.get(url);
14006
- if ("success" !== res.state) return;
14007
- let needRestore = !1;
14008
- 0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) || (context.beginPath(), createRectPath(context, x, y, width, height, cornerRadius), context.save(), context.clip(), needRestore = !0), context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
14009
- let repeat = 0;
14010
- if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
14011
- const pattern = context.createPattern(res.data, repeatStr[repeat]);
14012
- context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
14013
- } else context.drawImage(res.data, x, y, width, height);
14014
- needRestore && context.restore();
14015
- }
14016
- doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke())), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14193
+ context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14194
+ const _runFill = () => {
14195
+ if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
14196
+ if (!url || !image.resources) return;
14197
+ const res = image.resources.get(url);
14198
+ if ("success" !== res.state) return;
14199
+ let needRestore = !1;
14200
+ 0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) || (context.beginPath(), createRectPath(context, x, y, width, height, cornerRadius), context.save(), context.clip(), needRestore = !0), context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
14201
+ let repeat = 0;
14202
+ if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
14203
+ const pattern = context.createPattern(res.data, repeatStr[repeat]);
14204
+ context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
14205
+ } else context.drawImage(res.data, x, y, width, height);
14206
+ needRestore && context.restore();
14207
+ }
14208
+ },
14209
+ _runStroke = () => {
14210
+ doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
14211
+ };
14212
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14017
14213
  }
14018
14214
  draw(image, renderService, drawContext) {
14019
14215
  const {
@@ -14407,58 +14603,60 @@
14407
14603
  constructor(fontFamily, options, textMeasure) {
14408
14604
  this.fontFamily = fontFamily, this.textOptions = options, this.textMeasure = textMeasure;
14409
14605
  }
14410
- LayoutBBox(bbox, textAlign, textBaseline) {
14606
+ LayoutBBox(bbox, textAlign, textBaseline, linesLayout) {
14411
14607
  if ("left" === textAlign || "start" === textAlign) bbox.xOffset = 0;else if ("center" === textAlign) bbox.xOffset = bbox.width / -2;else {
14412
14608
  if ("right" !== textAlign && "end" !== textAlign) throw new Error("非法的textAlign");
14413
14609
  bbox.xOffset = -bbox.width;
14414
14610
  }
14415
- return bbox.yOffset = "top" === textBaseline ? 0 : "middle" === textBaseline ? bbox.height / -2 : "alphabetic" === textBaseline ? -.79 * bbox.height : -bbox.height, bbox;
14416
- }
14417
- GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
14418
- const linesLayout = [],
14419
- bboxWH = [width, height],
14420
- bboxOffset = [0, 0];
14421
- for (; str.length > 0;) {
14422
- const {
14423
- str: clipText
14424
- } = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition);
14425
- linesLayout.push({
14426
- str: clipText,
14427
- width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
14428
- }), str = str.substring(clipText.length);
14429
- }
14430
- "left" === textAlign || "start" === textAlign || ("center" === textAlign ? bboxOffset[0] = bboxWH[0] / -2 : "right" !== textAlign && "end" !== textAlign || (bboxOffset[0] = -bboxWH[0])), "top" === textBaseline || ("middle" === textBaseline ? bboxOffset[1] = bboxWH[1] / -2 : "bottom" === textBaseline && (bboxOffset[1] = -bboxWH[1]));
14431
- const bbox = {
14432
- xOffset: bboxOffset[0],
14433
- yOffset: bboxOffset[1],
14434
- width: bboxWH[0],
14435
- height: bboxWH[1]
14436
- };
14437
- return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14611
+ if ("top" === textBaseline) bbox.yOffset = 0;else if ("middle" === textBaseline) bbox.yOffset = bbox.height / -2;else if ("alphabetic" === textBaseline) {
14612
+ let percent = .79;
14613
+ if (1 === linesLayout.length) {
14614
+ const lineInfo = linesLayout[0];
14615
+ percent = lineInfo.ascent / (lineInfo.ascent + lineInfo.descent);
14616
+ }
14617
+ bbox.yOffset = bbox.height * -percent;
14618
+ } else bbox.yOffset = -bbox.height;
14619
+ return bbox;
14438
14620
  }
14439
14621
  GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
14440
14622
  let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
14441
14623
  let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
14442
- let lineWidth = arguments.length > 6 ? arguments[6] : undefined;
14443
- let suffixPosition = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : "end";
14624
+ let params = arguments.length > 6 ? arguments[6] : undefined;
14625
+ const {
14626
+ lineWidth: lineWidth,
14627
+ suffixPosition = "end",
14628
+ measureMode = exports.MeasureModeEnum.actualBounding
14629
+ } = null != params ? params : {};
14444
14630
  lines = lines.map(l => l.toString());
14445
14631
  const linesLayout = [],
14446
14632
  bboxWH = [0, 0];
14447
14633
  if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
14448
14634
  let width;
14449
- for (let i = 0, len = lines.length; i < len; i++) width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth), linesLayout.push({
14450
- str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14451
- width: width
14452
- });
14635
+ for (let i = 0, len = lines.length; i < len; i++) {
14636
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14637
+ width = Math.min(metrics.width, lineWidth), linesLayout.push({
14638
+ str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14639
+ width: width,
14640
+ ascent: metrics.ascent,
14641
+ descent: metrics.descent
14642
+ });
14643
+ }
14453
14644
  bboxWH[0] = lineWidth;
14454
14645
  } else {
14455
- let width, text;
14456
- lineWidth = 0;
14457
- for (let i = 0, len = lines.length; i < len; i++) text = lines[i], width = this.textMeasure.measureTextWidth(text, this.textOptions), lineWidth = Math.max(lineWidth, width), linesLayout.push({
14458
- str: text,
14459
- width: width
14460
- });
14461
- bboxWH[0] = lineWidth;
14646
+ let width,
14647
+ text,
14648
+ _lineWidth = 0;
14649
+ for (let i = 0, len = lines.length; i < len; i++) {
14650
+ text = lines[i];
14651
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14652
+ width = metrics.width, _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
14653
+ str: text,
14654
+ width: width,
14655
+ ascent: metrics.ascent,
14656
+ descent: metrics.descent
14657
+ });
14658
+ }
14659
+ bboxWH[0] = _lineWidth;
14462
14660
  }
14463
14661
  bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);
14464
14662
  const bbox = {
@@ -14467,7 +14665,7 @@
14467
14665
  width: bboxWH[0],
14468
14666
  height: bboxWH[1]
14469
14667
  };
14470
- return this.LayoutBBox(bbox, textAlign, textBaseline), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14668
+ return this.LayoutBBox(bbox, textAlign, textBaseline, linesLayout), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14471
14669
  }
14472
14670
  layoutWithBBox(bbox, lines, textAlign, textBaseline, lineHeight) {
14473
14671
  const origin = [0, 0],
@@ -14486,11 +14684,13 @@
14486
14684
  };
14487
14685
  }
14488
14686
  lineOffset(bbox, line, textAlign, textBaseline, lineHeight, origin) {
14489
- return "left" === textAlign || "start" === textAlign ? line.leftOffset = 0 : "center" === textAlign ? line.leftOffset = (bbox.width - line.width) / 2 : "right" !== textAlign && "end" !== textAlign || (line.leftOffset = bbox.width - line.width), line.topOffset = (lineHeight - this.textOptions.fontSize) / 2 + .79 * this.textOptions.fontSize + origin[1], origin[1] += lineHeight, line;
14687
+ "left" === textAlign || "start" === textAlign ? line.leftOffset = 0 : "center" === textAlign ? line.leftOffset = (bbox.width - line.width) / 2 : "right" !== textAlign && "end" !== textAlign || (line.leftOffset = bbox.width - line.width), line.topOffset = lineHeight / 2 + (line.ascent - line.descent) / 2 + origin[1];
14688
+ const actualHeightWithBuf = line.ascent + line.descent + 0;
14689
+ return actualHeightWithBuf < lineHeight - 0 && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2)), origin[1] += lineHeight, line;
14490
14690
  }
14491
14691
  }
14492
14692
 
14493
- const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
14693
+ const TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "maxWidth", "textAlign", "textBaseline", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp", ...GRAPHIC_UPDATE_TAG_KEY];
14494
14694
  class Text extends Graphic {
14495
14695
  get font() {
14496
14696
  const textTheme = this.getGraphicTheme();
@@ -14499,26 +14699,22 @@
14499
14699
  get clipedText() {
14500
14700
  var _a;
14501
14701
  const attribute = this.attribute,
14502
- textTheme = this.getGraphicTheme();
14503
- if (!this.isSimplify()) return;
14504
- const {
14505
- maxLineWidth = textTheme.maxLineWidth
14506
- } = attribute;
14507
- return Number.isFinite(maxLineWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
14702
+ textTheme = this.getGraphicTheme(),
14703
+ maxWidth = this.getMaxWidth(textTheme);
14704
+ return Number.isFinite(maxWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
14508
14705
  }
14509
14706
  get clipedWidth() {
14510
- if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
14707
+ return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
14511
14708
  }
14512
14709
  get cliped() {
14513
14710
  var _a, _b;
14514
14711
  const textTheme = this.getGraphicTheme(),
14515
14712
  attribute = this.attribute,
14516
- {
14517
- maxLineWidth = textTheme.maxLineWidth,
14518
- text: text,
14519
- whiteSpace = textTheme.whiteSpace
14520
- } = attribute;
14521
- if (!Number.isFinite(maxLineWidth)) return !1;
14713
+ maxWidth = this.getMaxWidth(textTheme);
14714
+ if (!Number.isFinite(maxWidth)) return !1;
14715
+ const {
14716
+ text: text
14717
+ } = this.attribute;
14522
14718
  if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
14523
14719
  let mergedText = "";
14524
14720
  this.cache.layoutData.lines.forEach(item => {
@@ -14529,10 +14725,7 @@
14529
14725
  return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
14530
14726
  }
14531
14727
  get multilineLayout() {
14532
- if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
14533
- }
14534
- isSimplify() {
14535
- return !this.isMultiLine && "vertical" !== this.attribute.direction;
14728
+ return this.tryUpdateAABBBounds(), this.cache.layoutData;
14536
14729
  }
14537
14730
  get isMultiLine() {
14538
14731
  return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
@@ -14605,8 +14798,72 @@
14605
14798
  }
14606
14799
  return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
14607
14800
  }
14801
+ updateSingallineAABBBounds(text) {
14802
+ this.updateMultilineAABBBounds([text]);
14803
+ const layoutData = this.cache.layoutData;
14804
+ if (layoutData) {
14805
+ const line = layoutData.lines[0];
14806
+ this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
14807
+ }
14808
+ return this._AABBBounds;
14809
+ }
14810
+ updateMultilineAABBBounds(text) {
14811
+ const textTheme = this.getGraphicTheme(),
14812
+ {
14813
+ direction = textTheme.direction,
14814
+ underlineOffset = textTheme.underlineOffset
14815
+ } = this.attribute,
14816
+ b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
14817
+ return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
14818
+ }
14819
+ guessLineHeightBuf(fontSize) {
14820
+ return fontSize ? .1 * fontSize : 0;
14821
+ }
14822
+ updateHorizontalMultilineAABBBounds(text) {
14823
+ var _a;
14824
+ const textTheme = this.getGraphicTheme(),
14825
+ attribute = this.attribute,
14826
+ {
14827
+ fontFamily = textTheme.fontFamily,
14828
+ textAlign = textTheme.textAlign,
14829
+ textBaseline = textTheme.textBaseline,
14830
+ fontSize = textTheme.fontSize,
14831
+ fontWeight = textTheme.fontWeight,
14832
+ ellipsis = textTheme.ellipsis,
14833
+ maxLineWidth: maxLineWidth,
14834
+ stroke = textTheme.stroke,
14835
+ wrap = textTheme.wrap,
14836
+ measureMode = textTheme.measureMode,
14837
+ lineWidth = textTheme.lineWidth,
14838
+ whiteSpace = textTheme.whiteSpace,
14839
+ suffixPosition = textTheme.suffixPosition,
14840
+ ignoreBuf = textTheme.ignoreBuf
14841
+ } = attribute,
14842
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14843
+ lineHeight = this.getLineHeight(attribute, textTheme) + buf;
14844
+ if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
14845
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14846
+ const bbox = this.cache.layoutData.bbox;
14847
+ return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14848
+ }
14849
+ const textMeasure = application.graphicUtil.textMeasure,
14850
+ layoutData = new CanvasTextLayout(fontFamily, {
14851
+ fontSize: fontSize,
14852
+ fontWeight: fontWeight,
14853
+ fontFamily: fontFamily,
14854
+ lineHeight: lineHeight
14855
+ }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, {
14856
+ lineWidth: maxLineWidth,
14857
+ suffixPosition: suffixPosition,
14858
+ measureMode: measureMode
14859
+ }),
14860
+ {
14861
+ bbox: bbox
14862
+ } = layoutData;
14863
+ return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14864
+ }
14608
14865
  updateWrapAABBBounds(text) {
14609
- var _a, _b, _c, _d;
14866
+ var _a, _b, _c;
14610
14867
  const textTheme = this.getGraphicTheme(),
14611
14868
  {
14612
14869
  fontFamily = textTheme.fontFamily,
@@ -14620,22 +14877,25 @@
14620
14877
  wordBreak = textTheme.wordBreak,
14621
14878
  fontWeight = textTheme.fontWeight,
14622
14879
  ignoreBuf = textTheme.ignoreBuf,
14880
+ measureMode = textTheme.measureMode,
14623
14881
  suffixPosition = textTheme.suffixPosition,
14624
14882
  heightLimit = 0,
14625
14883
  lineClamp: lineClamp
14626
14884
  } = this.attribute,
14627
- lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
14628
- buf = ignoreBuf ? 0 : 2;
14629
- if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
14885
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14886
+ lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
14887
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14630
14888
  const bbox = this.cache.layoutData.bbox;
14631
14889
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14632
14890
  }
14633
14891
  const textMeasure = application.graphicUtil.textMeasure,
14634
- layoutObj = new CanvasTextLayout(fontFamily, {
14892
+ textOptions = {
14635
14893
  fontSize: fontSize,
14636
14894
  fontWeight: fontWeight,
14637
- fontFamily: fontFamily
14638
- }, textMeasure),
14895
+ fontFamily: fontFamily,
14896
+ lineHeight: lineHeight
14897
+ },
14898
+ layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure),
14639
14899
  lines = isArray$1(text) ? text.map(l => l.toString()) : [text.toString()],
14640
14900
  linesLayout = [],
14641
14901
  bboxWH = [0, 0];
@@ -14645,29 +14905,35 @@
14645
14905
  const str = lines[i];
14646
14906
  let needCut = !0;
14647
14907
  if (i === lineCountLimit - 1) {
14648
- const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
14908
+ const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1),
14909
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14649
14910
  linesLayout.push({
14650
14911
  str: clip.str,
14651
- width: clip.width
14912
+ width: clip.width,
14913
+ ascent: matrics.ascent,
14914
+ descent: matrics.descent
14652
14915
  });
14653
14916
  break;
14654
14917
  }
14655
- const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
14918
+ const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
14656
14919
  if ("" !== str && "" === clip.str || clip.wordBreaked) {
14657
14920
  if (ellipsis) {
14658
- const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14659
- clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
14921
+ const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14922
+ clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
14660
14923
  } else clip.str = "", clip.width = 0;
14661
14924
  needCut = !1;
14662
14925
  }
14926
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14663
14927
  linesLayout.push({
14664
14928
  str: clip.str,
14665
- width: clip.width
14929
+ width: clip.width,
14930
+ ascent: matrics.ascent,
14931
+ descent: matrics.descent
14666
14932
  });
14667
14933
  let cutLength = clip.str.length;
14668
14934
  if (!clip.wordBreaked || "" !== str && "" === clip.str || (needCut = !0, cutLength = clip.wordBreaked), clip.str.length === str.length) ;else if (needCut) {
14669
- let newStr = str.substring(cutLength);
14670
- "keep-all" === wordBreak && (newStr = newStr.replace(/^\s+/g, "")), lines.splice(i + 1, 0, newStr);
14935
+ const newStr = str.substring(cutLength);
14936
+ lines.splice(i + 1, 0, newStr);
14671
14937
  }
14672
14938
  }
14673
14939
  let maxWidth = 0;
@@ -14680,235 +14946,44 @@
14680
14946
  lineWidth = 0;
14681
14947
  for (let i = 0, len = lines.length; i < len; i++) {
14682
14948
  if (i === lineCountLimit - 1) {
14683
- const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14949
+ const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition),
14950
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14684
14951
  linesLayout.push({
14685
14952
  str: clip.str,
14686
- width: clip.width
14953
+ width: clip.width,
14954
+ ascent: matrics.ascent,
14955
+ descent: matrics.descent
14687
14956
  }), lineWidth = Math.max(lineWidth, clip.width);
14688
14957
  break;
14689
14958
  }
14690
- text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
14959
+ text = lines[i], width = textMeasure.measureTextWidth(text, textOptions), lineWidth = Math.max(lineWidth, width);
14960
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions, measureMode);
14961
+ linesLayout.push({
14691
14962
  str: text,
14692
- width: width
14963
+ width: width,
14964
+ ascent: matrics.ascent,
14965
+ descent: matrics.descent
14693
14966
  });
14694
14967
  }
14695
14968
  bboxWH[0] = lineWidth;
14696
14969
  }
14697
- bboxWH[1] = linesLayout.length * (lineHeight + buf);
14970
+ bboxWH[1] = linesLayout.length * lineHeight;
14698
14971
  const bbox = {
14699
14972
  xOffset: 0,
14700
14973
  yOffset: 0,
14701
14974
  width: bboxWH[0],
14702
14975
  height: bboxWH[1]
14703
14976
  };
14704
- layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
14977
+ layoutObj.LayoutBBox(bbox, textAlign, textBaseline, linesLayout);
14705
14978
  const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14706
14979
  return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14707
14980
  }
14708
- updateSingallineAABBBounds(text) {
14709
- const textTheme = this.getGraphicTheme(),
14710
- {
14711
- direction = textTheme.direction,
14712
- underlineOffset = textTheme.underlineOffset
14713
- } = this.attribute,
14714
- b = "horizontal" === direction ? this.updateHorizontalSinglelineAABBBounds(text) : this.updateVerticalSinglelineAABBBounds(text);
14715
- return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
14716
- }
14717
- updateMultilineAABBBounds(text) {
14718
- const textTheme = this.getGraphicTheme(),
14719
- {
14720
- direction = textTheme.direction,
14721
- underlineOffset = textTheme.underlineOffset
14722
- } = this.attribute,
14723
- b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
14724
- return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
14725
- }
14726
- updateHorizontalSinglelineAABBBounds(text) {
14727
- var _a, _b;
14728
- const textTheme = this.getGraphicTheme(),
14729
- {
14730
- wrap = textTheme.wrap
14731
- } = this.attribute;
14732
- if (wrap) return this.updateWrapAABBBounds([text]);
14733
- const textMeasure = application.graphicUtil.textMeasure;
14734
- let width, str;
14735
- const attribute = this.attribute,
14736
- {
14737
- maxLineWidth = textTheme.maxLineWidth,
14738
- ellipsis = textTheme.ellipsis,
14739
- textAlign = textTheme.textAlign,
14740
- textBaseline = textTheme.textBaseline,
14741
- fontFamily = textTheme.fontFamily,
14742
- fontSize = textTheme.fontSize,
14743
- fontWeight = textTheme.fontWeight,
14744
- stroke = textTheme.stroke,
14745
- lineWidth = textTheme.lineWidth,
14746
- ignoreBuf = textTheme.ignoreBuf,
14747
- whiteSpace = textTheme.whiteSpace,
14748
- suffixPosition = textTheme.suffixPosition
14749
- } = attribute;
14750
- if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
14751
- const buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
14752
- textFontSize = attribute.fontSize || textTheme.fontSize,
14753
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
14754
- if (!this.shouldUpdateShape() && this.cache) {
14755
- width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
14756
- const dx = textDrawOffsetX(textAlign, width),
14757
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
14758
- return this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14759
- }
14760
- if (Number.isFinite(maxLineWidth)) {
14761
- if (ellipsis) {
14762
- const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
14763
- data = textMeasure.clipTextWithSuffix(text.toString(), {
14764
- fontSize: fontSize,
14765
- fontWeight: fontWeight,
14766
- fontFamily: fontFamily
14767
- }, maxLineWidth, strEllipsis, !1, suffixPosition);
14768
- str = data.str, width = data.width;
14769
- } else {
14770
- const data = textMeasure.clipText(text.toString(), {
14771
- fontSize: fontSize,
14772
- fontWeight: fontWeight,
14773
- fontFamily: fontFamily
14774
- }, maxLineWidth, !1);
14775
- str = data.str, width = data.width;
14776
- }
14777
- this.cache.clipedText = str, this.cache.clipedWidth = width;
14778
- } else width = textMeasure.measureTextWidth(text.toString(), {
14779
- fontSize: fontSize,
14780
- fontWeight: fontWeight,
14781
- fontFamily: fontFamily
14782
- }), this.cache.clipedText = text.toString(), this.cache.clipedWidth = width;
14783
- this.clearUpdateShapeTag();
14784
- const dx = textDrawOffsetX(textAlign, width);
14785
- let lh = lineHeight;
14786
- application.global && application.global.isSafari() && (lh += .2 * fontSize);
14787
- const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);
14788
- return this._AABBBounds.set(dx, dy, dx + width, dy + lh), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14789
- }
14790
- getBaselineMapAlign() {
14791
- return Text.baselineMapAlign;
14792
- }
14793
- getAlignMapBaseline() {
14794
- return Text.alignMapBaseline;
14795
- }
14796
- updateVerticalSinglelineAABBBounds(text) {
14797
- var _a, _b, _c;
14798
- const textTheme = this.getGraphicTheme(),
14799
- textMeasure = application.graphicUtil.textMeasure;
14800
- let width;
14801
- const attribute = this.attribute,
14802
- {
14803
- ignoreBuf = textTheme.ignoreBuf
14804
- } = attribute,
14805
- buf = ignoreBuf ? 0 : 2,
14806
- {
14807
- maxLineWidth = textTheme.maxLineWidth,
14808
- ellipsis = textTheme.ellipsis,
14809
- fontSize = textTheme.fontSize,
14810
- fontWeight = textTheme.fontWeight,
14811
- fontFamily = textTheme.fontFamily,
14812
- stroke = textTheme.stroke,
14813
- lineWidth = textTheme.lineWidth,
14814
- verticalMode = textTheme.verticalMode,
14815
- suffixPosition = textTheme.suffixPosition
14816
- } = attribute,
14817
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14818
- let {
14819
- textAlign = textTheme.textAlign,
14820
- textBaseline = textTheme.textBaseline
14821
- } = attribute;
14822
- if (!verticalMode) {
14823
- const t = textAlign;
14824
- textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
14825
- }
14826
- if (!this.shouldUpdateShape() && this.cache) {
14827
- width = this.cache.clipedWidth;
14828
- const dx = textDrawOffsetX(textAlign, width),
14829
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
14830
- return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14831
- }
14832
- let verticalList = [verticalLayout(text.toString())];
14833
- if (Number.isFinite(maxLineWidth)) {
14834
- if (ellipsis) {
14835
- const strEllipsis = !0 === ellipsis ? textTheme.ellipsis : ellipsis,
14836
- data = textMeasure.clipTextWithSuffixVertical(verticalList[0], {
14837
- fontSize: fontSize,
14838
- fontWeight: fontWeight,
14839
- fontFamily: fontFamily
14840
- }, maxLineWidth, strEllipsis, !1, suffixPosition);
14841
- verticalList = [data.verticalList], width = data.width;
14842
- } else {
14843
- const data = textMeasure.clipTextVertical(verticalList[0], {
14844
- fontSize: fontSize,
14845
- fontWeight: fontWeight,
14846
- fontFamily: fontFamily
14847
- }, maxLineWidth, !1);
14848
- verticalList = [data.verticalList], width = data.width;
14849
- }
14850
- this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
14851
- } else width = 0, verticalList[0].forEach(t => {
14852
- const w = t.direction === exports.TextDirection.HORIZONTAL ? fontSize : textMeasure.measureTextWidth(t.text, {
14853
- fontSize: fontSize,
14854
- fontWeight: fontWeight,
14855
- fontFamily: fontFamily
14856
- });
14857
- width += w, t.width = w;
14858
- }), this.cache.verticalList = verticalList, this.cache.clipedWidth = width;
14859
- this.clearUpdateShapeTag();
14860
- const dx = textDrawOffsetX(textAlign, width),
14861
- dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
14862
- return this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14863
- }
14864
- updateHorizontalMultilineAABBBounds(text) {
14865
- var _a, _b;
14866
- const textTheme = this.getGraphicTheme(),
14867
- {
14868
- wrap = textTheme.wrap
14869
- } = this.attribute;
14870
- if (wrap) return this.updateWrapAABBBounds(text);
14871
- const attribute = this.attribute,
14872
- {
14873
- fontFamily = textTheme.fontFamily,
14874
- textAlign = textTheme.textAlign,
14875
- textBaseline = textTheme.textBaseline,
14876
- fontSize = textTheme.fontSize,
14877
- fontWeight = textTheme.fontWeight,
14878
- ellipsis = textTheme.ellipsis,
14879
- maxLineWidth: maxLineWidth,
14880
- stroke = textTheme.stroke,
14881
- lineWidth = textTheme.lineWidth,
14882
- whiteSpace = textTheme.whiteSpace,
14883
- suffixPosition = textTheme.suffixPosition
14884
- } = attribute,
14885
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
14886
- if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
14887
- if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
14888
- const bbox = this.cache.layoutData.bbox;
14889
- return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14890
- }
14891
- const textMeasure = application.graphicUtil.textMeasure,
14892
- layoutData = new CanvasTextLayout(fontFamily, {
14893
- fontSize: fontSize,
14894
- fontWeight: fontWeight,
14895
- fontFamily: fontFamily
14896
- }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
14897
- {
14898
- bbox: bbox
14899
- } = layoutData;
14900
- return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14901
- }
14902
14981
  updateVerticalMultilineAABBBounds(text) {
14903
- var _a, _b, _c;
14982
+ var _a, _b;
14904
14983
  const textTheme = this.getGraphicTheme(),
14905
14984
  textMeasure = application.graphicUtil.textMeasure;
14906
14985
  let width;
14907
14986
  const attribute = this.attribute,
14908
- {
14909
- ignoreBuf = textTheme.ignoreBuf
14910
- } = attribute,
14911
- buf = ignoreBuf ? 0 : 2,
14912
14987
  {
14913
14988
  maxLineWidth = textTheme.maxLineWidth,
14914
14989
  ellipsis = textTheme.ellipsis,
@@ -14920,14 +14995,14 @@
14920
14995
  verticalMode = textTheme.verticalMode,
14921
14996
  suffixPosition = textTheme.suffixPosition
14922
14997
  } = attribute,
14923
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14998
+ lineHeight = this.getLineHeight(attribute, textTheme);
14924
14999
  let {
14925
15000
  textAlign = textTheme.textAlign,
14926
15001
  textBaseline = textTheme.textBaseline
14927
15002
  } = attribute;
14928
15003
  if (!verticalMode) {
14929
15004
  const t = textAlign;
14930
- textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
15005
+ textAlign = null !== (_a = Text.baselineMapAlign[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = Text.alignMapBaseline[t]) && void 0 !== _b ? _b : "top";
14931
15006
  }
14932
15007
  if (width = 0, !this.shouldUpdateShape() && this.cache) {
14933
15008
  this.cache.verticalList.forEach(item => {
@@ -14975,6 +15050,15 @@
14975
15050
  dy = textLayoutOffsetY(textBaseline, height, fontSize);
14976
15051
  return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14977
15052
  }
15053
+ getMaxWidth(theme) {
15054
+ var _a, _b;
15055
+ const attribute = this.attribute;
15056
+ return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
15057
+ }
15058
+ getLineHeight(attribute, textTheme) {
15059
+ var _a;
15060
+ return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
15061
+ }
14978
15062
  needUpdateTags(keys) {
14979
15063
  let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
14980
15064
  return super.needUpdateTags(keys, k);
@@ -14989,6 +15073,12 @@
14989
15073
  getNoWorkAnimateAttr() {
14990
15074
  return Text.NOWORK_ANIMATE_ATTR;
14991
15075
  }
15076
+ getBaselineMapAlign() {
15077
+ return Text.baselineMapAlign;
15078
+ }
15079
+ getAlignMapBaseline() {
15080
+ return Text.alignMapBaseline;
15081
+ }
14992
15082
  }
14993
15083
  Text.NOWORK_ANIMATE_ATTR = Object.assign({
14994
15084
  ellipsis: 1,
@@ -15067,7 +15157,9 @@
15067
15157
  const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
15068
15158
  linesLayout.push({
15069
15159
  str: clip.str,
15070
- width: clip.width
15160
+ width: clip.width,
15161
+ ascent: 0,
15162
+ descent: 0
15071
15163
  });
15072
15164
  break;
15073
15165
  }
@@ -15081,7 +15173,9 @@
15081
15173
  }
15082
15174
  if (linesLayout.push({
15083
15175
  str: clip.str,
15084
- width: clip.width
15176
+ width: clip.width,
15177
+ ascent: 0,
15178
+ descent: 0
15085
15179
  }), clip.str.length === str.length) ;else if (needCut) {
15086
15180
  const newStr = str.substring(clip.str.length);
15087
15181
  lines.splice(i + 1, 0, newStr);
@@ -15100,13 +15194,17 @@
15100
15194
  const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
15101
15195
  linesLayout.push({
15102
15196
  str: clip.str,
15103
- width: clip.width
15197
+ width: clip.width,
15198
+ ascent: 0,
15199
+ descent: 0
15104
15200
  }), lineWidth = Math.max(lineWidth, clip.width);
15105
15201
  break;
15106
15202
  }
15107
15203
  text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
15108
15204
  str: text,
15109
- width: width
15205
+ width: width,
15206
+ ascent: 0,
15207
+ descent: 0
15110
15208
  });
15111
15209
  }
15112
15210
  bboxWH[0] = lineWidth;
@@ -15150,6 +15248,9 @@
15150
15248
  bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
15151
15249
  } else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
15152
15250
  }
15251
+ parseSize(size) {
15252
+ return isNumber$1(size) ? size : Math.min(size[0], size[1]);
15253
+ }
15153
15254
  }
15154
15255
 
15155
15256
  function circle(ctx, r, x, y, z) {
@@ -15160,13 +15261,13 @@
15160
15261
  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";
15161
15262
  }
15162
15263
  draw(ctx, size, x, y, z) {
15163
- return circle(ctx, size / 2, x, y, z);
15264
+ return circle(ctx, this.parseSize(size) / 2, x, y, z);
15164
15265
  }
15165
15266
  drawOffset(ctx, size, x, y, offset, z) {
15166
- return circle(ctx, size / 2 + offset, x, y, z);
15267
+ return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
15167
15268
  }
15168
15269
  drawToSvgPath(size, x, y, z) {
15169
- const r = size / 2;
15270
+ const r = this.parseSize(size) / 2;
15170
15271
  return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
15171
15272
  }
15172
15273
  }
@@ -15183,10 +15284,10 @@
15183
15284
  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";
15184
15285
  }
15185
15286
  draw(ctx, size, x, y, z) {
15186
- return cross(ctx, size / 6, x, y, z);
15287
+ return cross(ctx, this.parseSize(size) / 6, x, y, z);
15187
15288
  }
15188
15289
  drawOffset(ctx, size, x, y, offset, z) {
15189
- return crossOffset(ctx, size / 6, x, y, offset, z);
15290
+ return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
15190
15291
  }
15191
15292
  }
15192
15293
  var cross$1 = new CrossSymbol();
@@ -15199,13 +15300,13 @@
15199
15300
  super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
15200
15301
  }
15201
15302
  draw(ctx, size, x, y, z) {
15202
- return diamond(ctx, size / 2, x, y, z);
15303
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
15203
15304
  }
15204
15305
  drawFitDir(ctx, size, x, y, z) {
15205
- return diamond(ctx, size / 2, x, y, z);
15306
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
15206
15307
  }
15207
15308
  drawOffset(ctx, size, x, y, offset, z) {
15208
- return diamond(ctx, size / 2 + offset, x, y, z);
15309
+ return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
15209
15310
  }
15210
15311
  }
15211
15312
  var diamond$1 = new DiamondSymbol();
@@ -15219,10 +15320,10 @@
15219
15320
  super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
15220
15321
  }
15221
15322
  draw(ctx, size, x, y) {
15222
- return square(ctx, size / 2, x, y);
15323
+ return square(ctx, this.parseSize(size) / 2, x, y);
15223
15324
  }
15224
15325
  drawOffset(ctx, size, x, y, offset) {
15225
- return square(ctx, size / 2 + offset, x, y);
15326
+ return square(ctx, this.parseSize(size) / 2 + offset, x, y);
15226
15327
  }
15227
15328
  }
15228
15329
  var square$1 = new SquareSymbol();
@@ -15236,10 +15337,10 @@
15236
15337
  super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
15237
15338
  }
15238
15339
  draw(ctx, size, x, y) {
15239
- return trianglUpOffset(ctx, size / 2, x, y);
15340
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
15240
15341
  }
15241
15342
  drawOffset(ctx, size, x, y, offset) {
15242
- return trianglUpOffset(ctx, size / 2, x, y, offset);
15343
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15243
15344
  }
15244
15345
  }
15245
15346
  var triangleUp = new TriangleUpSymbol();
@@ -15271,10 +15372,10 @@
15271
15372
  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";
15272
15373
  }
15273
15374
  draw(ctx, size, transX, transY) {
15274
- return star(ctx, size / 2, transX, transY);
15375
+ return star(ctx, this.parseSize(size) / 2, transX, transY);
15275
15376
  }
15276
15377
  drawOffset(ctx, size, transX, transY, offset) {
15277
- return star(ctx, size / 2 + offset, transX, transY);
15378
+ return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15278
15379
  }
15279
15380
  }
15280
15381
  var star$1 = new StarSymbol();
@@ -15292,10 +15393,10 @@
15292
15393
  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";
15293
15394
  }
15294
15395
  draw(ctx, size, transX, transY) {
15295
- return arrow(ctx, size / 2, transX, transY);
15396
+ return arrow(ctx, this.parseSize(size) / 2, transX, transY);
15296
15397
  }
15297
15398
  drawOffset(ctx, size, transX, transY, offset) {
15298
- return arrow(ctx, size / 2 + offset, transX, transY);
15399
+ return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15299
15400
  }
15300
15401
  }
15301
15402
  var arrow$1 = new ArrowSymbol();
@@ -15309,10 +15410,10 @@
15309
15410
  super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
15310
15411
  }
15311
15412
  draw(ctx, size, transX, transY) {
15312
- return wedge(ctx, size / 2, transX, transY);
15413
+ return wedge(ctx, this.parseSize(size) / 2, transX, transY);
15313
15414
  }
15314
15415
  drawOffset(ctx, size, transX, transY, offset) {
15315
- return wedge(ctx, size / 2 + offset, transX, transY);
15416
+ return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15316
15417
  }
15317
15418
  }
15318
15419
  var wedge$1 = new WedgeSymbol();
@@ -15325,10 +15426,10 @@
15325
15426
  super(...arguments), this.type = "stroke", this.pathStr = "";
15326
15427
  }
15327
15428
  draw(ctx, size, transX, transY) {
15328
- return stroke(ctx, size / 2, transX, transY);
15429
+ return stroke(ctx, this.parseSize(size) / 2, transX, transY);
15329
15430
  }
15330
15431
  drawOffset(ctx, size, transX, transY, offset) {
15331
- return stroke(ctx, size / 2 + offset, transX, transY);
15432
+ return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15332
15433
  }
15333
15434
  }
15334
15435
  var stroke$1 = new StrokeSymbol();
@@ -15350,10 +15451,10 @@
15350
15451
  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";
15351
15452
  }
15352
15453
  draw(ctx, size, transX, transY) {
15353
- return wye(ctx, size / 2, transX, transY);
15454
+ return wye(ctx, this.parseSize(size) / 2, transX, transY);
15354
15455
  }
15355
15456
  drawOffset(ctx, size, transX, transY, offset) {
15356
- return wye(ctx, size / 2 + offset, transX, transY);
15457
+ return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15357
15458
  }
15358
15459
  }
15359
15460
  var wye$1 = new WyeSymbol();
@@ -15366,10 +15467,10 @@
15366
15467
  super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
15367
15468
  }
15368
15469
  draw(ctx, size, x, y) {
15369
- return trianglLeftOffset(ctx, size / 2, x, y, 0);
15470
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
15370
15471
  }
15371
15472
  drawOffset(ctx, size, x, y, offset) {
15372
- return trianglLeftOffset(ctx, size / 2, x, y, offset);
15473
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15373
15474
  }
15374
15475
  }
15375
15476
  var triangleLeft = new TriangleLeftSymbol();
@@ -15383,10 +15484,10 @@
15383
15484
  super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
15384
15485
  }
15385
15486
  draw(ctx, size, x, y) {
15386
- return trianglRightOffset(ctx, size / 2, x, y);
15487
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
15387
15488
  }
15388
15489
  drawOffset(ctx, size, x, y, offset) {
15389
- return trianglRightOffset(ctx, size / 2, x, y, offset);
15490
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15390
15491
  }
15391
15492
  }
15392
15493
  var triangleRight = new TriangleRightSymbol();
@@ -15400,10 +15501,10 @@
15400
15501
  super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
15401
15502
  }
15402
15503
  draw(ctx, size, x, y) {
15403
- return trianglDownOffset(ctx, size / 2, x, y);
15504
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
15404
15505
  }
15405
15506
  drawOffset(ctx, size, x, y, offset) {
15406
- return trianglDownOffset(ctx, size / 2, x, y, offset);
15507
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15407
15508
  }
15408
15509
  }
15409
15510
  var triangleDown = new TriangleDownSymbol();
@@ -15418,10 +15519,10 @@
15418
15519
  super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
15419
15520
  }
15420
15521
  draw(ctx, size, x, y) {
15421
- return thinTriangle(ctx, size / 2 / sqrt3, x, y);
15522
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
15422
15523
  }
15423
15524
  drawOffset(ctx, size, x, y, offset) {
15424
- return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
15525
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
15425
15526
  }
15426
15527
  }
15427
15528
  var thinTriangle$1 = new ThinTriangleSymbol();
@@ -15435,10 +15536,10 @@
15435
15536
  super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
15436
15537
  }
15437
15538
  draw(ctx, size, transX, transY) {
15438
- return arrow2Left(ctx, size / 4, transX, transY);
15539
+ return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
15439
15540
  }
15440
15541
  drawOffset(ctx, size, transX, transY, offset) {
15441
- return arrow2Left(ctx, size / 4 + offset, transX, transY);
15542
+ return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15442
15543
  }
15443
15544
  }
15444
15545
  var arrow2Left$1 = new Arrow2LeftSymbol();
@@ -15452,10 +15553,10 @@
15452
15553
  super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
15453
15554
  }
15454
15555
  draw(ctx, size, transX, transY) {
15455
- return arrow2Right(ctx, size / 4, transX, transY);
15556
+ return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
15456
15557
  }
15457
15558
  drawOffset(ctx, size, transX, transY, offset) {
15458
- return arrow2Right(ctx, size / 4 + offset, transX, transY);
15559
+ return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15459
15560
  }
15460
15561
  }
15461
15562
  var arrow2Right$1 = new Arrow2RightSymbol();
@@ -15469,10 +15570,10 @@
15469
15570
  super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
15470
15571
  }
15471
15572
  draw(ctx, size, transX, transY) {
15472
- return arrow2Up(ctx, size / 4, transX, transY);
15573
+ return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
15473
15574
  }
15474
15575
  drawOffset(ctx, size, transX, transY, offset) {
15475
- return arrow2Up(ctx, size / 4 + offset, transX, transY);
15576
+ return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15476
15577
  }
15477
15578
  }
15478
15579
  var arrow2Up$1 = new Arrow2UpSymbol();
@@ -15486,10 +15587,10 @@
15486
15587
  super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
15487
15588
  }
15488
15589
  draw(ctx, size, transX, transY) {
15489
- return arrow2Down(ctx, size / 4, transX, transY);
15590
+ return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
15490
15591
  }
15491
15592
  drawOffset(ctx, size, transX, transY, offset) {
15492
- return arrow2Down(ctx, size / 4 + offset, transX, transY);
15593
+ return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15493
15594
  }
15494
15595
  }
15495
15596
  var arrow2Down$1 = new Arrow2DownSymbol();
@@ -15502,13 +15603,13 @@
15502
15603
  super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
15503
15604
  }
15504
15605
  draw(ctx, size, x, y, z) {
15505
- return lineV(ctx, size / 2, x, y);
15606
+ return lineV(ctx, this.parseSize(size) / 2, x, y);
15506
15607
  }
15507
15608
  drawOffset(ctx, size, x, y, offset, z) {
15508
- return lineV(ctx, size / 2 + offset, x, y);
15609
+ return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
15509
15610
  }
15510
15611
  drawToSvgPath(size, x, y, z) {
15511
- const r = size / 2;
15612
+ const r = this.parseSize(size) / 2;
15512
15613
  return `M ${x}, ${y - r} L ${x},${y + r}`;
15513
15614
  }
15514
15615
  }
@@ -15522,13 +15623,13 @@
15522
15623
  super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
15523
15624
  }
15524
15625
  draw(ctx, size, x, y, z) {
15525
- return lineH(ctx, size / 2, x, y);
15626
+ return lineH(ctx, this.parseSize(size) / 2, x, y);
15526
15627
  }
15527
15628
  drawOffset(ctx, size, x, y, offset, z) {
15528
- return lineH(ctx, size / 2 + offset, x, y);
15629
+ return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
15529
15630
  }
15530
15631
  drawToSvgPath(size, x, y, z) {
15531
- const r = size / 2;
15632
+ const r = this.parseSize(size) / 2;
15532
15633
  return `M ${x - r}, ${y} L ${x + r},${y}`;
15533
15634
  }
15534
15635
  }
@@ -15542,13 +15643,13 @@
15542
15643
  super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
15543
15644
  }
15544
15645
  draw(ctx, size, x, y, z) {
15545
- return close(ctx, size / 2, x, y);
15646
+ return close(ctx, this.parseSize(size) / 2, x, y);
15546
15647
  }
15547
15648
  drawOffset(ctx, size, x, y, offset, z) {
15548
- return close(ctx, size / 2 + offset, x, y);
15649
+ return close(ctx, this.parseSize(size) / 2 + offset, x, y);
15549
15650
  }
15550
15651
  drawToSvgPath(size, x, y, z) {
15551
- const r = size / 2;
15652
+ const r = this.parseSize(size) / 2;
15552
15653
  return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
15553
15654
  }
15554
15655
  }
@@ -15582,15 +15683,18 @@
15582
15683
  this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
15583
15684
  }
15584
15685
  drawOffset(ctx, size, x, y, offset, z, cb) {
15585
- return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
15686
+ return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
15586
15687
  ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
15587
15688
  }), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
15588
15689
  }
15589
15690
  draw(ctx, size, x, y, z, cb) {
15590
- return this.drawOffset(ctx, size, x, y, 0, z, cb);
15691
+ return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
15692
+ }
15693
+ parseSize(size) {
15694
+ return isNumber$1(size) ? size : Math.min(size[0], size[1]);
15591
15695
  }
15592
15696
  bounds(size, bounds) {
15593
- if (this.isSvg) {
15697
+ if (size = this.parseSize(size), this.isSvg) {
15594
15698
  if (!this.svgCache) return;
15595
15699
  return bounds.clear(), void this.svgCache.forEach(_ref => {
15596
15700
  let {
@@ -16273,7 +16377,11 @@
16273
16377
  case "sub":
16274
16378
  baseline += this.descent / 2;
16275
16379
  }
16276
- "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();
16380
+ "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);
16381
+ const {
16382
+ lineWidth = 1
16383
+ } = this.character;
16384
+ 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();
16277
16385
  }
16278
16386
  getWidthWithEllips(direction) {
16279
16387
  let text = this.text;
@@ -18278,6 +18386,42 @@
18278
18386
  }
18279
18387
  }
18280
18388
 
18389
+ class AutoRefreshPlugin {
18390
+ constructor() {
18391
+ this.name = "AutoRefreshPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.handleChange = graphic => {
18392
+ graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage === this.pluginService.stage && null != graphic.stage && graphic.stage.renderNextFrame();
18393
+ };
18394
+ }
18395
+ activate(context) {
18396
+ this.pluginService = context, this.dpr = application.global.devicePixelRatio, this.refresh();
18397
+ }
18398
+ refresh() {
18399
+ this._refreshByMediaQuery() || this._refreshByRaf();
18400
+ }
18401
+ _refreshByRaf() {
18402
+ const raf = application.global.getRequestAnimationFrame();
18403
+ this.rafId = raf(() => {
18404
+ application.global.devicePixelRatio !== this.dpr && (this.dpr = application.global.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0)), this.refresh();
18405
+ });
18406
+ }
18407
+ _refreshByMediaQuery() {
18408
+ try {
18409
+ const mqString = `(resolution: ${window.devicePixelRatio}dppx)`,
18410
+ updatePixelRatio = () => {
18411
+ window.devicePixelRatio !== this.dpr && (this.dpr = window.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0));
18412
+ };
18413
+ matchMedia(mqString).addEventListener("change", updatePixelRatio);
18414
+ } catch (err) {
18415
+ return !1;
18416
+ }
18417
+ return !0;
18418
+ }
18419
+ deactivate(context) {
18420
+ const craf = application.global.getCancelAnimationFrame();
18421
+ craf && this.rafId && craf(this.rafId);
18422
+ }
18423
+ }
18424
+
18281
18425
  class IncrementalAutoRenderPlugin {
18282
18426
  constructor() {
18283
18427
  this.name = "IncrementalAutoRenderPlugin", this.activeEvent = "onRegister", this.nextFrameRenderGroupSet = new Set(), this.willNextFrameRender = !1, this.nextUserParams = {}, this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid;
@@ -18454,7 +18598,7 @@
18454
18598
  constructor() {
18455
18599
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18456
18600
  var _a;
18457
- super({}), this._onVisibleChange = visible => {
18601
+ super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
18458
18602
  if (!(this._skipRender < 0)) if (visible) {
18459
18603
  if (this.dirtyBounds) {
18460
18604
  const b = this.window.getViewBox();
@@ -18465,7 +18609,10 @@
18465
18609
  }, this.beforeRender = stage => {
18466
18610
  this._beforeRender && this._beforeRender(stage);
18467
18611
  }, this.afterRender = stage => {
18468
- this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null;
18612
+ this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
18613
+ }, this.afterTickCb = () => {
18614
+ var _a;
18615
+ this.tickedBeforeRender = !0, "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) || "rendering" !== this.state && this.render();
18469
18616
  }, this.params = params, this.theme = new Theme(), this.hooks = {
18470
18617
  beforeRender: new SyncHook(["stage"]),
18471
18618
  afterRender: new SyncHook(["stage"])
@@ -18480,9 +18627,9 @@
18480
18627
  canvas: params.canvas
18481
18628
  }), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig$1.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
18482
18629
  main: !0
18483
- })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), !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({
18630
+ })), 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({
18484
18631
  background: this._background
18485
- });
18632
+ }), this.ticker.on("afterTick", this.afterTickCb);
18486
18633
  }
18487
18634
  pauseRender() {
18488
18635
  let sr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
@@ -18615,6 +18762,14 @@
18615
18762
  this.pluginService.unRegister(plugin);
18616
18763
  }));
18617
18764
  }
18765
+ enableAutoRefresh() {
18766
+ this.autoRefresh || (this.autoRefresh = !0, this.pluginService.register(new AutoRefreshPlugin()));
18767
+ }
18768
+ disableAutoRefresh() {
18769
+ this.autoRefresh && (this.autoRefresh = !1, this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach(plugin => {
18770
+ this.pluginService.unRegister(plugin);
18771
+ }));
18772
+ }
18618
18773
  enableIncrementalAutoRender() {
18619
18774
  this.increaseAutoRender || (this.increaseAutoRender = !0, this.pluginService.register(new IncrementalAutoRenderPlugin()));
18620
18775
  }
@@ -18703,7 +18858,7 @@
18703
18858
  if ("released" === this.releaseStatus) return;
18704
18859
  this.ticker.start(), this.timeline.resume();
18705
18860
  const state = this.state;
18706
- 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++;
18861
+ 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++;
18707
18862
  }
18708
18863
  combineLayersToWindow() {
18709
18864
  if ("harmony" === this.global.env) {
@@ -18809,7 +18964,7 @@
18809
18964
  layer.release();
18810
18965
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
18811
18966
  item.setStage && item.setStage(null, null), this.interactiveLayer.removeChild(item);
18812
- }), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.renderService.renderTreeRoots = [];
18967
+ }), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.ticker.removeListener("afterTick", this.afterTickCb), this.renderService.renderTreeRoots = [];
18813
18968
  }
18814
18969
  setStage(stage) {}
18815
18970
  dirty(b, matrix) {
@@ -18887,8 +19042,6 @@
18887
19042
  return new Stage(params);
18888
19043
  }
18889
19044
 
18890
- const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
18891
-
18892
19045
  var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
18893
19046
  var d,
18894
19047
  c = arguments.length,
@@ -19621,27 +19774,9 @@
19621
19774
  for (let i = 1, len = points.length; i < len; i++) deltaX = points[i].x - lastX, deltaY = points[i].y - lastY, deltaX * deltaX + deltaY * deltaY > sqTolerance && (lastX = points[i].x, lastY = points[i].y, newPoints.push(points[i]));
19622
19775
  return points[points.length - 1].x === lastX && points[points.length - 1].y === lastY || newPoints.push(points[points.length - 1]), newPoints;
19623
19776
  }
19624
- function simplifyDPStep(points, startIdx, endIdx, sqTolerance, simplified) {
19625
- let maxSqDist = sqTolerance,
19626
- nextIdx = startIdx;
19627
- const startX = points[startIdx].x,
19628
- startY = points[startIdx].y,
19629
- vecX2 = points[endIdx].x - startX,
19630
- vecY2 = points[endIdx].y - startY,
19631
- sqLength = vecX2 * vecX2 + vecY2 * vecY2;
19632
- let area, sqArea, sqDistance, vecX1, vecY1;
19633
- for (let i = startIdx + 1, len = endIdx - 1; i < len; i++) vecX1 = points[i].x - startX, vecY1 = points[i].y - startY, area = vecX1 * vecY2 - vecX2 * vecY1, sqArea = area * area, sqDistance = sqArea / sqLength, sqDistance > maxSqDist && (maxSqDist = sqDistance, nextIdx = i);
19634
- maxSqDist > sqTolerance && (nextIdx - startIdx > 2 && simplifyDPStep(points, startIdx, nextIdx, sqTolerance, simplified), simplified.push(points[nextIdx], points[nextIdx + 1]), endIdx - nextIdx > 2 && simplifyDPStep(points, nextIdx, endIdx, sqTolerance, simplified));
19635
- }
19636
- function simplifyDouglasPeucker(points, sqTolerance) {
19637
- const lastIdx = points.length - 1,
19638
- simplified = [points[0]];
19639
- return simplifyDPStep(points, 0, lastIdx, sqTolerance, simplified), simplified.push(points[lastIdx]), simplified;
19640
- }
19641
19777
  function flatten_simplify(points, tolerance, highestQuality) {
19642
19778
  if (points.length <= 10) return points;
19643
- const sqTolerance = void 0 !== tolerance ? tolerance * tolerance : 1;
19644
- return points = simplifyDouglasPeucker(points = highestQuality ? points : simplifyRadialDist(points, sqTolerance), sqTolerance);
19779
+ return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
19645
19780
  }
19646
19781
 
19647
19782
  function findCursorIndexIgnoreLinebreak(textConfig, cursorIndex) {
@@ -23678,7 +23813,7 @@
23678
23813
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23679
23814
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
23680
23815
  super(), this.cachedEvents = [], this.startPoints = [], this.processEvent = {}, this.throttleTimer = 0, this.emitThrottles = [], this.lastTapTarget = null, this.onStart = ev => {
23681
- this.reset(), this.startTime = clock.now();
23816
+ this.cachedEvents = [], this.startPoints = [], this.reset(), this.startTime = clock.now();
23682
23817
  const {
23683
23818
  cachedEvents: cachedEvents,
23684
23819
  startPoints: startPoints
@@ -23698,7 +23833,7 @@
23698
23833
  if (1 !== startPoints.length) this.startDistance = calcDistance(startPoints[0], startPoints[1]), this.center = getCenter([startPoints[0], startPoints[1]]);else {
23699
23834
  const event = cachedEvents[0];
23700
23835
  this.pressTimeout = setTimeout(() => {
23701
- event.direction = "none", event.deltaX = 0, event.deltaY = 0, event.points = startPoints, this.triggerStartEvent("press", event), this.triggerEvent("press", event), this.eventType = "press", this.direction = "none";
23836
+ event.direction = "none", event.deltaX = 0, event.deltaY = 0, event.points = startPoints, this.triggerStartEvent("press", event), this.triggerEvent("press", event), this.eventType = "press", this.direction = "none", this.pressTimeout = null;
23702
23837
  }, this.config.press.time);
23703
23838
  }
23704
23839
  }, this.onMove = ev => {
@@ -23761,10 +23896,10 @@
23761
23896
  lastMovePoint = this.lastMovePoint || startPoints[0],
23762
23897
  distance = calcDistance(prevMovePoint, lastMovePoint),
23763
23898
  velocity = distance / intervalTime;
23764
- velocity > this.config.swipe.velocity && distance > this.config.swipe.threshold && (endEvent.velocity = velocity, endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), this.triggerEvent("swipe", endEvent));
23899
+ if (velocity > this.config.swipe.velocity && distance > this.config.swipe.threshold) return endEvent.velocity = velocity, endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), this.triggerEvent("swipe", endEvent), this.cachedEvents = [], this.startPoints = [], void this.reset();
23765
23900
  }
23766
23901
  }
23767
- now - this.lastTapTime < this.config.tap.interval && ev.target === this.lastTapTarget ? this.tapCount++ : this.tapCount = 1, this.lastTapTime = now, this.lastTapTarget = ev.target, 1 === this.tapCount ? this.triggerEvent("tap", endEvent) : 2 === this.tapCount && (this.triggerEvent("doubletap", endEvent), this.tapCount = 0);
23902
+ now - this.startTime < this.config.press.time && (now - this.lastTapTime < this.config.tap.interval && ev.target === this.lastTapTarget ? this.tapCount++ : this.tapCount = 1, this.lastTapTime = now, this.lastTapTarget = ev.target, 1 === this.tapCount ? this.triggerEvent("tap", endEvent) : 2 === this.tapCount && (this.triggerEvent("doubletap", endEvent), this.tapCount = 0));
23768
23903
  }
23769
23904
  for (let i = 0, len = cachedEvents.length; i < len; i++) if (cachedEvents[i].pointerId === endEvent.pointerId) {
23770
23905
  cachedEvents.splice(i, 1), startPoints.splice(i, 1);
@@ -23806,7 +23941,7 @@
23806
23941
  startTime: startTime,
23807
23942
  startPoints: startPoints
23808
23943
  } = this;
23809
- if (eventType) return eventType;
23944
+ if ("press" === eventType) return eventType;
23810
23945
  let type;
23811
23946
  return type = clock.now() - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold ? "press" : "pan", this.eventType = type, type;
23812
23947
  }
@@ -23840,6 +23975,7 @@
23840
23975
  emitThrottles: emitThrottles
23841
23976
  } = this;
23842
23977
  throttleTimer || (this.throttleTimer = application.global.getRequestAnimationFrame()(() => {
23978
+ application.global.getCancelAnimationFrame()(this.throttleTimer), this.throttleTimer = null;
23843
23979
  for (let i = 0, len = emitThrottles.length; i < len; i++) {
23844
23980
  const {
23845
23981
  type: type,
@@ -23847,7 +23983,7 @@
23847
23983
  } = emitThrottles[i];
23848
23984
  this.emitEvent(type, ev);
23849
23985
  }
23850
- this.throttleTimer = 0, this.emitThrottles.length = 0;
23986
+ this.emitThrottles.length = 0;
23851
23987
  }));
23852
23988
  }
23853
23989
  triggerStartEvent(type, ev) {
@@ -24337,9 +24473,10 @@
24337
24473
  lineJoin = defaultParams.lineJoin,
24338
24474
  lineDash = defaultParams.lineDash,
24339
24475
  lineCap = defaultParams.lineCap,
24340
- miterLimit = defaultParams.miterLimit
24476
+ miterLimit = defaultParams.miterLimit,
24477
+ keepStrokeScale = defaultParams.keepStrokeScale
24341
24478
  } = attribute;
24342
- _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;
24479
+ _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;
24343
24480
  }
24344
24481
  }
24345
24482
  setTextStyleWithoutAlignBaseline(params, defaultParams, z) {
@@ -25239,8 +25376,9 @@
25239
25376
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, (context, arcAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, arcAttribute, themeAttribute) => {
25240
25377
  if (picked) return !0;
25241
25378
  const lineWidth = arcAttribute.lineWidth || themeAttribute.lineWidth,
25242
- pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
25243
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25379
+ pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
25380
+ keepStrokeScale = arcAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
25381
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25244
25382
  }), pickContext.highPerformanceRestore(), picked;
25245
25383
  }
25246
25384
  }
@@ -25513,8 +25651,9 @@
25513
25651
  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) => {
25514
25652
  if (picked) return !0;
25515
25653
  const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
25516
- pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
25517
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25654
+ pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
25655
+ keepStrokeScale = rectAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
25656
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25518
25657
  });else {
25519
25658
  const {
25520
25659
  fill = rectAttribute.fill,
@@ -25828,9 +25967,10 @@
25828
25967
  lineJoin = defaultParams.lineJoin,
25829
25968
  lineDash = defaultParams.lineDash,
25830
25969
  lineCap = defaultParams.lineCap,
25831
- miterLimit = defaultParams.miterLimit
25970
+ miterLimit = defaultParams.miterLimit,
25971
+ keepStrokeScale = defaultParams.keepStrokeScale
25832
25972
  } = attribute;
25833
- _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;
25973
+ _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;
25834
25974
  }
25835
25975
  }
25836
25976
  measureText(text) {
@@ -26458,9 +26598,10 @@
26458
26598
  lineJoin = defaultParams.lineJoin,
26459
26599
  lineDash = defaultParams.lineDash,
26460
26600
  lineCap = defaultParams.lineCap,
26461
- miterLimit = defaultParams.miterLimit
26601
+ miterLimit = defaultParams.miterLimit,
26602
+ keepStrokeScale = defaultParams.keepStrokeScale
26462
26603
  } = attribute;
26463
- _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);
26604
+ _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);
26464
26605
  }
26465
26606
  }
26466
26607
  setTextStyleWithoutAlignBaseline(params, defaultParams) {
@@ -27500,9 +27641,10 @@
27500
27641
  lineJoin = defaultParams.lineJoin,
27501
27642
  lineDash = defaultParams.lineDash,
27502
27643
  lineCap = defaultParams.lineCap,
27503
- miterLimit = defaultParams.miterLimit
27644
+ miterLimit = defaultParams.miterLimit,
27645
+ keepStrokeScale = defaultParams.keepStrokeScale
27504
27646
  } = attribute;
27505
- _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;
27647
+ _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;
27506
27648
  }
27507
27649
  }
27508
27650
  measureText(text) {
@@ -27909,8 +28051,9 @@
27909
28051
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, context => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, lineAttribute, themeAttribute) => {
27910
28052
  if (picked) return !0;
27911
28053
  const lineWidth = lineAttribute.lineWidth || themeAttribute.lineWidth,
27912
- pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
27913
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
28054
+ pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
28055
+ keepStrokeScale = lineAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
28056
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
27914
28057
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
27915
28058
  }
27916
28059
  }
@@ -28045,8 +28188,9 @@
28045
28188
  return this.canvasRenderer.drawShape(symbol, pickContext, x, y, {}, null, (context, symbolAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, symbolAttribute, themeAttribute) => {
28046
28189
  if (picked) return !0;
28047
28190
  const lineWidth = symbolAttribute.lineWidth || themeAttribute.lineWidth,
28048
- pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
28049
- return pickContext.lineWidth = getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
28191
+ pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
28192
+ keepStrokeScale = symbolAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
28193
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
28050
28194
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
28051
28195
  }
28052
28196
  };
@@ -28483,7 +28627,7 @@
28483
28627
 
28484
28628
  const roughModule = _roughModule;
28485
28629
 
28486
- const version = "0.21.0-alpha.1";
28630
+ const version = "0.21.0-alpha.10";
28487
28631
  preLoadAllModule();
28488
28632
  if (isBrowserEnv()) {
28489
28633
  loadBrowserEnv(container);