@visactor/vrender-core 0.16.18-alpha.0 → 0.16.19-alpha.1

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.
Files changed (83) hide show
  1. package/cjs/animate/Ticker/default-ticker.js +2 -2
  2. package/cjs/animate/Ticker/default-ticker.js.map +1 -1
  3. package/cjs/animate/animate.js +1 -1
  4. package/cjs/animate/animate.js.map +1 -1
  5. package/cjs/animate/custom-animate.d.ts +12 -3
  6. package/cjs/animate/custom-animate.js +90 -1
  7. package/cjs/animate/custom-animate.js.map +1 -1
  8. package/cjs/core/contributions/textMeasure/AtextMeasure.d.ts +14 -2
  9. package/cjs/core/contributions/textMeasure/AtextMeasure.js +99 -13
  10. package/cjs/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
  11. package/cjs/core/contributions/textMeasure/layout.d.ts +2 -2
  12. package/cjs/core/contributions/textMeasure/layout.js +4 -4
  13. package/cjs/core/contributions/textMeasure/layout.js.map +1 -1
  14. package/cjs/event/event-manager.js +8 -8
  15. package/cjs/event/event-manager.js.map +1 -1
  16. package/cjs/graphic/area.js +1 -0
  17. package/cjs/graphic/area.js.map +1 -1
  18. package/cjs/graphic/config.d.ts +2 -1
  19. package/cjs/graphic/config.js +8 -5
  20. package/cjs/graphic/config.js.map +1 -1
  21. package/cjs/graphic/graphic-service/graphic-service.js +4 -4
  22. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  23. package/cjs/graphic/graphic.js +1 -0
  24. package/cjs/graphic/graphic.js.map +1 -1
  25. package/cjs/graphic/line.js +1 -0
  26. package/cjs/graphic/line.js.map +1 -1
  27. package/cjs/graphic/node-tree.js +1 -1
  28. package/cjs/graphic/node-tree.js.map +1 -1
  29. package/cjs/graphic/text.js +8 -8
  30. package/cjs/graphic/text.js.map +1 -1
  31. package/cjs/graphic/theme.js +1 -1
  32. package/cjs/graphic/theme.js.map +1 -1
  33. package/cjs/interface/graphic/text.d.ts +1 -0
  34. package/cjs/interface/graphic/text.js.map +1 -1
  35. package/cjs/interface/graphic.d.ts +4 -1
  36. package/cjs/interface/graphic.js.map +1 -1
  37. package/cjs/interface/text.d.ts +2 -2
  38. package/cjs/interface/text.js.map +1 -1
  39. package/cjs/render/contributions/render/draw-contribution.js +1 -1
  40. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  41. package/dist/index.js +310 -47
  42. package/dist/index.min.js +1 -1
  43. package/es/animate/Ticker/default-ticker.js +3 -1
  44. package/es/animate/Ticker/default-ticker.js.map +1 -1
  45. package/es/animate/animate.js +2 -2
  46. package/es/animate/animate.js.map +1 -1
  47. package/es/animate/custom-animate.d.ts +12 -3
  48. package/es/animate/custom-animate.js +94 -1
  49. package/es/animate/custom-animate.js.map +1 -1
  50. package/es/core/contributions/textMeasure/AtextMeasure.d.ts +14 -2
  51. package/es/core/contributions/textMeasure/AtextMeasure.js +99 -13
  52. package/es/core/contributions/textMeasure/AtextMeasure.js.map +1 -1
  53. package/es/core/contributions/textMeasure/layout.d.ts +2 -2
  54. package/es/core/contributions/textMeasure/layout.js +4 -4
  55. package/es/core/contributions/textMeasure/layout.js.map +1 -1
  56. package/es/event/event-manager.js +9 -9
  57. package/es/event/event-manager.js.map +1 -1
  58. package/es/graphic/area.js +1 -0
  59. package/es/graphic/area.js.map +1 -1
  60. package/es/graphic/config.d.ts +2 -1
  61. package/es/graphic/config.js +10 -5
  62. package/es/graphic/config.js.map +1 -1
  63. package/es/graphic/graphic-service/graphic-service.js +4 -4
  64. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  65. package/es/graphic/graphic.js +1 -0
  66. package/es/graphic/graphic.js.map +1 -1
  67. package/es/graphic/line.js +1 -0
  68. package/es/graphic/line.js.map +1 -1
  69. package/es/graphic/node-tree.js +2 -2
  70. package/es/graphic/node-tree.js.map +1 -1
  71. package/es/graphic/text.js +8 -8
  72. package/es/graphic/text.js.map +1 -1
  73. package/es/graphic/theme.js +2 -2
  74. package/es/graphic/theme.js.map +1 -1
  75. package/es/interface/graphic/text.d.ts +1 -0
  76. package/es/interface/graphic/text.js.map +1 -1
  77. package/es/interface/graphic.d.ts +4 -1
  78. package/es/interface/graphic.js.map +1 -1
  79. package/es/interface/text.d.ts +2 -2
  80. package/es/interface/text.js.map +1 -1
  81. package/es/render/contributions/render/draw-contribution.js +2 -2
  82. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  83. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -4297,9 +4297,13 @@
4297
4297
  verticalMode: 0,
4298
4298
  whiteSpace: 'no-wrap',
4299
4299
  heightLimit: Infinity,
4300
- lineClamp: Infinity
4300
+ lineClamp: Infinity,
4301
+ suffixPosition: 'end'
4301
4302
  };
4302
- const DefaultStyle = Object.assign(Object.assign(Object.assign({ opacity: 1, background: null, texture: null, textureColor: 'black', textureSize: 10, texturePadding: 2, backgroundMode: 'no-repeat', blur: 0, cursor: null, html: null }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout);
4303
+ const DefaultPickStyle = {
4304
+ pickStrokeBuffer: 0
4305
+ };
4306
+ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({ opacity: 1, background: null, texture: null, textureColor: 'black', textureSize: 10, texturePadding: 2, backgroundMode: 'no-repeat', blur: 0, cursor: null, html: null }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle);
4303
4307
  const DefaultConnectAttribute = {
4304
4308
  connectedType: 'none',
4305
4309
  connectedStyle: {},
@@ -4325,7 +4329,7 @@
4325
4329
  const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: '', width: 0, height: 0, cornerRadius: 0, clip: false });
4326
4330
  const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, clipRangeByDimension: 'default', closePath: false });
4327
4331
  const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: new CustomPath2D(), customPath: () => {
4328
- console.warn('空函数');
4332
+ vutils.Logger.getInstance().warn('空函数');
4329
4333
  } });
4330
4334
  const DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute), { points: [], cornerRadius: 0, closePath: true });
4331
4335
  const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, strokeBoundsBuffer: 0, cornerRadius: 0 });
@@ -4566,7 +4570,7 @@
4566
4570
  }
4567
4571
  }
4568
4572
  if (verticalList[i] && verticalList[i].text.length > 1) {
4569
- const clipedData = this._clipText(verticalList[i].text, options, width - length, 0, verticalList[i].text.length - 1);
4573
+ const clipedData = this._clipText(verticalList[i].text, options, width - length, 0, verticalList[i].text.length - 1, 'end', false);
4570
4574
  if (wordBreak && clipedData.str !== verticalList[i].text) {
4571
4575
  let text = '';
4572
4576
  let length = 0;
@@ -4604,7 +4608,7 @@
4604
4608
  if (length > width) {
4605
4609
  return { str: '', width: 0 };
4606
4610
  }
4607
- const data = this._clipText(text, options, width, 0, text.length - 1);
4611
+ const data = this._clipText(text, options, width, 0, text.length - 1, 'end', false);
4608
4612
  if (wordBreak && data.str !== text) {
4609
4613
  const index = testLetter(text, data.str.length);
4610
4614
  if (index !== data.str.length) {
@@ -4614,7 +4618,23 @@
4614
4618
  }
4615
4619
  return data;
4616
4620
  }
4617
- _clipText(text, options, width, leftIdx, rightIdx) {
4621
+ _clipText(text, options, width, leftIdx, rightIdx, position, suffix) {
4622
+ let data;
4623
+ if (position === 'end') {
4624
+ data = this._clipTextEnd(text, options, width, leftIdx, rightIdx);
4625
+ suffix && (data.result = data.str + suffix);
4626
+ }
4627
+ else if (position === 'start') {
4628
+ data = this._clipTextStart(text, options, width, leftIdx, rightIdx);
4629
+ suffix && (data.result = suffix + data.str);
4630
+ }
4631
+ else if (position === 'middle') {
4632
+ const d = this._clipTextMiddle(text, options, width, '', '', 0, 0, 1);
4633
+ data = { str: 'none', width: d.width, result: d.left + suffix + d.right };
4634
+ }
4635
+ return data;
4636
+ }
4637
+ _clipTextEnd(text, options, width, leftIdx, rightIdx) {
4618
4638
  const middleIdx = Math.floor((leftIdx + rightIdx) / 2);
4619
4639
  const subText = text.substring(0, middleIdx + 1);
4620
4640
  const strWidth = this.measureTextWidth(subText, options);
@@ -4628,7 +4648,7 @@
4628
4648
  if (length <= width) {
4629
4649
  return { str, width: length };
4630
4650
  }
4631
- return this._clipText(text, options, width, leftIdx, middleIdx);
4651
+ return this._clipTextEnd(text, options, width, leftIdx, middleIdx);
4632
4652
  }
4633
4653
  else if (strWidth < width) {
4634
4654
  if (middleIdx >= text.length - 1) {
@@ -4639,11 +4659,53 @@
4639
4659
  if (length >= width) {
4640
4660
  return { str: subText, width: strWidth };
4641
4661
  }
4642
- return this._clipText(text, options, width, middleIdx, rightIdx);
4662
+ return this._clipTextEnd(text, options, width, middleIdx, rightIdx);
4663
+ }
4664
+ return { str: subText, width: strWidth };
4665
+ }
4666
+ _clipTextStart(text, options, width, leftIdx, rightIdx) {
4667
+ const middleIdx = Math.ceil((leftIdx + rightIdx) / 2);
4668
+ const subText = text.substring(middleIdx - 1, text.length - 1);
4669
+ const strWidth = this.measureTextWidth(subText, options);
4670
+ let length;
4671
+ if (strWidth > width) {
4672
+ if (subText.length <= 1) {
4673
+ return { str: '', width: 0 };
4674
+ }
4675
+ const str = text.substring(middleIdx, text.length - 1);
4676
+ length = this.measureTextWidth(str, options);
4677
+ if (length <= width) {
4678
+ return { str, width: length };
4679
+ }
4680
+ return this._clipTextStart(text, options, width, middleIdx, text.length - 1);
4681
+ }
4682
+ else if (strWidth < width) {
4683
+ if (middleIdx <= 0) {
4684
+ return { str: text, width: this.measureTextWidth(text, options) };
4685
+ }
4686
+ const str = text.substring(middleIdx - 2, text.length - 1);
4687
+ length = this.measureTextWidth(str, options);
4688
+ if (length >= width) {
4689
+ return { str: subText, width: strWidth };
4690
+ }
4691
+ return this._clipTextStart(text, options, width, leftIdx, middleIdx);
4643
4692
  }
4644
4693
  return { str: subText, width: strWidth };
4645
4694
  }
4646
- clipTextWithSuffixVertical(verticalList, options, width, suffix, wordBreak) {
4695
+ _clipTextMiddle(text, options, width, left, right, leftW, rightW, buffer) {
4696
+ const subLeftText = text.substring(0, buffer);
4697
+ const strLeftWidth = this.measureTextWidth(subLeftText, options);
4698
+ if (strLeftWidth + rightW > width) {
4699
+ return { left, right, width: leftW + rightW };
4700
+ }
4701
+ const subRightText = text.substring(text.length - buffer, text.length);
4702
+ const strRightWidth = this.measureTextWidth(subRightText, options);
4703
+ if (strLeftWidth + strRightWidth > width) {
4704
+ return { left: subLeftText, right, width: strLeftWidth + rightW };
4705
+ }
4706
+ return this._clipTextMiddle(text, options, width, subLeftText, subRightText, strLeftWidth, strRightWidth, buffer + 1);
4707
+ }
4708
+ clipTextWithSuffixVertical(verticalList, options, width, suffix, wordBreak, suffixPosition) {
4647
4709
  if (suffix === '') {
4648
4710
  return this.clipTextVertical(verticalList, options, width, wordBreak);
4649
4711
  }
@@ -4660,16 +4722,51 @@
4660
4722
  return output;
4661
4723
  }
4662
4724
  width -= suffixWidth;
4663
- const out = this.clipTextVertical(verticalList, options, width, wordBreak);
4725
+ let out;
4726
+ if (suffixPosition === 'start') {
4727
+ const nextVerticalList = this.revertVerticalList(verticalList);
4728
+ out = this.clipTextVertical(nextVerticalList, options, width, wordBreak);
4729
+ const v = this.revertVerticalList(out.verticalList);
4730
+ v.unshift({
4731
+ text: suffix,
4732
+ direction: 1,
4733
+ width: suffixWidth
4734
+ });
4735
+ out.verticalList = v;
4736
+ }
4737
+ else if (suffixPosition === 'middle') {
4738
+ const leftOut = this.clipTextVertical(verticalList, options, width / 2, wordBreak);
4739
+ const nextVerticalList = this.revertVerticalList(verticalList);
4740
+ const rightOut = this.clipTextVertical(nextVerticalList, options, width / 2, wordBreak);
4741
+ leftOut.verticalList.push({
4742
+ text: suffix,
4743
+ direction: 1,
4744
+ width: suffixWidth
4745
+ });
4746
+ this.revertVerticalList(rightOut.verticalList).forEach(v => leftOut.verticalList.push(v));
4747
+ out = {
4748
+ verticalList: leftOut.verticalList,
4749
+ width: leftOut.width + rightOut.width
4750
+ };
4751
+ }
4752
+ else {
4753
+ out = this.clipTextVertical(verticalList, options, width, wordBreak);
4754
+ out.verticalList.push({
4755
+ text: suffix,
4756
+ direction: 1,
4757
+ width: suffixWidth
4758
+ });
4759
+ }
4664
4760
  out.width += suffixWidth;
4665
- out.verticalList.push({
4666
- text: suffix,
4667
- direction: 1,
4668
- width: suffixWidth
4669
- });
4670
4761
  return out;
4671
4762
  }
4672
- clipTextWithSuffix(text, options, width, suffix, wordBreak) {
4763
+ revertVerticalList(verticalList) {
4764
+ return verticalList.reverse().map(l => {
4765
+ const t = l.text.split('').reverse().join('');
4766
+ return Object.assign(Object.assign({}, l), { text: t });
4767
+ });
4768
+ }
4769
+ clipTextWithSuffix(text, options, width, suffix, wordBreak, position) {
4673
4770
  if (suffix === '') {
4674
4771
  return this.clipText(text, options, width, wordBreak);
4675
4772
  }
@@ -4685,7 +4782,7 @@
4685
4782
  return { str: '', width: 0 };
4686
4783
  }
4687
4784
  width -= suffixWidth;
4688
- const data = this._clipText(text, options, width, 0, text.length - 1);
4785
+ const data = this._clipText(text, options, width, 0, text.length - 1, position, suffix);
4689
4786
  if (wordBreak && data.str !== text) {
4690
4787
  const index = testLetter(text, data.str.length);
4691
4788
  if (index !== data.str.length) {
@@ -4693,7 +4790,7 @@
4693
4790
  data.width = this.measureTextWidth(data.str, options);
4694
4791
  }
4695
4792
  }
4696
- data.str += suffix;
4793
+ data.str = data.result;
4697
4794
  data.width += suffixWidth;
4698
4795
  return data;
4699
4796
  }
@@ -5701,7 +5798,7 @@
5701
5798
  }
5702
5799
  else {
5703
5800
  this.combinedTheme = this._defaultTheme;
5704
- console.warn('未知错误,走到不应该走的区域里');
5801
+ vutils.Logger.getInstance().warn('未知错误,走到不应该走的区域里');
5705
5802
  }
5706
5803
  this.dirty = false;
5707
5804
  }
@@ -6005,7 +6102,7 @@
6005
6102
  }
6006
6103
  insertInto(newNode, idx) {
6007
6104
  if (!this._ignoreWarn && this._nodeList) {
6008
- console.warn('insertIntoKeepIdx和insertInto混用可能会存在错误');
6105
+ vutils.Logger.getInstance().warn('insertIntoKeepIdx和insertInto混用可能会存在错误');
6009
6106
  }
6010
6107
  if (idx >= this.childrenCount) {
6011
6108
  return this.appendChild(newNode);
@@ -6618,7 +6715,7 @@
6618
6715
  this.eventPool = new Map();
6619
6716
  this.onPointerDown = (from, target) => {
6620
6717
  if (!(from instanceof FederatedPointerEvent)) {
6621
- console.warn('EventManager cannot map a non-pointer event as a pointer event');
6718
+ vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
6622
6719
  return;
6623
6720
  }
6624
6721
  const e = this.createPointerEvent(from, from.type, target);
@@ -6637,7 +6734,7 @@
6637
6734
  this.onPointerMove = (from, target) => {
6638
6735
  var _a, _b;
6639
6736
  if (!(from instanceof FederatedPointerEvent)) {
6640
- console.warn('EventManager cannot map a non-pointer event as a pointer event');
6737
+ vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
6641
6738
  return;
6642
6739
  }
6643
6740
  const e = this.createPointerEvent(from, from.type, target);
@@ -6711,7 +6808,7 @@
6711
6808
  this.onPointerOver = (from, target) => {
6712
6809
  var _a, _b;
6713
6810
  if (!(from instanceof FederatedPointerEvent)) {
6714
- console.warn('EventManager cannot map a non-pointer event as a pointer event');
6811
+ vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
6715
6812
  return;
6716
6813
  }
6717
6814
  const trackingData = this.trackingData(from.pointerId);
@@ -6740,7 +6837,7 @@
6740
6837
  };
6741
6838
  this.onPointerOut = (from, target) => {
6742
6839
  if (!(from instanceof FederatedPointerEvent)) {
6743
- console.warn('EventManager cannot map a non-pointer event as a pointer event');
6840
+ vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
6744
6841
  return;
6745
6842
  }
6746
6843
  const trackingData = this.trackingData(from.pointerId);
@@ -6771,7 +6868,7 @@
6771
6868
  this.onPointerUp = (from, target) => {
6772
6869
  var _a;
6773
6870
  if (!(from instanceof FederatedPointerEvent)) {
6774
- console.warn('EventManager cannot map a non-pointer event as a pointer event');
6871
+ vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
6775
6872
  return;
6776
6873
  }
6777
6874
  const now = clock.now();
@@ -6842,7 +6939,7 @@
6842
6939
  };
6843
6940
  this.onPointerUpOutside = (from, target) => {
6844
6941
  if (!(from instanceof FederatedPointerEvent)) {
6845
- console.warn('EventManager cannot map a non-pointer event as a pointer event');
6942
+ vutils.Logger.getInstance().warn('EventManager cannot map a non-pointer event as a pointer event');
6846
6943
  return;
6847
6944
  }
6848
6945
  const trackingData = this.trackingData(from.pointerId);
@@ -6867,7 +6964,7 @@
6867
6964
  };
6868
6965
  this.onWheel = (from, target) => {
6869
6966
  if (!(from instanceof FederatedWheelEvent)) {
6870
- console.warn('EventManager cannot map a non-wheel event as a wheel event');
6967
+ vutils.Logger.getInstance().warn('EventManager cannot map a non-wheel event as a wheel event');
6871
6968
  return;
6872
6969
  }
6873
6970
  const wheelEvent = this.createWheelEvent(from, target);
@@ -6931,7 +7028,7 @@
6931
7028
  }
6932
7029
  }
6933
7030
  else {
6934
- console.warn(`[EventManager]: Event mapping not defined for ${e.type}`);
7031
+ vutils.Logger.getInstance().warn(`[EventManager]: Event mapping not defined for ${e.type}`);
6935
7032
  }
6936
7033
  }
6937
7034
  propagate(e, type) {
@@ -7772,7 +7869,7 @@
7772
7869
  handler = new ManualTickHandler();
7773
7870
  break;
7774
7871
  default:
7775
- console.warn('非法的计时器模式');
7872
+ vutils.Logger.getInstance().warn('非法的计时器模式');
7776
7873
  handler = new RAFTickHandler();
7777
7874
  break;
7778
7875
  }
@@ -8773,7 +8870,7 @@
8773
8870
  }
8774
8871
  lastStep = lastStep.prev;
8775
8872
  }
8776
- console.warn('未知错误,step中找不到属性');
8873
+ vutils.Logger.getInstance().warn('未知错误,step中找不到属性');
8777
8874
  return step.props[name];
8778
8875
  }
8779
8876
  updateTarget(step, ratio, end) {
@@ -9287,6 +9384,28 @@
9287
9384
  return {};
9288
9385
  }
9289
9386
  onStart() {
9387
+ if (!this.target) {
9388
+ return;
9389
+ }
9390
+ if (this.target.type === 'rect') {
9391
+ this.onStartRect();
9392
+ }
9393
+ else if (this.target.type === 'line') {
9394
+ this.onStartLineOrArea('line');
9395
+ }
9396
+ else if (this.target.type === 'area') {
9397
+ this.onStartLineOrArea('area');
9398
+ }
9399
+ }
9400
+ onStartLineOrArea(type) {
9401
+ var _a;
9402
+ const root = this.target.attachShadow();
9403
+ const line = application.graphicService.creator[type](Object.assign({}, (_a = this.params) === null || _a === void 0 ? void 0 : _a.attribute));
9404
+ this[type] = line;
9405
+ line.pathProxy = new CustomPath2D();
9406
+ root.add(line);
9407
+ }
9408
+ onStartRect() {
9290
9409
  var _a;
9291
9410
  const root = this.target.attachShadow();
9292
9411
  const height = this.target.AABBBounds.height();
@@ -9301,6 +9420,14 @@
9301
9420
  this.target.detachShadow();
9302
9421
  }
9303
9422
  onUpdate(end, ratio, out) {
9423
+ if (this.rect) {
9424
+ return this.onUpdateRect(end, ratio, out);
9425
+ }
9426
+ else if (this.line || this.area) {
9427
+ return this.onUpdateLineOrArea(end, ratio, out);
9428
+ }
9429
+ }
9430
+ onUpdateRect(end, ratio, out) {
9304
9431
  var _a, _b, _c, _d, _e, _f;
9305
9432
  const parentWidth = (_a = this.target.attribute.width) !== null && _a !== void 0 ? _a : 250;
9306
9433
  const streamLength = (_c = (_b = this.params) === null || _b === void 0 ? void 0 : _b.streamLength) !== null && _c !== void 0 ? _c : parentWidth;
@@ -9321,6 +9448,130 @@
9321
9448
  }
9322
9449
  });
9323
9450
  }
9451
+ onUpdateLineOrArea(end, ratio, out) {
9452
+ const target = this.line || this.area;
9453
+ if (!target) {
9454
+ return;
9455
+ }
9456
+ const customPath = target.pathProxy;
9457
+ const targetLine = this.target;
9458
+ if (targetLine.cache || targetLine.cacheArea) {
9459
+ this._onUpdateLineOrAreaWithCache(customPath, targetLine, end, ratio, out);
9460
+ }
9461
+ else {
9462
+ this._onUpdateLineWithoutCache(customPath, targetLine, end, ratio, out);
9463
+ }
9464
+ const targetAttrs = targetLine.attribute;
9465
+ target.setAttributes(Object.assign({ stroke: targetAttrs.stroke }, target.attribute));
9466
+ target.addUpdateBoundTag();
9467
+ }
9468
+ _onUpdateLineOrAreaWithCache(customPath, g, end, ratio, out) {
9469
+ customPath.clear();
9470
+ if (g.type === 'line') {
9471
+ let cache = g.cache;
9472
+ if (!Array.isArray(cache)) {
9473
+ cache = [cache];
9474
+ }
9475
+ const totalLen = cache.reduce((l, c) => l + c.getLength(), 0);
9476
+ const curves = [];
9477
+ cache.forEach((c) => {
9478
+ c.curves.forEach((ci) => curves.push(ci));
9479
+ });
9480
+ return this._updateCurves(customPath, curves, totalLen, ratio);
9481
+ }
9482
+ else if (g.type === 'area') {
9483
+ const cache = g.cacheArea;
9484
+ const totalLen = cache.top.curves.reduce((a, b) => a + b.getLength(), 0);
9485
+ return this._updateCurves(customPath, cache.top.curves, totalLen, ratio);
9486
+ }
9487
+ }
9488
+ _updateCurves(customPath, curves, totalLen, ratio) {
9489
+ var _a, _b;
9490
+ const startLen = totalLen * ratio;
9491
+ const endLen = Math.min((_b = startLen + ((_a = this.params) === null || _a === void 0 ? void 0 : _a.streamLength)) !== null && _b !== void 0 ? _b : 10, totalLen);
9492
+ let lastLen = 0;
9493
+ let start = false;
9494
+ for (let i = 0; i < curves.length; i++) {
9495
+ const curveItem = curves[i];
9496
+ const len = curveItem.getLength();
9497
+ const startPercent = 1 - (lastLen + len - startLen) / len;
9498
+ let endPercent = 1 - (lastLen + len - endLen) / len;
9499
+ let curveForStart;
9500
+ if (lastLen < startLen && lastLen + len > startLen) {
9501
+ start = true;
9502
+ if (curveItem.p2 && curveItem.p3) {
9503
+ const [_, curve2] = divideCubic(curveItem, startPercent);
9504
+ customPath.moveTo(curve2.p0.x, curve2.p0.y);
9505
+ curveForStart = curve2;
9506
+ }
9507
+ else {
9508
+ const p = curveItem.getPointAt(startPercent);
9509
+ customPath.moveTo(p.x, p.y);
9510
+ }
9511
+ }
9512
+ if (lastLen < endLen && lastLen + len > endLen) {
9513
+ if (curveItem.p2 && curveItem.p3) {
9514
+ if (curveForStart) {
9515
+ endPercent = (endLen - startLen) / curveForStart.getLength();
9516
+ }
9517
+ const [curve1] = divideCubic(curveForStart || curveItem, endPercent);
9518
+ customPath.bezierCurveTo(curve1.p1.x, curve1.p1.y, curve1.p2.x, curve1.p2.y, curve1.p3.x, curve1.p3.y);
9519
+ }
9520
+ else {
9521
+ const p = curveItem.getPointAt(endPercent);
9522
+ customPath.lineTo(p.x, p.y);
9523
+ }
9524
+ break;
9525
+ }
9526
+ else if (start) {
9527
+ if (curveItem.p2 && curveItem.p3) {
9528
+ const curve = curveForStart || curveItem;
9529
+ customPath.bezierCurveTo(curve.p1.x, curve.p1.y, curve.p2.x, curve.p2.y, curve.p3.x, curve.p3.y);
9530
+ }
9531
+ else {
9532
+ customPath.lineTo(curveItem.p1.x, curveItem.p1.y);
9533
+ }
9534
+ }
9535
+ lastLen += len;
9536
+ }
9537
+ }
9538
+ _onUpdateLineWithoutCache(customPath, line, end, ratio, out) {
9539
+ var _a, _b;
9540
+ const { points, curveType } = line.attribute;
9541
+ if (!points || points.length < 2 || curveType !== 'linear') {
9542
+ return;
9543
+ }
9544
+ let totalLen = 0;
9545
+ for (let i = 1; i < points.length; i++) {
9546
+ totalLen += vutils.PointService.distancePP(points[i], points[i - 1]);
9547
+ }
9548
+ const startLen = totalLen * ratio;
9549
+ const endLen = Math.min((_b = startLen + ((_a = this.params) === null || _a === void 0 ? void 0 : _a.streamLength)) !== null && _b !== void 0 ? _b : 10, totalLen);
9550
+ const nextPoints = [];
9551
+ let lastLen = 0;
9552
+ for (let i = 1; i < points.length; i++) {
9553
+ const len = vutils.PointService.distancePP(points[i], points[i - 1]);
9554
+ if (lastLen < startLen && lastLen + len > startLen) {
9555
+ nextPoints.push(vutils.PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - startLen) / len));
9556
+ }
9557
+ if (lastLen < endLen && lastLen + len > endLen) {
9558
+ nextPoints.push(vutils.PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - endLen) / len));
9559
+ break;
9560
+ }
9561
+ else if (nextPoints.length) {
9562
+ nextPoints.push(points[i]);
9563
+ }
9564
+ lastLen += len;
9565
+ }
9566
+ if (!nextPoints.length || nextPoints.length < 2) {
9567
+ return;
9568
+ }
9569
+ customPath.clear();
9570
+ customPath.moveTo(nextPoints[0].x, nextPoints[0].y);
9571
+ for (let i = 1; i < nextPoints.length; i++) {
9572
+ customPath.lineTo(nextPoints[i].x, nextPoints[i].y);
9573
+ }
9574
+ }
9324
9575
  }
9325
9576
  class Meteor extends ACustomAnimate {
9326
9577
  get lastPos() {
@@ -12232,6 +12483,10 @@
12232
12483
  }
12233
12484
  const nextStepVal = nextProps[key];
12234
12485
  const lastStepVal = (_a = (lastProps && lastProps[key])) !== null && _a !== void 0 ? _a : subAnimate.getLastPropByName(key, step);
12486
+ if (nextStepVal == null || lastStepVal == null) {
12487
+ nextAttributes[key] = nextStepVal;
12488
+ return;
12489
+ }
12235
12490
  let match;
12236
12491
  match =
12237
12492
  animate.interpolateFunc && animate.interpolateFunc(key, ratio, lastStepVal, nextStepVal, nextAttributes);
@@ -14243,12 +14498,12 @@
14243
14498
  }
14244
14499
  return bbox;
14245
14500
  }
14246
- GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, miniApp) {
14501
+ GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
14247
14502
  const linesLayout = [];
14248
14503
  const bboxWH = [width, height];
14249
14504
  const bboxOffset = [0, 0];
14250
14505
  while (str.length > 0) {
14251
- const { str: clipText } = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak);
14506
+ const { str: clipText } = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition);
14252
14507
  linesLayout.push({
14253
14508
  str: clipText,
14254
14509
  width: this.textMeasure.measureTextWidth(clipText, this.textOptions)
@@ -14277,7 +14532,7 @@
14277
14532
  };
14278
14533
  return this.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14279
14534
  }
14280
- GetLayoutByLines(lines, textAlign, textBaseline, lineHeight, suffix = '', wordBreak, lineWidth) {
14535
+ GetLayoutByLines(lines, textAlign, textBaseline, lineHeight, suffix = '', wordBreak, lineWidth, suffixPosition = 'end') {
14281
14536
  lines = lines.map(l => l.toString());
14282
14537
  const linesLayout = [];
14283
14538
  const bboxWH = [0, 0];
@@ -14286,7 +14541,7 @@
14286
14541
  for (let i = 0, len = lines.length; i < len; i++) {
14287
14542
  width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth);
14288
14543
  linesLayout.push({
14289
- str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak).str,
14544
+ str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14290
14545
  width
14291
14546
  });
14292
14547
  }
@@ -14572,7 +14827,7 @@
14572
14827
  let width;
14573
14828
  let str;
14574
14829
  const attribute = this.attribute;
14575
- const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, ignoreBuf = textTheme.ignoreBuf, whiteSpace = textTheme.whiteSpace } = attribute;
14830
+ const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, ignoreBuf = textTheme.ignoreBuf, whiteSpace = textTheme.whiteSpace, suffixPosition = textTheme.suffixPosition } = attribute;
14576
14831
  if (whiteSpace === 'normal') {
14577
14832
  return this.updateWrapAABBBounds(text);
14578
14833
  }
@@ -14592,7 +14847,7 @@
14592
14847
  if (Number.isFinite(maxLineWidth)) {
14593
14848
  if (ellipsis) {
14594
14849
  const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis);
14595
- const data = textMeasure.clipTextWithSuffix(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false);
14850
+ const data = textMeasure.clipTextWithSuffix(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false, suffixPosition);
14596
14851
  str = data.str;
14597
14852
  width = data.width;
14598
14853
  }
@@ -14636,7 +14891,7 @@
14636
14891
  const attribute = this.attribute;
14637
14892
  const { ignoreBuf = textTheme.ignoreBuf } = attribute;
14638
14893
  const buf = ignoreBuf ? 0 : 2;
14639
- const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, fontFamily = textTheme.fontFamily, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
14894
+ const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, fontFamily = textTheme.fontFamily, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode, suffixPosition = textTheme.suffixPosition } = attribute;
14640
14895
  const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14641
14896
  let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
14642
14897
  if (!verticalMode) {
@@ -14660,7 +14915,7 @@
14660
14915
  if (Number.isFinite(maxLineWidth)) {
14661
14916
  if (ellipsis) {
14662
14917
  const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis);
14663
- const data = textMeasure.clipTextWithSuffixVertical(verticalList[0], { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false);
14918
+ const data = textMeasure.clipTextWithSuffixVertical(verticalList[0], { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false, suffixPosition);
14664
14919
  verticalList = [data.verticalList];
14665
14920
  width = data.width;
14666
14921
  }
@@ -14697,7 +14952,7 @@
14697
14952
  var _a, _b;
14698
14953
  const textTheme = getTheme(this).text;
14699
14954
  const attribute = this.attribute;
14700
- const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, whiteSpace = textTheme.whiteSpace } = attribute;
14955
+ const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, whiteSpace = textTheme.whiteSpace, suffixPosition = textTheme.suffixPosition } = attribute;
14701
14956
  const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize);
14702
14957
  if (whiteSpace === 'normal') {
14703
14958
  return this.updateWrapAABBBounds(text);
@@ -14712,7 +14967,7 @@
14712
14967
  }
14713
14968
  const textMeasure = application.graphicUtil.textMeasure;
14714
14969
  const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);
14715
- const layoutData = layoutObj.GetLayoutByLines(text, textAlign, textBaseline, lineHeight, ellipsis === true ? textTheme.ellipsis : ellipsis || undefined, false, maxLineWidth);
14970
+ const layoutData = layoutObj.GetLayoutByLines(text, textAlign, textBaseline, lineHeight, ellipsis === true ? textTheme.ellipsis : ellipsis || undefined, false, maxLineWidth, suffixPosition);
14716
14971
  const { bbox } = layoutData;
14717
14972
  this.cache.layoutData = layoutData;
14718
14973
  this.clearUpdateShapeTag();
@@ -14730,7 +14985,7 @@
14730
14985
  const attribute = this.attribute;
14731
14986
  const { ignoreBuf = textTheme.ignoreBuf } = attribute;
14732
14987
  const buf = ignoreBuf ? 0 : 2;
14733
- const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
14988
+ const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode, suffixPosition = textTheme.suffixPosition } = attribute;
14734
14989
  const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14735
14990
  let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
14736
14991
  if (!verticalMode) {
@@ -14760,7 +15015,7 @@
14760
15015
  if (Number.isFinite(maxLineWidth)) {
14761
15016
  if (ellipsis) {
14762
15017
  const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis);
14763
- const data = textMeasure.clipTextWithSuffixVertical(verticalData, { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false);
15018
+ const data = textMeasure.clipTextWithSuffixVertical(verticalData, { fontSize, fontWeight, fontFamily }, maxLineWidth, strEllipsis, false, suffixPosition);
14764
15019
  verticalLists[i] = data.verticalList;
14765
15020
  width = data.width;
14766
15021
  }
@@ -15874,6 +16129,9 @@
15874
16129
  return super.isValid() && this._isValid();
15875
16130
  }
15876
16131
  _isValid() {
16132
+ if (this.pathProxy) {
16133
+ return true;
16134
+ }
15877
16135
  const { points, segments } = this.attribute;
15878
16136
  if (segments) {
15879
16137
  if (segments.length === 0) {
@@ -17505,6 +17763,9 @@
17505
17763
  return super.isValid() && this._isValid();
17506
17764
  }
17507
17765
  _isValid() {
17766
+ if (this.pathProxy) {
17767
+ return true;
17768
+ }
17508
17769
  const { points, segments } = this.attribute;
17509
17770
  if (segments) {
17510
17771
  if (segments.length === 0) {
@@ -19108,18 +19369,19 @@
19108
19369
  }
19109
19370
  }
19110
19371
  transformAABBBounds(attribute, aabbBounds, theme, miter, graphic) {
19111
- const { scaleX = theme.scaleX, scaleY = theme.scaleY, stroke = theme.stroke, shadowBlur = theme.shadowBlur, lineWidth = theme.lineWidth, strokeBoundsBuffer = theme.strokeBoundsBuffer } = attribute;
19372
+ const { scaleX = theme.scaleX, scaleY = theme.scaleY, stroke = theme.stroke, shadowBlur = theme.shadowBlur, lineWidth = theme.lineWidth, pickStrokeBuffer = theme.pickStrokeBuffer, strokeBoundsBuffer = theme.strokeBoundsBuffer } = attribute;
19112
19373
  const tb1 = this.tempAABBBounds1;
19113
19374
  const tb2 = this.tempAABBBounds2;
19114
19375
  if (stroke) {
19115
- const scaledHalfLineWidth = lineWidth / Math.abs(scaleX + scaleY);
19376
+ const scaledHalfLineWidth = (lineWidth + pickStrokeBuffer) / Math.abs(scaleX + scaleY);
19116
19377
  boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer);
19117
19378
  aabbBounds.union(tb1);
19118
19379
  tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
19119
19380
  }
19120
19381
  if (shadowBlur) {
19121
- const shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
19122
- boundStroke(tb1, shadowBlurHalfWidth, miter, strokeBoundsBuffer);
19382
+ const { shadowOffsetX = theme.shadowOffsetX, shadowOffsetY = theme.shadowOffsetY } = attribute;
19383
+ const shadowBlurWidth = (shadowBlur / Math.abs(scaleX + scaleY)) * 2 + Math.max(shadowOffsetX, shadowOffsetY);
19384
+ boundStroke(tb1, shadowBlurWidth, miter, strokeBoundsBuffer + 1);
19123
19385
  aabbBounds.union(tb1);
19124
19386
  }
19125
19387
  this.combindShadowAABBBounds(aabbBounds, graphic);
@@ -23910,7 +24172,7 @@
23910
24172
  }
23911
24173
  }
23912
24174
  selectRenderByType(type) {
23913
- console.warn('未知错误,不应该走到这里');
24175
+ vutils.Logger.getInstance().warn('未知错误,不应该走到这里');
23914
24176
  return null;
23915
24177
  }
23916
24178
  selectRenderByNumberType(type) {
@@ -27630,6 +27892,7 @@
27630
27892
  exports.DefaultMatrixAllocate = DefaultMatrixAllocate;
27631
27893
  exports.DefaultMorphingAnimateConfig = DefaultMorphingAnimateConfig;
27632
27894
  exports.DefaultPathAttribute = DefaultPathAttribute;
27895
+ exports.DefaultPickStyle = DefaultPickStyle;
27633
27896
  exports.DefaultPolygonAttribute = DefaultPolygonAttribute;
27634
27897
  exports.DefaultRect3dAttribute = DefaultRect3dAttribute;
27635
27898
  exports.DefaultRectAttribute = DefaultRectAttribute;