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

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,9 @@
3941
3956
  suffixPosition: "end",
3942
3957
  underlineDash: [],
3943
3958
  underlineOffset: 0,
3944
- disableAutoClipedPoptip: void 0
3959
+ disableAutoClipedPoptip: void 0,
3960
+ measureMode: exports.MeasureModeEnum.fontBounding,
3961
+ keepCenterInLine: !1
3945
3962
  };
3946
3963
  const DefaultPickStyle = {
3947
3964
  pickStrokeBuffer: 0
@@ -3985,6 +4002,7 @@
3985
4002
  zIndex: 0,
3986
4003
  layout: null,
3987
4004
  boundsPadding: 0,
4005
+ fillStrokeOrder: 0,
3988
4006
  renderStyle: "default",
3989
4007
  pickMode: "accurate",
3990
4008
  customPickShape: null,
@@ -3994,7 +4012,8 @@
3994
4012
  globalZIndex: 1,
3995
4013
  globalCompositeOperation: "",
3996
4014
  overflow: "hidden",
3997
- shadowPickMode: "graphic"
4015
+ shadowPickMode: "graphic",
4016
+ keepStrokeScale: !1
3998
4017
  }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
3999
4018
  function addAttributeToPrototype(obj, c, keys) {
4000
4019
  keys.forEach(key => {
@@ -4063,6 +4082,7 @@
4063
4082
  });
4064
4083
  const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4065
4084
  path: new CustomPath2D(),
4085
+ fillStrokeOrder: 1,
4066
4086
  customPath: () => {
4067
4087
  Logger.getInstance().warn("空函数");
4068
4088
  }
@@ -4268,10 +4288,32 @@
4268
4288
  configure(service, env) {
4269
4289
  this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
4270
4290
  }
4271
- measureTextWidth(text, options) {
4272
- if (!this.context) return this.estimate(text, options).width;
4291
+ _measureTextWithoutAlignBaseline(text, options, compatible) {
4273
4292
  this.context.setTextStyleWithoutAlignBaseline(options);
4274
- return this.context.measureText(text).width;
4293
+ const metrics = this.context.measureText(text);
4294
+ return compatible ? this.compatibleMetrics(metrics, options) : metrics;
4295
+ }
4296
+ _measureTextWithAlignBaseline(text, options, compatible) {
4297
+ this.context.setTextStyle(options);
4298
+ const metrics = this.context.measureText(text);
4299
+ return compatible ? this.compatibleMetrics(metrics, options) : metrics;
4300
+ }
4301
+ compatibleMetrics(metrics, options) {
4302
+ if (null == metrics.actualBoundingBoxAscent || null == metrics.actualBoundingBoxDescent || null == metrics.fontBoundingBoxAscent || null == metrics.fontBoundingBoxDescent) {
4303
+ const {
4304
+ ascent: ascent,
4305
+ descent: descent
4306
+ } = this.measureTextBoundADscentEstimate(options);
4307
+ metrics.actualBoundingBoxAscent = ascent, metrics.actualBoundingBoxDescent = descent, metrics.fontBoundingBoxAscent = ascent, metrics.fontBoundingBoxDescent = descent;
4308
+ }
4309
+ if (null == metrics.actualBoundingBoxLeft || null == metrics.actualBoundingBoxRight) {
4310
+ const {
4311
+ left: left,
4312
+ right: right
4313
+ } = this.measureTextBoundLeftRightEstimate(options);
4314
+ metrics.actualBoundingBoxLeft = left, metrics.actualBoundingBoxRight = right;
4315
+ }
4316
+ return metrics;
4275
4317
  }
4276
4318
  estimate(text, _ref) {
4277
4319
  let {
@@ -4285,19 +4327,97 @@
4285
4327
  height: fontSize
4286
4328
  };
4287
4329
  }
4288
- measureTextPixelHeight(text, options) {
4330
+ measureTextWidth(text, options, textMeasure) {
4331
+ return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
4332
+ }
4333
+ measureTextBoundsWidth(text, options, textMeasure) {
4334
+ return this.context ? (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithoutAlignBaseline(text, options)).width : this.estimate(text, options).width;
4335
+ }
4336
+ measureTextBoundsLeftRight(text, options, textMeasure) {
4337
+ return this.context ? {
4338
+ left: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxLeft,
4339
+ right: textMeasure.actualBoundingBoxRight
4340
+ } : this.measureTextBoundLeftRightEstimate(options);
4341
+ }
4342
+ measureTextPixelHeight(text, options, textMeasure) {
4289
4343
  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);
4344
+ 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
4345
  }
4295
- measureTextBoundHieght(text, options) {
4346
+ measureTextPixelADscent(text, options, textMeasure) {
4347
+ return this.context ? {
4348
+ ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).actualBoundingBoxAscent,
4349
+ descent: textMeasure.actualBoundingBoxDescent
4350
+ } : this.measureTextBoundADscentEstimate(options);
4351
+ }
4352
+ measureTextBoundHieght(text, options, textMeasure) {
4296
4353
  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);
4354
+ 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;
4355
+ }
4356
+ measureTextBoundADscent(text, options, textMeasure) {
4357
+ return this.context ? {
4358
+ ascent: (textMeasure = null != textMeasure ? textMeasure : this._measureTextWithAlignBaseline(text, options, !0)).fontBoundingBoxAscent,
4359
+ descent: textMeasure.fontBoundingBoxDescent
4360
+ } : this.measureTextBoundADscentEstimate(options);
4361
+ }
4362
+ measureTextBoundADscentEstimate(options) {
4363
+ var _a;
4364
+ const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize;
4365
+ return {
4366
+ ascent: .79 * fontSize,
4367
+ descent: .21 * fontSize
4368
+ };
4369
+ }
4370
+ measureTextBoundLeftRightEstimate(options) {
4371
+ var _a;
4372
+ const fontSize = null !== (_a = options.fontSize) && void 0 !== _a ? _a : DefaultTextStyle.fontSize,
4373
+ {
4374
+ textAlign: textAlign
4375
+ } = options;
4376
+ return "center" === textAlign ? {
4377
+ left: fontSize / 2,
4378
+ right: fontSize / 2
4379
+ } : "right" === textAlign || "end" === textAlign ? {
4380
+ left: fontSize,
4381
+ right: 0
4382
+ } : {
4383
+ left: 0,
4384
+ right: fontSize
4385
+ };
4386
+ }
4387
+ measureTextPixelADscentAndWidth(text, options, mode) {
4388
+ if (!this.context) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4389
+ width: this.estimate(text, options).width
4390
+ });
4391
+ const out = this._measureTextWithoutAlignBaseline(text, options, !0);
4392
+ if (mode === exports.MeasureModeEnum.actualBounding) return {
4393
+ ascent: out.actualBoundingBoxAscent,
4394
+ descent: out.actualBoundingBoxDescent,
4395
+ width: out.width
4396
+ };
4397
+ if (mode === exports.MeasureModeEnum.estimate) return Object.assign(Object.assign({}, this.measureTextBoundADscentEstimate(options)), {
4398
+ width: out.width
4399
+ });
4400
+ if (mode === exports.MeasureModeEnum.fontBounding) {
4401
+ let ascent = out.fontBoundingBoxAscent,
4402
+ descent = out.fontBoundingBoxDescent;
4403
+ if (out.actualBoundingBoxDescent && descent < out.actualBoundingBoxDescent) {
4404
+ const delta = out.actualBoundingBoxDescent - descent;
4405
+ descent += delta, ascent -= delta;
4406
+ } else if (out.actualBoundingBoxAscent && ascent < out.actualBoundingBoxAscent) {
4407
+ const delta = out.actualBoundingBoxAscent - ascent;
4408
+ ascent += delta, descent -= delta;
4409
+ }
4410
+ return {
4411
+ ascent: ascent,
4412
+ descent: descent,
4413
+ width: out.width
4414
+ };
4415
+ }
4416
+ return {
4417
+ ascent: out.actualBoundingBoxAscent,
4418
+ descent: out.actualBoundingBoxDescent,
4419
+ width: out.width
4420
+ };
4301
4421
  }
4302
4422
  measureText(text, options) {
4303
4423
  return this.context ? (this.context.setTextStyleWithoutAlignBaseline(options), this.context.measureText(text)) : this.estimate(text, options);
@@ -4375,6 +4495,14 @@
4375
4495
  return data;
4376
4496
  }
4377
4497
  _clipTextEnd(text, options, width, leftIdx, rightIdx) {
4498
+ if (leftIdx === rightIdx) {
4499
+ Logger.getInstance().warn(`【_clipTextEnd】不应该走到这里${text}, ${leftIdx}, ${rightIdx}`);
4500
+ const subText = text.substring(0, rightIdx + 1);
4501
+ return {
4502
+ str: subText,
4503
+ width: this.measureTextWidth(subText, options)
4504
+ };
4505
+ }
4378
4506
  const middleIdx = Math.floor((leftIdx + rightIdx) / 2),
4379
4507
  subText = text.substring(0, middleIdx + 1),
4380
4508
  strWidth = this.measureTextWidth(subText, options);
@@ -4408,7 +4536,7 @@
4408
4536
  }
4409
4537
  _clipTextStart(text, options, width, leftIdx, rightIdx) {
4410
4538
  const middleIdx = Math.ceil((leftIdx + rightIdx) / 2),
4411
- subText = text.substring(middleIdx - 1, text.length - 1),
4539
+ subText = text.substring(middleIdx - 1, text.length),
4412
4540
  strWidth = this.measureTextWidth(subText, options);
4413
4541
  let length;
4414
4542
  if (strWidth > width) {
@@ -4416,18 +4544,18 @@
4416
4544
  str: "",
4417
4545
  width: 0
4418
4546
  };
4419
- const str = text.substring(middleIdx, text.length - 1);
4547
+ const str = text.substring(middleIdx, text.length);
4420
4548
  return length = this.measureTextWidth(str, options), length <= width ? {
4421
4549
  str: str,
4422
4550
  width: length
4423
- } : this._clipTextStart(text, options, width, middleIdx, text.length - 1);
4551
+ } : this._clipTextStart(text, options, width, middleIdx, text.length);
4424
4552
  }
4425
4553
  if (strWidth < width) {
4426
4554
  if (middleIdx <= 0) return {
4427
4555
  str: text,
4428
4556
  width: this.measureTextWidth(text, options)
4429
4557
  };
4430
- const str = text.substring(middleIdx - 2, text.length - 1);
4558
+ const str = text.substring(middleIdx - 2, text.length);
4431
4559
  return length = this.measureTextWidth(str, options), length >= width ? {
4432
4560
  str: subText,
4433
4561
  width: strWidth
@@ -5088,7 +5216,7 @@
5088
5216
  }
5089
5217
  hasSubView() {
5090
5218
  const viewBox = this._handler.getViewBox();
5091
- return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
5219
+ return !(0 === viewBox.x1 && 0 === viewBox.y1 && isNumberClose(this.width, viewBox.width()) && isNumberClose(this.height, viewBox.height()));
5092
5220
  }
5093
5221
  isVisible(bbox) {
5094
5222
  return this._handler.isVisible(bbox);
@@ -6012,7 +6140,7 @@
6012
6140
  timeStamp: now
6013
6141
  });
6014
6142
  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);
6143
+ 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
6144
  }
6017
6145
  this.freeEvent(e);
6018
6146
  }, this.onPointerUpOutside = (from, target) => {
@@ -6229,7 +6357,8 @@
6229
6357
  supportsPointerEvents = global.supportsPointerEvents
6230
6358
  } = params;
6231
6359
  this.manager = new EventManager(rootNode, {
6232
- clickInterval: clickInterval
6360
+ clickInterval: clickInterval,
6361
+ supportsTouchEvents: supportsTouchEvents
6233
6362
  }), 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
6363
  default: "inherit",
6235
6364
  pointer: "pointer"
@@ -6400,7 +6529,7 @@
6400
6529
  }
6401
6530
  }
6402
6531
 
6403
- class DefaultTicker {
6532
+ class DefaultTicker extends EventEmitter {
6404
6533
  set mode(m) {
6405
6534
  this._mode !== m && (this._mode = m, this.setupTickHandler());
6406
6535
  }
@@ -6409,17 +6538,17 @@
6409
6538
  }
6410
6539
  constructor() {
6411
6540
  let timelines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6412
- this.handleTick = (handler, params) => {
6541
+ super(), this.handleTick = (handler, params) => {
6413
6542
  const {
6414
6543
  once = !1
6415
6544
  } = null != params ? params : {};
6416
- this.ifCanStop() ? this.stop() : (this._handlerTick(handler), once || handler.tick(this.interval, this.handleTick));
6417
- }, this._handlerTick = handler => {
6545
+ this.ifCanStop() ? this.stop() : (this._handlerTick(), once || handler.tick(this.interval, this.handleTick));
6546
+ }, this._handlerTick = () => {
6418
6547
  const time = this.tickerHandler.getTime();
6419
6548
  let delta = 0;
6420
6549
  this.lastFrameTime >= 0 && (delta = time - this.lastFrameTime), this.lastFrameTime = time, this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(t => {
6421
6550
  t.tick(delta);
6422
- }));
6551
+ }), this.emit("afterTick"));
6423
6552
  }, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.timelines = timelines, this.autoStop = !0;
6424
6553
  }
6425
6554
  init() {
@@ -6515,6 +6644,9 @@
6515
6644
  stop() {
6516
6645
  this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
6517
6646
  }
6647
+ trySyncTickStatus() {
6648
+ this.status === STATUS$1.RUNNING && this._handlerTick();
6649
+ }
6518
6650
  }
6519
6651
 
6520
6652
  class ManualTickHandler {
@@ -7656,7 +7788,7 @@
7656
7788
  lastMatchedIndex = i, lastMatchedPoint = tagMap.get(this.toPoints[i].context);
7657
7789
  break;
7658
7790
  }
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);
7791
+ "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
7792
  let prevMatchedPoint = this.toPoints[0];
7661
7793
  this.interpolatePoints = this.toPoints.map((point, index) => {
7662
7794
  const matchedPoint = tagMap.get(point.context);
@@ -7668,11 +7800,19 @@
7668
7800
  return newPoint.defined = toPoint.defined, newPoint.context = toPoint.context, newPoint;
7669
7801
  });
7670
7802
  }
7803
+ onFirstRun() {
7804
+ const lastClipRange = this.target.attribute.clipRange;
7805
+ isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
7806
+ }
7671
7807
  onUpdate(end, ratio, out) {
7672
7808
  if (this.points = this.points.map((point, index) => {
7673
7809
  const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
7674
7810
  return newPoint.context = point.context, newPoint;
7675
- }), this.clipRange && (out.clipRange = this.clipRange + (1 - this.clipRange) * ratio), this.segmentsCache && this.to.segments) {
7811
+ }), this.clipRange) {
7812
+ 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));
7813
+ out.clipRange = this.clipRange + (1 - this.clipRange) * ratio;
7814
+ }
7815
+ if (this.segmentsCache && this.to.segments) {
7676
7816
  let start = 0;
7677
7817
  out.segments = this.to.segments.map((segment, index) => {
7678
7818
  const end = start + this.segmentsCache[index],
@@ -12026,7 +12166,8 @@
12026
12166
  x: originX = arcAttribute.x,
12027
12167
  y: originY = arcAttribute.y,
12028
12168
  scaleX = arcAttribute.scaleX,
12029
- scaleY = arcAttribute.scaleY
12169
+ scaleY = arcAttribute.scaleY,
12170
+ keepStrokeScale = arcAttribute.keepStrokeScale
12030
12171
  } = arc.attribute;
12031
12172
  let {
12032
12173
  innerRadius = arcAttribute.innerRadius,
@@ -12038,7 +12179,7 @@
12038
12179
  {
12039
12180
  distance = arcAttribute[key].distance
12040
12181
  } = borderStyle,
12041
- d = getScaledStroke(context, distance, context.dpr),
12182
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12042
12183
  deltaAngle = distance / outerRadius,
12043
12184
  sign = "outerBorder" === key ? 1 : -1;
12044
12185
  if (arc.setAttributes({
@@ -12083,14 +12224,15 @@
12083
12224
  x: originX = circleAttribute.x,
12084
12225
  y: originY = circleAttribute.y,
12085
12226
  scaleX = circleAttribute.scaleX,
12086
- scaleY = circleAttribute.scaleY
12227
+ scaleY = circleAttribute.scaleY,
12228
+ keepStrokeScale = circleAttribute.keepStrokeScale
12087
12229
  } = circle.attribute,
12088
12230
  renderBorder = (borderStyle, key) => {
12089
12231
  const doStroke = !(!borderStyle || !borderStyle.stroke),
12090
12232
  {
12091
12233
  distance = circleAttribute[key].distance
12092
12234
  } = borderStyle,
12093
- d = getScaledStroke(context, distance, context.dpr),
12235
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12094
12236
  sign = "outerBorder" === key ? 1 : -1;
12095
12237
  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
12238
  const lastOpacity = circleAttribute[key].opacity;
@@ -12209,7 +12351,8 @@
12209
12351
  scaleX = rectAttribute.scaleX,
12210
12352
  scaleY = rectAttribute.scaleY,
12211
12353
  x1: x1,
12212
- y1: y1
12354
+ y1: y1,
12355
+ keepStrokeScale = rectAttribute.keepStrokeScale
12213
12356
  } = rect.attribute;
12214
12357
  let {
12215
12358
  width: width,
@@ -12222,7 +12365,7 @@
12222
12365
  {
12223
12366
  distance = rectAttribute[key].distance
12224
12367
  } = borderStyle,
12225
- d = getScaledStroke(context, distance, context.dpr),
12368
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12226
12369
  nextX = x + sign * d,
12227
12370
  nextY = y + sign * d,
12228
12371
  dw = 2 * d;
@@ -12379,14 +12522,15 @@
12379
12522
  x: originX = symbolAttribute.x,
12380
12523
  y: originY = symbolAttribute.y,
12381
12524
  scaleX = symbolAttribute.scaleX,
12382
- scaleY = symbolAttribute.scaleY
12525
+ scaleY = symbolAttribute.scaleY,
12526
+ keepStrokeScale = symbolAttribute.keepStrokeScale
12383
12527
  } = symbol.attribute,
12384
12528
  renderBorder = (borderStyle, key) => {
12385
12529
  const doStroke = !(!borderStyle || !borderStyle.stroke),
12386
12530
  {
12387
12531
  distance = symbolAttribute[key].distance
12388
12532
  } = borderStyle,
12389
- d = getScaledStroke(context, distance, context.dpr),
12533
+ d = keepStrokeScale ? distance : getScaledStroke(context, distance, context.dpr),
12390
12534
  sign = "outerBorder" === key ? 1 : -1;
12391
12535
  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
12536
  const lastOpacity = symbolAttribute[key].opacity;
@@ -12506,7 +12650,8 @@
12506
12650
  fill = arcAttribute.fill,
12507
12651
  stroke = arcAttribute.stroke,
12508
12652
  x: originX = arcAttribute.x,
12509
- y: originY = arcAttribute.y
12653
+ y: originY = arcAttribute.y,
12654
+ fillStrokeOrder = arcAttribute.fillStrokeOrder
12510
12655
  } = arc.attribute,
12511
12656
  data = this.valid(arc, arcAttribute, fillCb, strokeCb);
12512
12657
  if (!data) return;
@@ -12542,7 +12687,17 @@
12542
12687
  isFullStroke: isFullStroke,
12543
12688
  stroke: arrayStroke
12544
12689
  } = 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) {
12690
+ if (doFill || isFullStroke) {
12691
+ 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);
12692
+ const _runFill = () => {
12693
+ doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
12694
+ },
12695
+ _runStroke = () => {
12696
+ doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()));
12697
+ };
12698
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
12699
+ }
12700
+ if (!isFullStroke && doStroke) {
12546
12701
  context.beginPath();
12547
12702
  drawArcPath$1(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
12548
12703
  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 +12715,20 @@
12560
12715
  fill = arcAttribute.fill
12561
12716
  } = arc.attribute,
12562
12717
  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()));
12718
+ 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);
12719
+ const _runFill = () => {
12720
+ if (doFill) {
12721
+ const color = fill;
12722
+ if ("conical" === color.gradient) {
12723
+ const lastColor = getConicGradientAt(0, 0, endAngle, color);
12724
+ fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
12725
+ }
12726
+ }
12727
+ },
12728
+ _runStroke = () => {
12729
+ doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
12730
+ };
12731
+ _runFill(), _runStroke();
12571
12732
  }
12572
12733
  }
12573
12734
  this.afterRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), tempChangeConicalColor && (fill.startAngle += conicalOffset, fill.endAngle += conicalOffset);
@@ -12605,7 +12766,8 @@
12605
12766
  startAngle = circleAttribute.startAngle,
12606
12767
  endAngle = circleAttribute.endAngle,
12607
12768
  x: originX = circleAttribute.x,
12608
- y: originY = circleAttribute.y
12769
+ y: originY = circleAttribute.y,
12770
+ fillStrokeOrder = circleAttribute.fillStrokeOrder
12609
12771
  } = circle.attribute,
12610
12772
  data = this.valid(circle, circleAttribute, fillCb, strokeCb);
12611
12773
  if (!data) return;
@@ -12615,7 +12777,14 @@
12615
12777
  doFill: doFill,
12616
12778
  doStroke: doStroke
12617
12779
  } = 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);
12780
+ 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);
12781
+ const _runFill = () => {
12782
+ doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.fill()));
12783
+ },
12784
+ _runStroke = () => {
12785
+ doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.stroke()));
12786
+ };
12787
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
12619
12788
  }
12620
12789
  draw(circle, renderService, drawContext, params) {
12621
12790
  const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle;
@@ -13056,7 +13225,7 @@
13056
13225
  super(), this.areaRenderContribitions = areaRenderContribitions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(areaRenderContribitions);
13057
13226
  }
13058
13227
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
13059
- var _a, _b, _c, _d, _e;
13228
+ var _a, _b, _c;
13060
13229
  const {
13061
13230
  points: points
13062
13231
  } = area.attribute;
@@ -13080,28 +13249,31 @@
13080
13249
  x: originX = 0,
13081
13250
  x: originY = 0
13082
13251
  } = 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, {
13252
+ !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
13253
  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);
13254
+ }), (() => {
13255
+ var _a, _b;
13256
+ if (stroke) {
13257
+ const {
13258
+ stroke = areaAttribute && areaAttribute.stroke
13259
+ } = area.attribute;
13260
+ if (isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
13261
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
13262
+ for (let i = 1; i < points.length; i++) {
13263
+ const p = points[i];
13264
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
13265
+ }
13266
+ } else if (stroke[2]) {
13267
+ const endP = points[points.length - 1];
13268
+ context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
13269
+ for (let i = points.length - 2; i >= 0; i--) {
13270
+ const p = points[i];
13271
+ 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);
13272
+ }
13101
13273
  }
13274
+ strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13102
13275
  }
13103
- strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
13104
- }
13276
+ })();
13105
13277
  }
13106
13278
  drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
13107
13279
  var _a, _b, _c, _d, _e, _f;
@@ -13266,23 +13438,24 @@
13266
13438
  x: originX = 0,
13267
13439
  x: originY = 0
13268
13440
  } = 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, {
13441
+ 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
13442
  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;
13443
+ }), (() => {
13444
+ if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
13445
+ const {
13446
+ stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
13447
+ } = attribute;
13448
+ 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", {
13449
+ offsetX: offsetX,
13450
+ offsetY: offsetY,
13451
+ offsetZ: offsetZ,
13452
+ drawConnect: connect,
13453
+ mode: connectedType,
13454
+ zeroX: connectedX,
13455
+ zeroY: connectedY
13456
+ })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
13457
+ }
13458
+ })(), !1;
13286
13459
  }
13287
13460
  };
13288
13461
  exports.DefaultCanvasAreaRender = __decorate$1v([injectable(), __param$N(0, inject(ContributionProvider)), __param$N(0, named(AreaRenderContribution)), __metadata$19("design:paramtypes", [Object])], exports.DefaultCanvasAreaRender);
@@ -13314,7 +13487,8 @@
13314
13487
  const pathAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : getTheme(path, null == params ? void 0 : params.theme).path,
13315
13488
  {
13316
13489
  x: originX = pathAttribute.x,
13317
- y: originY = pathAttribute.y
13490
+ y: originY = pathAttribute.y,
13491
+ fillStrokeOrder = pathAttribute.fillStrokeOrder
13318
13492
  } = path.attribute,
13319
13493
  z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
13320
13494
  data = this.valid(path, pathAttribute, fillCb, strokeCb);
@@ -13329,7 +13503,14 @@
13329
13503
  const path2D = null !== (_c = path.attribute.path) && void 0 !== _c ? _c : pathAttribute.path;
13330
13504
  renderCommandList(path2D.commandList, context, x, y, 1, 1, z);
13331
13505
  }
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);
13506
+ context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute), this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13507
+ const _runStroke = () => {
13508
+ doStroke && (strokeCb ? strokeCb(context, path.attribute, pathAttribute) : sVisible && (context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.stroke()));
13509
+ },
13510
+ _runFill = () => {
13511
+ doFill && (fillCb ? fillCb(context, path.attribute, pathAttribute) : fVisible && (context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.fill()));
13512
+ };
13513
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
13333
13514
  }
13334
13515
  draw(path, renderService, drawContext, params) {
13335
13516
  const pathAttribute = getTheme(path, null == params ? void 0 : params.theme).path;
@@ -13373,7 +13554,8 @@
13373
13554
  x1: x1,
13374
13555
  y1: y1,
13375
13556
  x: originX = rectAttribute.x,
13376
- y: originY = rectAttribute.y
13557
+ y: originY = rectAttribute.y,
13558
+ fillStrokeOrder = rectAttribute.fillStrokeOrder
13377
13559
  } = rect.attribute;
13378
13560
  let {
13379
13561
  width: width,
@@ -13392,7 +13574,14 @@
13392
13574
  doFill: doFill,
13393
13575
  doStroke: doStroke
13394
13576
  };
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);
13577
+ context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
13578
+ const _runFill = () => {
13579
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
13580
+ },
13581
+ _runStroke = () => {
13582
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
13583
+ };
13584
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
13396
13585
  }
13397
13586
  draw(rect, renderService, drawContext, params) {
13398
13587
  const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect;
@@ -13428,7 +13617,8 @@
13428
13617
  x: originX = symbolAttribute.x,
13429
13618
  y: originY = symbolAttribute.y,
13430
13619
  scaleX = symbolAttribute.scaleX,
13431
- scaleY = symbolAttribute.scaleY
13620
+ scaleY = symbolAttribute.scaleY,
13621
+ fillStrokeOrder = symbolAttribute.fillStrokeOrder
13432
13622
  } = symbol.attribute,
13433
13623
  data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
13434
13624
  if (!data) return;
@@ -13451,14 +13641,27 @@
13451
13641
  const obj = Object.assign({}, a);
13452
13642
  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
13643
  }
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()));
13644
+ const _runFill = () => {
13645
+ a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill()));
13646
+ },
13647
+ _runStroke = () => {
13648
+ a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13649
+ };
13650
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
13455
13651
  };
13456
13652
  if (keepDirIn3d && context.camera && context.project) {
13457
13653
  const p = context.project(x, y, z),
13458
13654
  camera = context.camera;
13459
13655
  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
13656
  } 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);
13657
+ context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13658
+ const _runFill = () => {
13659
+ doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
13660
+ },
13661
+ _runStroke = () => {
13662
+ doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
13663
+ };
13664
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
13462
13665
  }
13463
13666
  draw(symbol, renderService, drawContext, params) {
13464
13667
  const symbolAttribute = getTheme(symbol, null == params ? void 0 : params.theme).symbol;
@@ -13605,16 +13808,8 @@
13605
13808
  verticalMode = textAttribute.verticalMode,
13606
13809
  x: originX = textAttribute.x,
13607
13810
  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,
13811
+ } = text.attribute,
13812
+ lineHeight = null !== (_a = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _a ? _a : fontSize,
13618
13813
  data = this.valid(text, textAttribute, fillCb, strokeCb);
13619
13814
  if (!data) return;
13620
13815
  const {
@@ -13634,79 +13829,60 @@
13634
13829
  const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
13635
13830
  matrix.rotateByCenter(Math.PI / 2, _x, _y), context.transformFromMatrix(matrix, !0), matrixAllocate.free(matrix);
13636
13831
  }
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());
13832
+ 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
13833
  };
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
- });
13834
+ if (context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z), "horizontal" === direction) {
13835
+ const {
13836
+ multilineLayout: multilineLayout
13837
+ } = text;
13838
+ if (!multilineLayout) return void context.highPerformanceRestore();
13839
+ const {
13840
+ xOffset: xOffset,
13841
+ yOffset: yOffset
13842
+ } = multilineLayout.bbox;
13843
+ doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13844
+ context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
13845
+ }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
13846
+ 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, {
13847
+ width: line.width
13683
13848
  });
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);
13849
+ })));
13690
13850
  } else {
13851
+ let {
13852
+ textAlign = textAttribute.textAlign,
13853
+ textBaseline = textAttribute.textBaseline
13854
+ } = text.attribute;
13855
+ if (!verticalMode) {
13856
+ const t = textAlign;
13857
+ textAlign = null !== (_b = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = text.getAlignMapBaseline()[t]) && void 0 !== _c ? _c : "top";
13858
+ }
13691
13859
  text.tryUpdateAABBBounds();
13692
- const cache = text.cache;
13693
- if (cache) {
13694
- context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
13695
- const {
13860
+ const cache = text.cache,
13861
+ {
13696
13862
  verticalList: verticalList
13697
13863
  } = 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 => {
13864
+ context.textAlign = "left", context.textBaseline = "top";
13865
+ const totalHeight = lineHeight * verticalList.length;
13866
+ let totalW = 0;
13867
+ verticalList.forEach(verticalData => {
13868
+ const _w = verticalData.reduce((a, b) => a + (b.width || 0), 0);
13869
+ totalW = max(_w, totalW);
13870
+ });
13871
+ let offsetY = 0,
13872
+ offsetX = 0;
13873
+ "bottom" === textBaseline ? offsetX = -totalHeight : "middle" === textBaseline && (offsetX = -totalHeight / 2), "center" === textAlign ? offsetY -= totalW / 2 : "right" === textAlign && (offsetY -= totalW), verticalList.forEach((verticalData, i) => {
13874
+ const currentW = verticalData.reduce((a, b) => a + (b.width || 0), 0),
13875
+ dw = totalW - currentW;
13876
+ let currentOffsetY = offsetY;
13877
+ "center" === textAlign ? currentOffsetY += dw / 2 : "right" === textAlign && (currentOffsetY += dw), verticalData.forEach(item => {
13702
13878
  const {
13703
13879
  text: text,
13704
13880
  width: width,
13705
13881
  direction: direction
13706
13882
  } = item;
13707
- drawText(text, offsetX, offsetY, direction), offsetY += width;
13883
+ drawText(text, totalHeight - (i + 1) * lineHeight + offsetX, currentOffsetY, direction), currentOffsetY += width;
13708
13884
  });
13709
- }
13885
+ });
13710
13886
  }
13711
13887
  transform3dMatrixToContextMatrix && this.restoreTransformUseContext2d(text, textAttribute, z, context), this.afterRenderStep(text, context, x, y, doFill, doStroke, fVisible, sVisible, textAttribute, drawContext, fillCb, strokeCb);
13712
13888
  }
@@ -13718,12 +13894,10 @@
13718
13894
  computed3dMatrix = !keepDirIn3d;
13719
13895
  this._draw(text, textAttribute, computed3dMatrix, drawContext, params);
13720
13896
  }
13721
- drawUnderLine(underline, lineThrough, text, x, y, z, textAttribute, context, multiOption) {
13897
+ drawUnderLine(underline, lineThrough, text, anchorX, anchorY, offsetUnderLineY, offsetThroughLineY, z, textAttribute, context, multiOption) {
13722
13898
  if (lineThrough + underline <= 0) return;
13723
13899
  const {
13724
13900
  textAlign = textAttribute.textAlign,
13725
- textBaseline = textAttribute.textBaseline,
13726
- fontSize = textAttribute.fontSize,
13727
13901
  fill = textAttribute.fill,
13728
13902
  opacity = textAttribute.opacity,
13729
13903
  underlineOffset = textAttribute.underlineOffset,
@@ -13733,23 +13907,21 @@
13733
13907
  isMulti = !isNil$1(multiOption),
13734
13908
  w = isMulti ? multiOption.width : text.clipedWidth,
13735
13909
  offsetX = isMulti ? 0 : textDrawOffsetX(textAlign, w),
13736
- offsetY = textLayoutOffsetY(isMulti ? "alphabetic" : textBaseline, fontSize, fontSize),
13737
13910
  attribute = {
13738
13911
  lineWidth: 0,
13739
13912
  stroke: fill,
13740
13913
  opacity: opacity,
13741
13914
  strokeOpacity: fillOpacity
13742
13915
  };
13743
- let deltaY = isMulti ? -3 : 0;
13744
13916
  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();
13917
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
13918
+ const dy = anchorY + offsetUnderLineY + underlineOffset;
13919
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13748
13920
  }
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();
13921
+ if (lineThrough) {
13922
+ attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, anchorX, anchorY, textAttribute), context.beginPath();
13923
+ const dy = anchorY + offsetThroughLineY;
13924
+ context.moveTo(anchorX + offsetX, dy, z), context.lineTo(anchorX + offsetX + w, dy, z), context.stroke();
13753
13925
  }
13754
13926
  }
13755
13927
  };
@@ -13845,7 +14017,8 @@
13845
14017
  cornerRadius = polygonAttribute.cornerRadius,
13846
14018
  x: originX = polygonAttribute.x,
13847
14019
  y: originY = polygonAttribute.y,
13848
- closePath = polygonAttribute.closePath
14020
+ closePath = polygonAttribute.closePath,
14021
+ fillStrokeOrder = polygonAttribute.fillStrokeOrder
13849
14022
  } = polygon.attribute,
13850
14023
  data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
13851
14024
  if (!data) return;
@@ -13855,7 +14028,14 @@
13855
14028
  doFill: doFill,
13856
14029
  doStroke: doStroke
13857
14030
  } = 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);
14031
+ 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);
14032
+ const _runFill = () => {
14033
+ doFill && (fillCb ? fillCb(context, polygon.attribute, polygonAttribute) : fVisible && (context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.fill()));
14034
+ },
14035
+ _runStroke = () => {
14036
+ doStroke && (strokeCb ? strokeCb(context, polygon.attribute, polygonAttribute) : sVisible && (context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.stroke()));
14037
+ };
14038
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
13859
14039
  }
13860
14040
  draw(polygon, renderService, drawContext, params) {
13861
14041
  const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon;
@@ -13898,7 +14078,10 @@
13898
14078
  cornerRadius = groupAttribute.cornerRadius,
13899
14079
  path = groupAttribute.path,
13900
14080
  lineWidth = groupAttribute.lineWidth,
13901
- visible = groupAttribute.visible
14081
+ visible = groupAttribute.visible,
14082
+ fillStrokeOrder = groupAttribute.fillStrokeOrder,
14083
+ x: originX = groupAttribute.x,
14084
+ y: originY = groupAttribute.y
13902
14085
  } = group.attribute,
13903
14086
  fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
13904
14087
  sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
@@ -13924,7 +14107,14 @@
13924
14107
  };
13925
14108
  this._groupRenderContribitions.forEach(c => {
13926
14109
  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 => {
14110
+ }), clip && context.clip(), context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
14111
+ const _runFill = () => {
14112
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, group.attribute, groupAttribute) : fVisible && (context.setCommonStyle(group, group.attribute, originX - x, originY - y, groupAttribute), context.fill()));
14113
+ },
14114
+ _runStroke = () => {
14115
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, group.attribute, groupAttribute) : sVisible && (context.setStrokeStyle(group, group.attribute, originX - x, originY - y, groupAttribute), context.stroke()));
14116
+ };
14117
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this._groupRenderContribitions.forEach(c => {
13928
14118
  c.time === exports.BaseRenderContributionTime.afterFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb);
13929
14119
  });
13930
14120
  }
@@ -13990,6 +14180,7 @@
13990
14180
  x: originX = imageAttribute.x,
13991
14181
  y: originY = imageAttribute.y,
13992
14182
  cornerRadius = imageAttribute.cornerRadius,
14183
+ fillStrokeOrder = imageAttribute.fillStrokeOrder,
13993
14184
  image: url
13994
14185
  } = image.attribute,
13995
14186
  data = this.valid(image, imageAttribute, fillCb);
@@ -14000,20 +14191,26 @@
14000
14191
  doFill: doFill,
14001
14192
  doStroke: doStroke
14002
14193
  } = 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);
14194
+ context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14195
+ const _runFill = () => {
14196
+ if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
14197
+ if (!url || !image.resources) return;
14198
+ const res = image.resources.get(url);
14199
+ if ("success" !== res.state) return;
14200
+ let needRestore = !1;
14201
+ 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);
14202
+ let repeat = 0;
14203
+ if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
14204
+ const pattern = context.createPattern(res.data, repeatStr[repeat]);
14205
+ context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
14206
+ } else context.drawImage(res.data, x, y, width, height);
14207
+ needRestore && context.restore();
14208
+ }
14209
+ },
14210
+ _runStroke = () => {
14211
+ doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
14212
+ };
14213
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
14017
14214
  }
14018
14215
  draw(image, renderService, drawContext) {
14019
14216
  const {
@@ -14407,58 +14604,63 @@
14407
14604
  constructor(fontFamily, options, textMeasure) {
14408
14605
  this.fontFamily = fontFamily, this.textOptions = options, this.textMeasure = textMeasure;
14409
14606
  }
14410
- LayoutBBox(bbox, textAlign, textBaseline) {
14607
+ LayoutBBox(bbox, textAlign, textBaseline, linesLayout) {
14411
14608
  if ("left" === textAlign || "start" === textAlign) bbox.xOffset = 0;else if ("center" === textAlign) bbox.xOffset = bbox.width / -2;else {
14412
14609
  if ("right" !== textAlign && "end" !== textAlign) throw new Error("非法的textAlign");
14413
14610
  bbox.xOffset = -bbox.width;
14414
14611
  }
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);
14612
+ if ("top" === textBaseline) bbox.yOffset = 0;else if ("middle" === textBaseline) bbox.yOffset = bbox.height / -2;else if ("alphabetic" === textBaseline) {
14613
+ let percent = .79;
14614
+ if (1 === linesLayout.length) {
14615
+ const lineInfo = linesLayout[0];
14616
+ percent = lineInfo.ascent / (lineInfo.ascent + lineInfo.descent);
14617
+ }
14618
+ bbox.yOffset = bbox.height * -percent;
14619
+ } else bbox.yOffset = -bbox.height;
14620
+ return bbox;
14438
14621
  }
14439
14622
  GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
14440
14623
  let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
14441
14624
  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";
14625
+ let params = arguments.length > 6 ? arguments[6] : undefined;
14626
+ const {
14627
+ lineWidth: lineWidth,
14628
+ suffixPosition = "end",
14629
+ measureMode = exports.MeasureModeEnum.actualBounding,
14630
+ keepCenterInLine = !1
14631
+ } = null != params ? params : {};
14444
14632
  lines = lines.map(l => l.toString());
14445
14633
  const linesLayout = [],
14446
14634
  bboxWH = [0, 0];
14447
14635
  if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
14448
14636
  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
- });
14637
+ for (let i = 0, len = lines.length; i < len; i++) {
14638
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14639
+ width = Math.min(metrics.width, lineWidth), linesLayout.push({
14640
+ str: metrics.width <= lineWidth ? lines[i].toString() : this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14641
+ width: width,
14642
+ ascent: metrics.ascent,
14643
+ descent: metrics.descent,
14644
+ keepCenterInLine: keepCenterInLine
14645
+ });
14646
+ }
14453
14647
  bboxWH[0] = lineWidth;
14454
14648
  } 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;
14649
+ let width,
14650
+ text,
14651
+ _lineWidth = 0;
14652
+ for (let i = 0, len = lines.length; i < len; i++) {
14653
+ text = lines[i];
14654
+ const metrics = this.textMeasure.measureTextPixelADscentAndWidth(lines[i], this.textOptions, measureMode);
14655
+ width = metrics.width, _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
14656
+ str: text,
14657
+ width: width,
14658
+ ascent: metrics.ascent,
14659
+ descent: metrics.descent,
14660
+ keepCenterInLine: keepCenterInLine
14661
+ });
14662
+ }
14663
+ bboxWH[0] = _lineWidth;
14462
14664
  }
14463
14665
  bboxWH[1] = linesLayout.length * lineHeight, bboxWH[0] = linesLayout.reduce((a, b) => Math.max(a, b.width), 0);
14464
14666
  const bbox = {
@@ -14467,7 +14669,7 @@
14467
14669
  width: bboxWH[0],
14468
14670
  height: bboxWH[1]
14469
14671
  };
14470
- return this.LayoutBBox(bbox, textAlign, textBaseline), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14672
+ return this.LayoutBBox(bbox, textAlign, textBaseline, linesLayout), this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14471
14673
  }
14472
14674
  layoutWithBBox(bbox, lines, textAlign, textBaseline, lineHeight) {
14473
14675
  const origin = [0, 0],
@@ -14486,11 +14688,16 @@
14486
14688
  };
14487
14689
  }
14488
14690
  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;
14691
+ if ("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], !line.keepCenterInLine) {
14692
+ const buf = 0,
14693
+ actualHeightWithBuf = line.ascent + line.descent + buf;
14694
+ actualHeightWithBuf < lineHeight - buf && ("bottom" === textBaseline ? line.topOffset += (lineHeight - actualHeightWithBuf) / 2 : "top" === textBaseline && (line.topOffset -= (lineHeight - actualHeightWithBuf) / 2));
14695
+ }
14696
+ return origin[1] += lineHeight, line;
14490
14697
  }
14491
14698
  }
14492
14699
 
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];
14700
+ 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
14701
  class Text extends Graphic {
14495
14702
  get font() {
14496
14703
  const textTheme = this.getGraphicTheme();
@@ -14499,26 +14706,22 @@
14499
14706
  get clipedText() {
14500
14707
  var _a;
14501
14708
  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();
14709
+ textTheme = this.getGraphicTheme(),
14710
+ maxWidth = this.getMaxWidth(textTheme);
14711
+ return Number.isFinite(maxWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
14508
14712
  }
14509
14713
  get clipedWidth() {
14510
- if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
14714
+ return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
14511
14715
  }
14512
14716
  get cliped() {
14513
14717
  var _a, _b;
14514
14718
  const textTheme = this.getGraphicTheme(),
14515
14719
  attribute = this.attribute,
14516
- {
14517
- maxLineWidth = textTheme.maxLineWidth,
14518
- text: text,
14519
- whiteSpace = textTheme.whiteSpace
14520
- } = attribute;
14521
- if (!Number.isFinite(maxLineWidth)) return !1;
14720
+ maxWidth = this.getMaxWidth(textTheme);
14721
+ if (!Number.isFinite(maxWidth)) return !1;
14722
+ const {
14723
+ text: text
14724
+ } = this.attribute;
14522
14725
  if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
14523
14726
  let mergedText = "";
14524
14727
  this.cache.layoutData.lines.forEach(item => {
@@ -14529,10 +14732,7 @@
14529
14732
  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
14733
  }
14531
14734
  get multilineLayout() {
14532
- if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
14533
- }
14534
- isSimplify() {
14535
- return !this.isMultiLine && "vertical" !== this.attribute.direction;
14735
+ return this.tryUpdateAABBBounds(), this.cache.layoutData;
14536
14736
  }
14537
14737
  get isMultiLine() {
14538
14738
  return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
@@ -14605,8 +14805,74 @@
14605
14805
  }
14606
14806
  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
14807
  }
14808
+ updateSingallineAABBBounds(text) {
14809
+ this.updateMultilineAABBBounds([text]);
14810
+ const layoutData = this.cache.layoutData;
14811
+ if (layoutData) {
14812
+ const line = layoutData.lines[0];
14813
+ this.cache.clipedText = line.str, this.cache.clipedWidth = line.width;
14814
+ }
14815
+ return this._AABBBounds;
14816
+ }
14817
+ updateMultilineAABBBounds(text) {
14818
+ const textTheme = this.getGraphicTheme(),
14819
+ {
14820
+ direction = textTheme.direction,
14821
+ underlineOffset = textTheme.underlineOffset
14822
+ } = this.attribute,
14823
+ b = "horizontal" === direction ? this.updateHorizontalMultilineAABBBounds(text) : this.updateVerticalMultilineAABBBounds(text);
14824
+ return "horizontal" === direction && underlineOffset && this._AABBBounds.add(this._AABBBounds.x1, this._AABBBounds.y2 + underlineOffset), b;
14825
+ }
14826
+ guessLineHeightBuf(fontSize) {
14827
+ return fontSize ? .1 * fontSize : 0;
14828
+ }
14829
+ updateHorizontalMultilineAABBBounds(text) {
14830
+ var _a;
14831
+ const textTheme = this.getGraphicTheme(),
14832
+ attribute = this.attribute,
14833
+ {
14834
+ fontFamily = textTheme.fontFamily,
14835
+ textAlign = textTheme.textAlign,
14836
+ textBaseline = textTheme.textBaseline,
14837
+ fontSize = textTheme.fontSize,
14838
+ fontWeight = textTheme.fontWeight,
14839
+ ellipsis = textTheme.ellipsis,
14840
+ maxLineWidth: maxLineWidth,
14841
+ stroke = textTheme.stroke,
14842
+ wrap = textTheme.wrap,
14843
+ measureMode = textTheme.measureMode,
14844
+ lineWidth = textTheme.lineWidth,
14845
+ whiteSpace = textTheme.whiteSpace,
14846
+ suffixPosition = textTheme.suffixPosition,
14847
+ ignoreBuf = textTheme.ignoreBuf,
14848
+ keepCenterInLine = textTheme.keepCenterInLine
14849
+ } = attribute,
14850
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14851
+ lineHeight = this.getLineHeight(attribute, textTheme) + buf;
14852
+ if ("normal" === whiteSpace || wrap) return this.updateWrapAABBBounds(text);
14853
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14854
+ const bbox = this.cache.layoutData.bbox;
14855
+ return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14856
+ }
14857
+ const textMeasure = application.graphicUtil.textMeasure,
14858
+ layoutData = new CanvasTextLayout(fontFamily, {
14859
+ fontSize: fontSize,
14860
+ fontWeight: fontWeight,
14861
+ fontFamily: fontFamily,
14862
+ lineHeight: lineHeight
14863
+ }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, {
14864
+ lineWidth: maxLineWidth,
14865
+ suffixPosition: suffixPosition,
14866
+ measureMode: measureMode,
14867
+ keepCenterInLine: keepCenterInLine
14868
+ }),
14869
+ {
14870
+ bbox: bbox
14871
+ } = layoutData;
14872
+ 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;
14873
+ }
14608
14874
  updateWrapAABBBounds(text) {
14609
- var _a, _b, _c, _d;
14875
+ var _a, _b, _c;
14610
14876
  const textTheme = this.getGraphicTheme(),
14611
14877
  {
14612
14878
  fontFamily = textTheme.fontFamily,
@@ -14620,22 +14886,26 @@
14620
14886
  wordBreak = textTheme.wordBreak,
14621
14887
  fontWeight = textTheme.fontWeight,
14622
14888
  ignoreBuf = textTheme.ignoreBuf,
14889
+ measureMode = textTheme.measureMode,
14623
14890
  suffixPosition = textTheme.suffixPosition,
14624
14891
  heightLimit = 0,
14625
- lineClamp: lineClamp
14892
+ lineClamp: lineClamp,
14893
+ keepCenterInLine = textTheme.keepCenterInLine
14626
14894
  } = 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)) {
14895
+ buf = ignoreBuf ? 0 : this.guessLineHeightBuf(fontSize),
14896
+ lineHeight = this.getLineHeight(this.attribute, textTheme) + buf;
14897
+ if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14630
14898
  const bbox = this.cache.layoutData.bbox;
14631
14899
  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
14900
  }
14633
14901
  const textMeasure = application.graphicUtil.textMeasure,
14634
- layoutObj = new CanvasTextLayout(fontFamily, {
14902
+ textOptions = {
14635
14903
  fontSize: fontSize,
14636
14904
  fontWeight: fontWeight,
14637
- fontFamily: fontFamily
14638
- }, textMeasure),
14905
+ fontFamily: fontFamily,
14906
+ lineHeight: lineHeight
14907
+ },
14908
+ layoutObj = new CanvasTextLayout(fontFamily, textOptions, textMeasure),
14639
14909
  lines = isArray$1(text) ? text.map(l => l.toString()) : [text.toString()],
14640
14910
  linesLayout = [],
14641
14911
  bboxWH = [0, 0];
@@ -14645,29 +14915,37 @@
14645
14915
  const str = lines[i];
14646
14916
  let needCut = !0;
14647
14917
  if (i === lineCountLimit - 1) {
14648
- const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
14918
+ const clip = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1),
14919
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14649
14920
  linesLayout.push({
14650
14921
  str: clip.str,
14651
- width: clip.width
14922
+ width: clip.width,
14923
+ ascent: matrics.ascent,
14924
+ descent: matrics.descent,
14925
+ keepCenterInLine: keepCenterInLine
14652
14926
  });
14653
14927
  break;
14654
14928
  }
14655
- const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
14929
+ const clip = textMeasure.clipText(str, textOptions, maxLineWidth, "break-all" !== wordBreak, "keep-all" === wordBreak);
14656
14930
  if ("" !== str && "" === clip.str || clip.wordBreaked) {
14657
14931
  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;
14932
+ const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14933
+ clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
14660
14934
  } else clip.str = "", clip.width = 0;
14661
14935
  needCut = !1;
14662
14936
  }
14937
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14663
14938
  linesLayout.push({
14664
14939
  str: clip.str,
14665
- width: clip.width
14940
+ width: clip.width,
14941
+ ascent: matrics.ascent,
14942
+ descent: matrics.descent,
14943
+ keepCenterInLine: keepCenterInLine
14666
14944
  });
14667
14945
  let cutLength = clip.str.length;
14668
14946
  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);
14947
+ const newStr = str.substring(cutLength);
14948
+ lines.splice(i + 1, 0, newStr);
14671
14949
  }
14672
14950
  }
14673
14951
  let maxWidth = 0;
@@ -14680,235 +14958,46 @@
14680
14958
  lineWidth = 0;
14681
14959
  for (let i = 0, len = lines.length; i < len; i++) {
14682
14960
  if (i === lineCountLimit - 1) {
14683
- const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
14961
+ const clip = textMeasure.clipTextWithSuffix(lines[i], textOptions, maxLineWidth, ellipsis, !1, suffixPosition),
14962
+ matrics = textMeasure.measureTextPixelADscentAndWidth(clip.str, textOptions, measureMode);
14684
14963
  linesLayout.push({
14685
14964
  str: clip.str,
14686
- width: clip.width
14965
+ width: clip.width,
14966
+ ascent: matrics.ascent,
14967
+ descent: matrics.descent,
14968
+ keepCenterInLine: keepCenterInLine
14687
14969
  }), lineWidth = Math.max(lineWidth, clip.width);
14688
14970
  break;
14689
14971
  }
14690
- text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
14972
+ text = lines[i], width = textMeasure.measureTextWidth(text, textOptions), lineWidth = Math.max(lineWidth, width);
14973
+ const matrics = textMeasure.measureTextPixelADscentAndWidth(text, textOptions, measureMode);
14974
+ linesLayout.push({
14691
14975
  str: text,
14692
- width: width
14976
+ width: width,
14977
+ ascent: matrics.ascent,
14978
+ descent: matrics.descent,
14979
+ keepCenterInLine: keepCenterInLine
14693
14980
  });
14694
14981
  }
14695
14982
  bboxWH[0] = lineWidth;
14696
14983
  }
14697
- bboxWH[1] = linesLayout.length * (lineHeight + buf);
14984
+ bboxWH[1] = linesLayout.length * lineHeight;
14698
14985
  const bbox = {
14699
14986
  xOffset: 0,
14700
14987
  yOffset: 0,
14701
14988
  width: bboxWH[0],
14702
14989
  height: bboxWH[1]
14703
14990
  };
14704
- layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
14991
+ layoutObj.LayoutBBox(bbox, textAlign, textBaseline, linesLayout);
14705
14992
  const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14706
14993
  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
14994
  }
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
14995
  updateVerticalMultilineAABBBounds(text) {
14903
- var _a, _b, _c;
14996
+ var _a, _b;
14904
14997
  const textTheme = this.getGraphicTheme(),
14905
14998
  textMeasure = application.graphicUtil.textMeasure;
14906
14999
  let width;
14907
15000
  const attribute = this.attribute,
14908
- {
14909
- ignoreBuf = textTheme.ignoreBuf
14910
- } = attribute,
14911
- buf = ignoreBuf ? 0 : 2,
14912
15001
  {
14913
15002
  maxLineWidth = textTheme.maxLineWidth,
14914
15003
  ellipsis = textTheme.ellipsis,
@@ -14920,14 +15009,14 @@
14920
15009
  verticalMode = textTheme.verticalMode,
14921
15010
  suffixPosition = textTheme.suffixPosition
14922
15011
  } = attribute,
14923
- lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
15012
+ lineHeight = this.getLineHeight(attribute, textTheme);
14924
15013
  let {
14925
15014
  textAlign = textTheme.textAlign,
14926
15015
  textBaseline = textTheme.textBaseline
14927
15016
  } = attribute;
14928
15017
  if (!verticalMode) {
14929
15018
  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";
15019
+ textAlign = null !== (_a = Text.baselineMapAlign[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = Text.alignMapBaseline[t]) && void 0 !== _b ? _b : "top";
14931
15020
  }
14932
15021
  if (width = 0, !this.shouldUpdateShape() && this.cache) {
14933
15022
  this.cache.verticalList.forEach(item => {
@@ -14975,6 +15064,15 @@
14975
15064
  dy = textLayoutOffsetY(textBaseline, height, fontSize);
14976
15065
  return this._AABBBounds.set(dy, dx, dy + height, dx + width), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14977
15066
  }
15067
+ getMaxWidth(theme) {
15068
+ var _a, _b;
15069
+ const attribute = this.attribute;
15070
+ return null !== (_b = null !== (_a = attribute.maxLineWidth) && void 0 !== _a ? _a : attribute.maxWidth) && void 0 !== _b ? _b : theme.maxWidth;
15071
+ }
15072
+ getLineHeight(attribute, textTheme) {
15073
+ var _a;
15074
+ return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
15075
+ }
14978
15076
  needUpdateTags(keys) {
14979
15077
  let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
14980
15078
  return super.needUpdateTags(keys, k);
@@ -14989,6 +15087,12 @@
14989
15087
  getNoWorkAnimateAttr() {
14990
15088
  return Text.NOWORK_ANIMATE_ATTR;
14991
15089
  }
15090
+ getBaselineMapAlign() {
15091
+ return Text.baselineMapAlign;
15092
+ }
15093
+ getAlignMapBaseline() {
15094
+ return Text.alignMapBaseline;
15095
+ }
14992
15096
  }
14993
15097
  Text.NOWORK_ANIMATE_ATTR = Object.assign({
14994
15098
  ellipsis: 1,
@@ -15067,7 +15171,10 @@
15067
15171
  const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
15068
15172
  linesLayout.push({
15069
15173
  str: clip.str,
15070
- width: clip.width
15174
+ width: clip.width,
15175
+ ascent: 0,
15176
+ descent: 0,
15177
+ keepCenterInLine: !1
15071
15178
  });
15072
15179
  break;
15073
15180
  }
@@ -15081,7 +15188,10 @@
15081
15188
  }
15082
15189
  if (linesLayout.push({
15083
15190
  str: clip.str,
15084
- width: clip.width
15191
+ width: clip.width,
15192
+ ascent: 0,
15193
+ descent: 0,
15194
+ keepCenterInLine: !1
15085
15195
  }), clip.str.length === str.length) ;else if (needCut) {
15086
15196
  const newStr = str.substring(clip.str.length);
15087
15197
  lines.splice(i + 1, 0, newStr);
@@ -15100,13 +15210,19 @@
15100
15210
  const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
15101
15211
  linesLayout.push({
15102
15212
  str: clip.str,
15103
- width: clip.width
15213
+ width: clip.width,
15214
+ ascent: 0,
15215
+ descent: 0,
15216
+ keepCenterInLine: !1
15104
15217
  }), lineWidth = Math.max(lineWidth, clip.width);
15105
15218
  break;
15106
15219
  }
15107
15220
  text = lines[i], width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, "break-word" === wordBreak), lineWidth = Math.max(lineWidth, width), linesLayout.push({
15108
15221
  str: text,
15109
- width: width
15222
+ width: width,
15223
+ ascent: 0,
15224
+ descent: 0,
15225
+ keepCenterInLine: !1
15110
15226
  });
15111
15227
  }
15112
15228
  bboxWH[0] = lineWidth;
@@ -15150,6 +15266,9 @@
15150
15266
  bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
15151
15267
  } else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
15152
15268
  }
15269
+ parseSize(size) {
15270
+ return isNumber$1(size) ? size : Math.min(size[0], size[1]);
15271
+ }
15153
15272
  }
15154
15273
 
15155
15274
  function circle(ctx, r, x, y, z) {
@@ -15160,13 +15279,13 @@
15160
15279
  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
15280
  }
15162
15281
  draw(ctx, size, x, y, z) {
15163
- return circle(ctx, size / 2, x, y, z);
15282
+ return circle(ctx, this.parseSize(size) / 2, x, y, z);
15164
15283
  }
15165
15284
  drawOffset(ctx, size, x, y, offset, z) {
15166
- return circle(ctx, size / 2 + offset, x, y, z);
15285
+ return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
15167
15286
  }
15168
15287
  drawToSvgPath(size, x, y, z) {
15169
- const r = size / 2;
15288
+ const r = this.parseSize(size) / 2;
15170
15289
  return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
15171
15290
  }
15172
15291
  }
@@ -15183,10 +15302,10 @@
15183
15302
  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
15303
  }
15185
15304
  draw(ctx, size, x, y, z) {
15186
- return cross(ctx, size / 6, x, y, z);
15305
+ return cross(ctx, this.parseSize(size) / 6, x, y, z);
15187
15306
  }
15188
15307
  drawOffset(ctx, size, x, y, offset, z) {
15189
- return crossOffset(ctx, size / 6, x, y, offset, z);
15308
+ return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
15190
15309
  }
15191
15310
  }
15192
15311
  var cross$1 = new CrossSymbol();
@@ -15199,13 +15318,13 @@
15199
15318
  super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
15200
15319
  }
15201
15320
  draw(ctx, size, x, y, z) {
15202
- return diamond(ctx, size / 2, x, y, z);
15321
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
15203
15322
  }
15204
15323
  drawFitDir(ctx, size, x, y, z) {
15205
- return diamond(ctx, size / 2, x, y, z);
15324
+ return diamond(ctx, this.parseSize(size) / 2, x, y, z);
15206
15325
  }
15207
15326
  drawOffset(ctx, size, x, y, offset, z) {
15208
- return diamond(ctx, size / 2 + offset, x, y, z);
15327
+ return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
15209
15328
  }
15210
15329
  }
15211
15330
  var diamond$1 = new DiamondSymbol();
@@ -15219,10 +15338,10 @@
15219
15338
  super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
15220
15339
  }
15221
15340
  draw(ctx, size, x, y) {
15222
- return square(ctx, size / 2, x, y);
15341
+ return square(ctx, this.parseSize(size) / 2, x, y);
15223
15342
  }
15224
15343
  drawOffset(ctx, size, x, y, offset) {
15225
- return square(ctx, size / 2 + offset, x, y);
15344
+ return square(ctx, this.parseSize(size) / 2 + offset, x, y);
15226
15345
  }
15227
15346
  }
15228
15347
  var square$1 = new SquareSymbol();
@@ -15236,10 +15355,10 @@
15236
15355
  super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
15237
15356
  }
15238
15357
  draw(ctx, size, x, y) {
15239
- return trianglUpOffset(ctx, size / 2, x, y);
15358
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
15240
15359
  }
15241
15360
  drawOffset(ctx, size, x, y, offset) {
15242
- return trianglUpOffset(ctx, size / 2, x, y, offset);
15361
+ return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15243
15362
  }
15244
15363
  }
15245
15364
  var triangleUp = new TriangleUpSymbol();
@@ -15271,10 +15390,10 @@
15271
15390
  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
15391
  }
15273
15392
  draw(ctx, size, transX, transY) {
15274
- return star(ctx, size / 2, transX, transY);
15393
+ return star(ctx, this.parseSize(size) / 2, transX, transY);
15275
15394
  }
15276
15395
  drawOffset(ctx, size, transX, transY, offset) {
15277
- return star(ctx, size / 2 + offset, transX, transY);
15396
+ return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15278
15397
  }
15279
15398
  }
15280
15399
  var star$1 = new StarSymbol();
@@ -15292,10 +15411,10 @@
15292
15411
  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
15412
  }
15294
15413
  draw(ctx, size, transX, transY) {
15295
- return arrow(ctx, size / 2, transX, transY);
15414
+ return arrow(ctx, this.parseSize(size) / 2, transX, transY);
15296
15415
  }
15297
15416
  drawOffset(ctx, size, transX, transY, offset) {
15298
- return arrow(ctx, size / 2 + offset, transX, transY);
15417
+ return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15299
15418
  }
15300
15419
  }
15301
15420
  var arrow$1 = new ArrowSymbol();
@@ -15309,10 +15428,10 @@
15309
15428
  super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
15310
15429
  }
15311
15430
  draw(ctx, size, transX, transY) {
15312
- return wedge(ctx, size / 2, transX, transY);
15431
+ return wedge(ctx, this.parseSize(size) / 2, transX, transY);
15313
15432
  }
15314
15433
  drawOffset(ctx, size, transX, transY, offset) {
15315
- return wedge(ctx, size / 2 + offset, transX, transY);
15434
+ return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15316
15435
  }
15317
15436
  }
15318
15437
  var wedge$1 = new WedgeSymbol();
@@ -15325,10 +15444,10 @@
15325
15444
  super(...arguments), this.type = "stroke", this.pathStr = "";
15326
15445
  }
15327
15446
  draw(ctx, size, transX, transY) {
15328
- return stroke(ctx, size / 2, transX, transY);
15447
+ return stroke(ctx, this.parseSize(size) / 2, transX, transY);
15329
15448
  }
15330
15449
  drawOffset(ctx, size, transX, transY, offset) {
15331
- return stroke(ctx, size / 2 + offset, transX, transY);
15450
+ return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15332
15451
  }
15333
15452
  }
15334
15453
  var stroke$1 = new StrokeSymbol();
@@ -15350,10 +15469,10 @@
15350
15469
  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
15470
  }
15352
15471
  draw(ctx, size, transX, transY) {
15353
- return wye(ctx, size / 2, transX, transY);
15472
+ return wye(ctx, this.parseSize(size) / 2, transX, transY);
15354
15473
  }
15355
15474
  drawOffset(ctx, size, transX, transY, offset) {
15356
- return wye(ctx, size / 2 + offset, transX, transY);
15475
+ return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
15357
15476
  }
15358
15477
  }
15359
15478
  var wye$1 = new WyeSymbol();
@@ -15366,10 +15485,10 @@
15366
15485
  super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
15367
15486
  }
15368
15487
  draw(ctx, size, x, y) {
15369
- return trianglLeftOffset(ctx, size / 2, x, y, 0);
15488
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
15370
15489
  }
15371
15490
  drawOffset(ctx, size, x, y, offset) {
15372
- return trianglLeftOffset(ctx, size / 2, x, y, offset);
15491
+ return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15373
15492
  }
15374
15493
  }
15375
15494
  var triangleLeft = new TriangleLeftSymbol();
@@ -15383,10 +15502,10 @@
15383
15502
  super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
15384
15503
  }
15385
15504
  draw(ctx, size, x, y) {
15386
- return trianglRightOffset(ctx, size / 2, x, y);
15505
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
15387
15506
  }
15388
15507
  drawOffset(ctx, size, x, y, offset) {
15389
- return trianglRightOffset(ctx, size / 2, x, y, offset);
15508
+ return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15390
15509
  }
15391
15510
  }
15392
15511
  var triangleRight = new TriangleRightSymbol();
@@ -15400,10 +15519,10 @@
15400
15519
  super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
15401
15520
  }
15402
15521
  draw(ctx, size, x, y) {
15403
- return trianglDownOffset(ctx, size / 2, x, y);
15522
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
15404
15523
  }
15405
15524
  drawOffset(ctx, size, x, y, offset) {
15406
- return trianglDownOffset(ctx, size / 2, x, y, offset);
15525
+ return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
15407
15526
  }
15408
15527
  }
15409
15528
  var triangleDown = new TriangleDownSymbol();
@@ -15418,10 +15537,10 @@
15418
15537
  super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
15419
15538
  }
15420
15539
  draw(ctx, size, x, y) {
15421
- return thinTriangle(ctx, size / 2 / sqrt3, x, y);
15540
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
15422
15541
  }
15423
15542
  drawOffset(ctx, size, x, y, offset) {
15424
- return thinTriangle(ctx, size / 2 / sqrt3 + offset, x, y);
15543
+ return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
15425
15544
  }
15426
15545
  }
15427
15546
  var thinTriangle$1 = new ThinTriangleSymbol();
@@ -15435,10 +15554,10 @@
15435
15554
  super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
15436
15555
  }
15437
15556
  draw(ctx, size, transX, transY) {
15438
- return arrow2Left(ctx, size / 4, transX, transY);
15557
+ return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
15439
15558
  }
15440
15559
  drawOffset(ctx, size, transX, transY, offset) {
15441
- return arrow2Left(ctx, size / 4 + offset, transX, transY);
15560
+ return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15442
15561
  }
15443
15562
  }
15444
15563
  var arrow2Left$1 = new Arrow2LeftSymbol();
@@ -15452,10 +15571,10 @@
15452
15571
  super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
15453
15572
  }
15454
15573
  draw(ctx, size, transX, transY) {
15455
- return arrow2Right(ctx, size / 4, transX, transY);
15574
+ return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
15456
15575
  }
15457
15576
  drawOffset(ctx, size, transX, transY, offset) {
15458
- return arrow2Right(ctx, size / 4 + offset, transX, transY);
15577
+ return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15459
15578
  }
15460
15579
  }
15461
15580
  var arrow2Right$1 = new Arrow2RightSymbol();
@@ -15469,10 +15588,10 @@
15469
15588
  super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
15470
15589
  }
15471
15590
  draw(ctx, size, transX, transY) {
15472
- return arrow2Up(ctx, size / 4, transX, transY);
15591
+ return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
15473
15592
  }
15474
15593
  drawOffset(ctx, size, transX, transY, offset) {
15475
- return arrow2Up(ctx, size / 4 + offset, transX, transY);
15594
+ return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15476
15595
  }
15477
15596
  }
15478
15597
  var arrow2Up$1 = new Arrow2UpSymbol();
@@ -15486,10 +15605,10 @@
15486
15605
  super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
15487
15606
  }
15488
15607
  draw(ctx, size, transX, transY) {
15489
- return arrow2Down(ctx, size / 4, transX, transY);
15608
+ return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
15490
15609
  }
15491
15610
  drawOffset(ctx, size, transX, transY, offset) {
15492
- return arrow2Down(ctx, size / 4 + offset, transX, transY);
15611
+ return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
15493
15612
  }
15494
15613
  }
15495
15614
  var arrow2Down$1 = new Arrow2DownSymbol();
@@ -15502,13 +15621,13 @@
15502
15621
  super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
15503
15622
  }
15504
15623
  draw(ctx, size, x, y, z) {
15505
- return lineV(ctx, size / 2, x, y);
15624
+ return lineV(ctx, this.parseSize(size) / 2, x, y);
15506
15625
  }
15507
15626
  drawOffset(ctx, size, x, y, offset, z) {
15508
- return lineV(ctx, size / 2 + offset, x, y);
15627
+ return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
15509
15628
  }
15510
15629
  drawToSvgPath(size, x, y, z) {
15511
- const r = size / 2;
15630
+ const r = this.parseSize(size) / 2;
15512
15631
  return `M ${x}, ${y - r} L ${x},${y + r}`;
15513
15632
  }
15514
15633
  }
@@ -15522,13 +15641,13 @@
15522
15641
  super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
15523
15642
  }
15524
15643
  draw(ctx, size, x, y, z) {
15525
- return lineH(ctx, size / 2, x, y);
15644
+ return lineH(ctx, this.parseSize(size) / 2, x, y);
15526
15645
  }
15527
15646
  drawOffset(ctx, size, x, y, offset, z) {
15528
- return lineH(ctx, size / 2 + offset, x, y);
15647
+ return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
15529
15648
  }
15530
15649
  drawToSvgPath(size, x, y, z) {
15531
- const r = size / 2;
15650
+ const r = this.parseSize(size) / 2;
15532
15651
  return `M ${x - r}, ${y} L ${x + r},${y}`;
15533
15652
  }
15534
15653
  }
@@ -15542,13 +15661,13 @@
15542
15661
  super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
15543
15662
  }
15544
15663
  draw(ctx, size, x, y, z) {
15545
- return close(ctx, size / 2, x, y);
15664
+ return close(ctx, this.parseSize(size) / 2, x, y);
15546
15665
  }
15547
15666
  drawOffset(ctx, size, x, y, offset, z) {
15548
- return close(ctx, size / 2 + offset, x, y);
15667
+ return close(ctx, this.parseSize(size) / 2 + offset, x, y);
15549
15668
  }
15550
15669
  drawToSvgPath(size, x, y, z) {
15551
- const r = size / 2;
15670
+ const r = this.parseSize(size) / 2;
15552
15671
  return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
15553
15672
  }
15554
15673
  }
@@ -15582,15 +15701,18 @@
15582
15701
  this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
15583
15702
  }
15584
15703
  drawOffset(ctx, size, x, y, offset, z, cb) {
15585
- return this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
15704
+ return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
15586
15705
  ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
15587
15706
  }), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
15588
15707
  }
15589
15708
  draw(ctx, size, x, y, z, cb) {
15590
- return this.drawOffset(ctx, size, x, y, 0, z, cb);
15709
+ return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
15710
+ }
15711
+ parseSize(size) {
15712
+ return isNumber$1(size) ? size : Math.min(size[0], size[1]);
15591
15713
  }
15592
15714
  bounds(size, bounds) {
15593
- if (this.isSvg) {
15715
+ if (size = this.parseSize(size), this.isSvg) {
15594
15716
  if (!this.svgCache) return;
15595
15717
  return bounds.clear(), void this.svgCache.forEach(_ref => {
15596
15718
  let {
@@ -16273,7 +16395,11 @@
16273
16395
  case "sub":
16274
16396
  baseline += this.descent / 2;
16275
16397
  }
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();
16398
+ "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);
16399
+ const {
16400
+ lineWidth = 1
16401
+ } = this.character;
16402
+ 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
16403
  }
16278
16404
  getWidthWithEllips(direction) {
16279
16405
  let text = this.text;
@@ -18278,6 +18404,42 @@
18278
18404
  }
18279
18405
  }
18280
18406
 
18407
+ class AutoRefreshPlugin {
18408
+ constructor() {
18409
+ this.name = "AutoRefreshPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.handleChange = graphic => {
18410
+ graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage === this.pluginService.stage && null != graphic.stage && graphic.stage.renderNextFrame();
18411
+ };
18412
+ }
18413
+ activate(context) {
18414
+ this.pluginService = context, this.dpr = application.global.devicePixelRatio, this.refresh();
18415
+ }
18416
+ refresh() {
18417
+ this._refreshByMediaQuery() || this._refreshByRaf();
18418
+ }
18419
+ _refreshByRaf() {
18420
+ const raf = application.global.getRequestAnimationFrame();
18421
+ this.rafId = raf(() => {
18422
+ application.global.devicePixelRatio !== this.dpr && (this.dpr = application.global.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0)), this.refresh();
18423
+ });
18424
+ }
18425
+ _refreshByMediaQuery() {
18426
+ try {
18427
+ const mqString = `(resolution: ${window.devicePixelRatio}dppx)`,
18428
+ updatePixelRatio = () => {
18429
+ window.devicePixelRatio !== this.dpr && (this.dpr = window.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0));
18430
+ };
18431
+ matchMedia(mqString).addEventListener("change", updatePixelRatio);
18432
+ } catch (err) {
18433
+ return !1;
18434
+ }
18435
+ return !0;
18436
+ }
18437
+ deactivate(context) {
18438
+ const craf = application.global.getCancelAnimationFrame();
18439
+ craf && this.rafId && craf(this.rafId);
18440
+ }
18441
+ }
18442
+
18281
18443
  class IncrementalAutoRenderPlugin {
18282
18444
  constructor() {
18283
18445
  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 +18616,7 @@
18454
18616
  constructor() {
18455
18617
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18456
18618
  var _a;
18457
- super({}), this._onVisibleChange = visible => {
18619
+ super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
18458
18620
  if (!(this._skipRender < 0)) if (visible) {
18459
18621
  if (this.dirtyBounds) {
18460
18622
  const b = this.window.getViewBox();
@@ -18465,7 +18627,10 @@
18465
18627
  }, this.beforeRender = stage => {
18466
18628
  this._beforeRender && this._beforeRender(stage);
18467
18629
  }, this.afterRender = stage => {
18468
- this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null;
18630
+ this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
18631
+ }, this.afterTickCb = () => {
18632
+ var _a;
18633
+ this.tickedBeforeRender = !0, "performance" === (null === (_a = this.params.optimize) || void 0 === _a ? void 0 : _a.tickRenderMode) || "rendering" !== this.state && this.render();
18469
18634
  }, this.params = params, this.theme = new Theme(), this.hooks = {
18470
18635
  beforeRender: new SyncHook(["stage"]),
18471
18636
  afterRender: new SyncHook(["stage"])
@@ -18480,9 +18645,9 @@
18480
18645
  canvas: params.canvas
18481
18646
  }), 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
18647
  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({
18648
+ })), 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
18649
  background: this._background
18485
- });
18650
+ }), this.ticker.on("afterTick", this.afterTickCb);
18486
18651
  }
18487
18652
  pauseRender() {
18488
18653
  let sr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
@@ -18615,6 +18780,14 @@
18615
18780
  this.pluginService.unRegister(plugin);
18616
18781
  }));
18617
18782
  }
18783
+ enableAutoRefresh() {
18784
+ this.autoRefresh || (this.autoRefresh = !0, this.pluginService.register(new AutoRefreshPlugin()));
18785
+ }
18786
+ disableAutoRefresh() {
18787
+ this.autoRefresh && (this.autoRefresh = !1, this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach(plugin => {
18788
+ this.pluginService.unRegister(plugin);
18789
+ }));
18790
+ }
18618
18791
  enableIncrementalAutoRender() {
18619
18792
  this.increaseAutoRender || (this.increaseAutoRender = !0, this.pluginService.register(new IncrementalAutoRenderPlugin()));
18620
18793
  }
@@ -18703,7 +18876,7 @@
18703
18876
  if ("released" === this.releaseStatus) return;
18704
18877
  this.ticker.start(), this.timeline.resume();
18705
18878
  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++;
18879
+ 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
18880
  }
18708
18881
  combineLayersToWindow() {
18709
18882
  if ("harmony" === this.global.env) {
@@ -18809,7 +18982,7 @@
18809
18982
  layer.release();
18810
18983
  }), this.interactiveLayer && (this.interactiveLayer.forEachChildren(item => {
18811
18984
  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 = [];
18985
+ }), this.interactiveLayer.release()), this.window.release(), this.ticker.remTimeline(this.timeline), this.ticker.removeListener("afterTick", this.afterTickCb), this.renderService.renderTreeRoots = [];
18813
18986
  }
18814
18987
  setStage(stage) {}
18815
18988
  dirty(b, matrix) {
@@ -18887,8 +19060,6 @@
18887
19060
  return new Stage(params);
18888
19061
  }
18889
19062
 
18890
- const strCommandMap = ["arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect"];
18891
-
18892
19063
  var __decorate$1d = undefined && undefined.__decorate || function (decorators, target, key, desc) {
18893
19064
  var d,
18894
19065
  c = arguments.length,
@@ -19621,27 +19792,9 @@
19621
19792
  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
19793
  return points[points.length - 1].x === lastX && points[points.length - 1].y === lastY || newPoints.push(points[points.length - 1]), newPoints;
19623
19794
  }
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
19795
  function flatten_simplify(points, tolerance, highestQuality) {
19642
19796
  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);
19797
+ return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
19645
19798
  }
19646
19799
 
19647
19800
  function findCursorIndexIgnoreLinebreak(textConfig, cursorIndex) {
@@ -23678,7 +23831,7 @@
23678
23831
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23679
23832
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
23680
23833
  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();
23834
+ this.cachedEvents = [], this.startPoints = [], this.reset(), this.startTime = clock.now();
23682
23835
  const {
23683
23836
  cachedEvents: cachedEvents,
23684
23837
  startPoints: startPoints
@@ -23698,7 +23851,7 @@
23698
23851
  if (1 !== startPoints.length) this.startDistance = calcDistance(startPoints[0], startPoints[1]), this.center = getCenter([startPoints[0], startPoints[1]]);else {
23699
23852
  const event = cachedEvents[0];
23700
23853
  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";
23854
+ 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
23855
  }, this.config.press.time);
23703
23856
  }
23704
23857
  }, this.onMove = ev => {
@@ -23761,10 +23914,10 @@
23761
23914
  lastMovePoint = this.lastMovePoint || startPoints[0],
23762
23915
  distance = calcDistance(prevMovePoint, lastMovePoint),
23763
23916
  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));
23917
+ 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
23918
  }
23766
23919
  }
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);
23920
+ 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
23921
  }
23769
23922
  for (let i = 0, len = cachedEvents.length; i < len; i++) if (cachedEvents[i].pointerId === endEvent.pointerId) {
23770
23923
  cachedEvents.splice(i, 1), startPoints.splice(i, 1);
@@ -23806,7 +23959,7 @@
23806
23959
  startTime: startTime,
23807
23960
  startPoints: startPoints
23808
23961
  } = this;
23809
- if (eventType) return eventType;
23962
+ if ("press" === eventType) return eventType;
23810
23963
  let type;
23811
23964
  return type = clock.now() - startTime > this.config.press.time && calcDistance(startPoints[0], point) < this.config.press.threshold ? "press" : "pan", this.eventType = type, type;
23812
23965
  }
@@ -23840,6 +23993,7 @@
23840
23993
  emitThrottles: emitThrottles
23841
23994
  } = this;
23842
23995
  throttleTimer || (this.throttleTimer = application.global.getRequestAnimationFrame()(() => {
23996
+ application.global.getCancelAnimationFrame()(this.throttleTimer), this.throttleTimer = null;
23843
23997
  for (let i = 0, len = emitThrottles.length; i < len; i++) {
23844
23998
  const {
23845
23999
  type: type,
@@ -23847,7 +24001,7 @@
23847
24001
  } = emitThrottles[i];
23848
24002
  this.emitEvent(type, ev);
23849
24003
  }
23850
- this.throttleTimer = 0, this.emitThrottles.length = 0;
24004
+ this.emitThrottles.length = 0;
23851
24005
  }));
23852
24006
  }
23853
24007
  triggerStartEvent(type, ev) {
@@ -24337,9 +24491,10 @@
24337
24491
  lineJoin = defaultParams.lineJoin,
24338
24492
  lineDash = defaultParams.lineDash,
24339
24493
  lineCap = defaultParams.lineCap,
24340
- miterLimit = defaultParams.miterLimit
24494
+ miterLimit = defaultParams.miterLimit,
24495
+ keepStrokeScale = defaultParams.keepStrokeScale
24341
24496
  } = 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;
24497
+ _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
24498
  }
24344
24499
  }
24345
24500
  setTextStyleWithoutAlignBaseline(params, defaultParams, z) {
@@ -25239,8 +25394,9 @@
25239
25394
  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
25395
  if (picked) return !0;
25241
25396
  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;
25397
+ pickStrokeBuffer = arcAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
25398
+ keepStrokeScale = arcAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
25399
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25244
25400
  }), pickContext.highPerformanceRestore(), picked;
25245
25401
  }
25246
25402
  }
@@ -25513,8 +25669,9 @@
25513
25669
  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
25670
  if (picked) return !0;
25515
25671
  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;
25672
+ pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
25673
+ keepStrokeScale = rectAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
25674
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(point.x, point.y), picked;
25518
25675
  });else {
25519
25676
  const {
25520
25677
  fill = rectAttribute.fill,
@@ -25828,9 +25985,10 @@
25828
25985
  lineJoin = defaultParams.lineJoin,
25829
25986
  lineDash = defaultParams.lineDash,
25830
25987
  lineCap = defaultParams.lineCap,
25831
- miterLimit = defaultParams.miterLimit
25988
+ miterLimit = defaultParams.miterLimit,
25989
+ keepStrokeScale = defaultParams.keepStrokeScale
25832
25990
  } = 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;
25991
+ _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
25992
  }
25835
25993
  }
25836
25994
  measureText(text) {
@@ -26458,9 +26616,10 @@
26458
26616
  lineJoin = defaultParams.lineJoin,
26459
26617
  lineDash = defaultParams.lineDash,
26460
26618
  lineCap = defaultParams.lineCap,
26461
- miterLimit = defaultParams.miterLimit
26619
+ miterLimit = defaultParams.miterLimit,
26620
+ keepStrokeScale = defaultParams.keepStrokeScale
26462
26621
  } = 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);
26622
+ _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
26623
  }
26465
26624
  }
26466
26625
  setTextStyleWithoutAlignBaseline(params, defaultParams) {
@@ -27500,9 +27659,10 @@
27500
27659
  lineJoin = defaultParams.lineJoin,
27501
27660
  lineDash = defaultParams.lineDash,
27502
27661
  lineCap = defaultParams.lineCap,
27503
- miterLimit = defaultParams.miterLimit
27662
+ miterLimit = defaultParams.miterLimit,
27663
+ keepStrokeScale = defaultParams.keepStrokeScale
27504
27664
  } = 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;
27665
+ _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
27666
  }
27507
27667
  }
27508
27668
  measureText(text) {
@@ -27909,8 +28069,9 @@
27909
28069
  return this.canvasRenderer.drawShape(graphic, pickContext, x, y, {}, null, context => !!picked || (picked = context.isPointInPath(pickPoint.x, pickPoint.y), picked), (context, lineAttribute, themeAttribute) => {
27910
28070
  if (picked) return !0;
27911
28071
  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;
28072
+ pickStrokeBuffer = lineAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
28073
+ keepStrokeScale = lineAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
28074
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
27914
28075
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
27915
28076
  }
27916
28077
  }
@@ -28045,8 +28206,9 @@
28045
28206
  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
28207
  if (picked) return !0;
28047
28208
  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;
28209
+ pickStrokeBuffer = symbolAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
28210
+ keepStrokeScale = symbolAttribute.keepStrokeScale || themeAttribute.keepStrokeScale;
28211
+ return pickContext.lineWidth = keepStrokeScale ? lineWidth + pickStrokeBuffer : getScaledStroke(pickContext, lineWidth + pickStrokeBuffer, pickContext.dpr), picked = context.isPointInStroke(pickPoint.x, pickPoint.y), picked;
28050
28212
  }), this.canvasRenderer.z = 0, pickContext.modelMatrix !== lastModelMatrix && mat4Allocate.free(pickContext.modelMatrix), pickContext.modelMatrix = lastModelMatrix, pickContext.highPerformanceRestore(), picked;
28051
28213
  }
28052
28214
  };
@@ -28483,7 +28645,7 @@
28483
28645
 
28484
28646
  const roughModule = _roughModule;
28485
28647
 
28486
- const version = "0.21.0-alpha.1";
28648
+ const version = "0.21.0-alpha.11";
28487
28649
  preLoadAllModule();
28488
28650
  if (isBrowserEnv()) {
28489
28651
  loadBrowserEnv(container);