@visactor/vrender-components 0.22.7-alpha.8 → 0.22.7

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 (140) hide show
  1. package/cjs/axis/util.js +5 -5
  2. package/cjs/axis/util.js.map +1 -1
  3. package/cjs/brush/brush.d.ts +4 -7
  4. package/cjs/brush/brush.js +67 -53
  5. package/cjs/brush/brush.js.map +1 -1
  6. package/cjs/brush/config.d.ts +1 -1
  7. package/cjs/brush/config.js +1 -1
  8. package/cjs/brush/config.js.map +1 -1
  9. package/cjs/brush/type.js.map +1 -1
  10. package/cjs/data-zoom/data-zoom.d.ts +3 -0
  11. package/cjs/data-zoom/data-zoom.js +39 -24
  12. package/cjs/data-zoom/data-zoom.js.map +1 -1
  13. package/cjs/index.d.ts +1 -1
  14. package/cjs/index.js +1 -1
  15. package/cjs/index.js.map +1 -1
  16. package/cjs/marker/animate/animate.d.ts +3 -3
  17. package/cjs/marker/animate/animate.js.map +1 -1
  18. package/cjs/marker/animate/clip-in.d.ts +1 -1
  19. package/cjs/marker/animate/clip-in.js +6 -3
  20. package/cjs/marker/animate/clip-in.js.map +1 -1
  21. package/cjs/marker/animate/fade-in.d.ts +3 -3
  22. package/cjs/marker/animate/fade-in.js +10 -4
  23. package/cjs/marker/animate/fade-in.js.map +1 -1
  24. package/cjs/marker/animate/fade-out.d.ts +3 -3
  25. package/cjs/marker/animate/fade-out.js +10 -4
  26. package/cjs/marker/animate/fade-out.js.map +1 -1
  27. package/cjs/marker/arc-area.d.ts +8 -5
  28. package/cjs/marker/arc-area.js +18 -39
  29. package/cjs/marker/arc-area.js.map +1 -1
  30. package/cjs/marker/arc-line.d.ts +6 -4
  31. package/cjs/marker/arc-line.js +12 -9
  32. package/cjs/marker/arc-line.js.map +1 -1
  33. package/cjs/marker/area.d.ts +6 -4
  34. package/cjs/marker/area.js +14 -32
  35. package/cjs/marker/area.js.map +1 -1
  36. package/cjs/marker/base.d.ts +2 -3
  37. package/cjs/marker/base.js.map +1 -1
  38. package/cjs/marker/common-line.d.ts +11 -7
  39. package/cjs/marker/common-line.js +11 -31
  40. package/cjs/marker/common-line.js.map +1 -1
  41. package/cjs/marker/config.d.ts +2 -0
  42. package/cjs/marker/config.js +2 -0
  43. package/cjs/marker/config.js.map +1 -1
  44. package/cjs/marker/line.d.ts +6 -4
  45. package/cjs/marker/line.js +10 -4
  46. package/cjs/marker/line.js.map +1 -1
  47. package/cjs/marker/mixin/label.d.ts +16 -0
  48. package/cjs/marker/mixin/label.js +57 -0
  49. package/cjs/marker/mixin/label.js.map +1 -0
  50. package/cjs/marker/type.d.ts +19 -16
  51. package/cjs/marker/type.js.map +1 -1
  52. package/cjs/poptip/contribution.js +4 -2
  53. package/cjs/poptip/contribution.js.map +1 -1
  54. package/cjs/poptip/poptip.d.ts +5 -0
  55. package/cjs/poptip/poptip.js +87 -18
  56. package/cjs/poptip/poptip.js.map +1 -1
  57. package/cjs/poptip/type.d.ts +4 -1
  58. package/cjs/poptip/type.js.map +1 -1
  59. package/cjs/scrollbar/scrollbar.d.ts +1 -0
  60. package/cjs/scrollbar/scrollbar.js +21 -12
  61. package/cjs/scrollbar/scrollbar.js.map +1 -1
  62. package/cjs/slider/slider.d.ts +3 -0
  63. package/cjs/slider/slider.js +48 -27
  64. package/cjs/slider/slider.js.map +1 -1
  65. package/cjs/switch/switch.js +2 -2
  66. package/cjs/switch/switch.js.map +1 -1
  67. package/cjs/util/event.d.ts +1 -0
  68. package/cjs/util/event.js +14 -0
  69. package/cjs/util/event.js.map +1 -0
  70. package/dist/index.es.js +473 -351
  71. package/es/axis/util.js +5 -6
  72. package/es/axis/util.js.map +1 -1
  73. package/es/brush/brush.d.ts +4 -7
  74. package/es/brush/brush.js +70 -55
  75. package/es/brush/brush.js.map +1 -1
  76. package/es/brush/config.d.ts +1 -1
  77. package/es/brush/config.js +1 -1
  78. package/es/brush/config.js.map +1 -1
  79. package/es/brush/type.js.map +1 -1
  80. package/es/data-zoom/data-zoom.d.ts +3 -0
  81. package/es/data-zoom/data-zoom.js +38 -21
  82. package/es/data-zoom/data-zoom.js.map +1 -1
  83. package/es/index.d.ts +1 -1
  84. package/es/index.js +1 -1
  85. package/es/index.js.map +1 -1
  86. package/es/marker/animate/animate.d.ts +3 -3
  87. package/es/marker/animate/animate.js.map +1 -1
  88. package/es/marker/animate/clip-in.d.ts +1 -1
  89. package/es/marker/animate/clip-in.js +6 -2
  90. package/es/marker/animate/clip-in.js.map +1 -1
  91. package/es/marker/animate/fade-in.d.ts +3 -3
  92. package/es/marker/animate/fade-in.js +11 -3
  93. package/es/marker/animate/fade-in.js.map +1 -1
  94. package/es/marker/animate/fade-out.d.ts +3 -3
  95. package/es/marker/animate/fade-out.js +11 -3
  96. package/es/marker/animate/fade-out.js.map +1 -1
  97. package/es/marker/arc-area.d.ts +8 -5
  98. package/es/marker/arc-area.js +19 -41
  99. package/es/marker/arc-area.js.map +1 -1
  100. package/es/marker/arc-line.d.ts +6 -4
  101. package/es/marker/arc-line.js +12 -9
  102. package/es/marker/arc-line.js.map +1 -1
  103. package/es/marker/area.d.ts +6 -4
  104. package/es/marker/area.js +15 -34
  105. package/es/marker/area.js.map +1 -1
  106. package/es/marker/base.d.ts +2 -3
  107. package/es/marker/base.js.map +1 -1
  108. package/es/marker/common-line.d.ts +11 -7
  109. package/es/marker/common-line.js +14 -34
  110. package/es/marker/common-line.js.map +1 -1
  111. package/es/marker/config.d.ts +2 -0
  112. package/es/marker/config.js +2 -0
  113. package/es/marker/config.js.map +1 -1
  114. package/es/marker/line.d.ts +6 -4
  115. package/es/marker/line.js +10 -4
  116. package/es/marker/line.js.map +1 -1
  117. package/es/marker/mixin/label.d.ts +16 -0
  118. package/es/marker/mixin/label.js +45 -0
  119. package/es/marker/mixin/label.js.map +1 -0
  120. package/es/marker/type.d.ts +19 -16
  121. package/es/marker/type.js.map +1 -1
  122. package/es/poptip/contribution.js +4 -2
  123. package/es/poptip/contribution.js.map +1 -1
  124. package/es/poptip/poptip.d.ts +5 -0
  125. package/es/poptip/poptip.js +85 -19
  126. package/es/poptip/poptip.js.map +1 -1
  127. package/es/poptip/type.d.ts +4 -1
  128. package/es/poptip/type.js.map +1 -1
  129. package/es/scrollbar/scrollbar.d.ts +1 -0
  130. package/es/scrollbar/scrollbar.js +22 -11
  131. package/es/scrollbar/scrollbar.js.map +1 -1
  132. package/es/slider/slider.d.ts +3 -0
  133. package/es/slider/slider.js +49 -26
  134. package/es/slider/slider.js.map +1 -1
  135. package/es/switch/switch.js +2 -2
  136. package/es/switch/switch.js.map +1 -1
  137. package/es/util/event.d.ts +1 -0
  138. package/es/util/event.js +6 -0
  139. package/es/util/event.js.map +1 -0
  140. package/package.json +6 -6
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, isArray, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, cos, sin, isString, pointAt, isNumber, getDecimalPlaces, isNil, Color, sqrt, OBBBounds, has, normalTransform, isValidUrl, isBase64, acos, transformBoundsWithMatrix, getContextFont, rotatePoint, clampAngleByRadian, asin, arrayEqual, Bounds, getRectIntersect, isRectIntersect, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, cloneDeep, get, last, mixin, isEqual, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
1
+ import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, isArray, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, cos, sin, isString, pointAt, isNumber, getDecimalPlaces, isNil, Color, sqrt, OBBBounds, has, normalTransform, isValidUrl, isBase64, acos, transformBoundsWithMatrix, getContextFont, rotatePoint, clampAngleByRadian, asin, arrayEqual, Bounds, getRectIntersect, isRectIntersect, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, aabbSeparation, obbSeparation, cloneDeep, get, last, mixin, isEqual, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
2
2
  import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
3
3
 
4
4
  class Generator {
@@ -2287,7 +2287,8 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
2287
2287
  filter: "",
2288
2288
  cursor: null,
2289
2289
  html: null,
2290
- react: null
2290
+ react: null,
2291
+ vue: null
2291
2292
  }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle);
2292
2293
  const DefaultConnectAttribute = {
2293
2294
  connectedType: "none",
@@ -2395,6 +2396,12 @@ const DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute
2395
2396
  cornerRadius: 0,
2396
2397
  closePath: !0
2397
2398
  });
2399
+ const DefaultStarAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
2400
+ width: 100,
2401
+ height: 100,
2402
+ spikes: 5,
2403
+ thickness: .5
2404
+ });
2398
2405
  const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
2399
2406
  width: 0,
2400
2407
  height: 0,
@@ -2720,6 +2727,7 @@ function getScaledStroke(context, width, dpr) {
2720
2727
  function createColor(context, c, params) {
2721
2728
  let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2722
2729
  let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
2730
+ var _a, _b;
2723
2731
  if (!c || !0 === c) return "black";
2724
2732
  let result, color;
2725
2733
  if (isArray(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
@@ -2733,9 +2741,10 @@ function createColor(context, c, params) {
2733
2741
  if (params.attribute) {
2734
2742
  const {
2735
2743
  scaleX = 1,
2736
- scaleY = 1
2744
+ scaleY = 1,
2745
+ angle = 0
2737
2746
  } = params.attribute;
2738
- w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
2747
+ w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY, (angle || 1 !== scaleX || 1 !== scaleY) && (x = 0, y = 0, w = null !== (_a = params.widthWithoutTransform) && void 0 !== _a ? _a : w, h = null !== (_b = params.heightWithoutTransform) && void 0 !== _b ? _b : h);
2739
2748
  }
2740
2749
  "linear" === color.gradient ? result = createLinearGradient(context, color, x, y, w, h) : "conical" === color.gradient ? result = createConicGradient(context, color, x, y, w, h) : "radial" === color.gradient && (result = createRadialGradient(context, color, x, y, w, h));
2741
2750
  }
@@ -2835,6 +2844,7 @@ function applyStrokeStyle(ctx, character) {
2835
2844
  ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
2836
2845
  }
2837
2846
  function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
2847
+ if (desc.length <= 1) return 0;
2838
2848
  if (!width || width <= 0) return 0;
2839
2849
  const textMeasure = application.graphicUtil.textMeasure;
2840
2850
  let index = guessIndex,
@@ -2868,6 +2878,13 @@ function testLetter2(string, index) {
2868
2878
  }
2869
2879
  function measureTextCanvas(text, character) {
2870
2880
  let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "actual";
2881
+ var _a;
2882
+ if ("" === text) return {
2883
+ ascent: 0,
2884
+ height: 0,
2885
+ descent: 0,
2886
+ width: 0
2887
+ };
2871
2888
  const measurement = application.graphicUtil.textMeasure.measureText(text, character),
2872
2889
  result = {
2873
2890
  ascent: 0,
@@ -2877,7 +2894,9 @@ function measureTextCanvas(text, character) {
2877
2894
  },
2878
2895
  ascent = "actual" === mode ? measurement.actualBoundingBoxAscent : measurement.fontBoundingBoxAscent,
2879
2896
  descent = "actual" === mode ? measurement.actualBoundingBoxDescent : measurement.fontBoundingBoxDescent;
2880
- return "number" != typeof ascent || "number" != typeof descent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(ascent + descent), result.ascent = Math.floor(ascent), result.descent = result.height - result.ascent), result;
2897
+ "number" != typeof ascent || "number" != typeof descent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(ascent + descent), result.ascent = Math.floor(ascent), result.descent = result.height - result.ascent);
2898
+ const space = null !== (_a = character.space) && void 0 !== _a ? _a : 0;
2899
+ return result.width += space, result;
2881
2900
  }
2882
2901
 
2883
2902
  var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
@@ -3665,6 +3684,7 @@ const defaultThemeObj = {
3665
3684
  text: DefaultTextAttribute,
3666
3685
  rect: DefaultRectAttribute,
3667
3686
  polygon: DefaultPolygonAttribute,
3687
+ star: DefaultStarAttribute,
3668
3688
  richtext: DefaultRichTextAttribute,
3669
3689
  richtextIcon: DefaultRichTextIconAttribute,
3670
3690
  image: DefaultImageAttribute,
@@ -3683,6 +3703,7 @@ function newThemeObj() {
3683
3703
  text: Object.assign({}, defaultThemeObj.text),
3684
3704
  rect: Object.assign({}, defaultThemeObj.rect),
3685
3705
  polygon: Object.assign({}, defaultThemeObj.polygon),
3706
+ star: Object.assign({}, defaultThemeObj.star),
3686
3707
  richtext: Object.assign({}, defaultThemeObj.richtext),
3687
3708
  richtextIcon: Object.assign({}, defaultThemeObj.richtextIcon),
3688
3709
  image: Object.assign({}, defaultThemeObj.image),
@@ -4162,7 +4183,7 @@ class FederatedEvent {
4162
4183
  }
4163
4184
  _composedDetailPath(params) {
4164
4185
  if (params && params.graphic) {
4165
- const g = this.pickParams.graphic;
4186
+ const g = params.graphic;
4166
4187
  if (g.stage) {
4167
4188
  const path = g.stage.eventSystem.manager.propagationPath(g);
4168
4189
  this.detailPath.push(path), this._composedDetailPath(params.params);
@@ -5928,6 +5949,7 @@ genNumberType();
5928
5949
  const RECT_NUMBER_TYPE = genNumberType();
5929
5950
  genNumberType();
5930
5951
  const RICHTEXT_NUMBER_TYPE = genNumberType();
5952
+ genNumberType();
5931
5953
  const SYMBOL_NUMBER_TYPE = genNumberType();
5932
5954
  const TEXT_NUMBER_TYPE = genNumberType();
5933
5955
  const GraphicService = Symbol.for("GraphicService");
@@ -6182,6 +6204,9 @@ class Graphic extends Node {
6182
6204
  y: y
6183
6205
  });
6184
6206
  }
6207
+ setWidthHeightWithoutTransform(aabbBounds) {
6208
+ this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
6209
+ }
6185
6210
  setAttributes(params) {
6186
6211
  let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
6187
6212
  let context = arguments.length > 2 ? arguments[2] : undefined;
@@ -6470,16 +6495,17 @@ class Graphic extends Node {
6470
6495
  const {
6471
6496
  scaleX: scaleX,
6472
6497
  scaleY: scaleY,
6473
- angle: angle
6498
+ angle: angle,
6499
+ scaleCenter: scaleCenter
6474
6500
  } = this.attribute;
6475
6501
  return tempBounds.copy(this._AABBBounds), this.setAttributes({
6476
- scaleX: 1,
6477
- scaleY: 1,
6478
- angle: 0
6502
+ angle: 0,
6503
+ scaleCenter: null
6479
6504
  }), params.b = this.AABBBounds.clone(), this._AABBBounds.copy(tempBounds), this.setAttributes({
6480
6505
  scaleX: scaleX,
6481
6506
  scaleY: scaleY,
6482
- angle: angle
6507
+ angle: angle,
6508
+ scaleCenter: scaleCenter
6483
6509
  }), params.b;
6484
6510
  };
6485
6511
  if ("string" == typeof anchor[0]) {
@@ -6507,7 +6533,7 @@ class Graphic extends Node {
6507
6533
  } = this.attribute;
6508
6534
  let _anchor = [0, 0];
6509
6535
  const params = {};
6510
- if (anchor && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);else {
6536
+ if (anchor && angle && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);else {
6511
6537
  const m = this._transMatrix;
6512
6538
  m.reset(), m.translate(_anchor[0], _anchor[1]), m.rotate(angle), m.translate(-_anchor[0], -_anchor[1]), m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params), application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
6513
6539
  x: _anchor[0],
@@ -7694,7 +7720,7 @@ class Circle extends Graphic {
7694
7720
  tb1: tb1,
7695
7721
  tb2: tb2
7696
7722
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
7697
- return updateBoundsOfCommonOuterBorder(attribute, circleTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, circleTheme, !1, this), aabbBounds;
7723
+ return updateBoundsOfCommonOuterBorder(attribute, circleTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, circleTheme, !1, this), aabbBounds;
7698
7724
  }
7699
7725
  updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds) {
7700
7726
  const {
@@ -7944,7 +7970,7 @@ class Text extends Graphic {
7944
7970
  const shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
7945
7971
  boundStroke(tb1, shadowBlurHalfWidth, !0, strokeBoundsBuffer), aabbBounds.union(tb1);
7946
7972
  }
7947
- return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
7973
+ return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
7948
7974
  }
7949
7975
  updateSingallineAABBBounds(text) {
7950
7976
  this.updateMultilineAABBBounds([text]);
@@ -8469,7 +8495,7 @@ let Symbol$1 = class Symbol extends Graphic {
8469
8495
  tb1: tb1,
8470
8496
  tb2: tb2
8471
8497
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
8472
- updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
8498
+ updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
8473
8499
  const {
8474
8500
  lineJoin = symbolTheme.lineJoin
8475
8501
  } = attribute;
@@ -8541,7 +8567,7 @@ let Line$1 = class Line extends Graphic {
8541
8567
  return getTheme(this).line;
8542
8568
  }
8543
8569
  updateAABBBounds(attribute, lineTheme, aabbBounds) {
8544
- this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
8570
+ this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
8545
8571
  const {
8546
8572
  lineJoin = lineTheme.lineJoin
8547
8573
  } = attribute;
@@ -8638,7 +8664,7 @@ class Rect extends Graphic {
8638
8664
  tb1: tb1,
8639
8665
  tb2: tb2
8640
8666
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
8641
- return updateBoundsOfCommonOuterBorder(attribute, rectTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, rectTheme, !1, this), aabbBounds;
8667
+ return updateBoundsOfCommonOuterBorder(attribute, rectTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, rectTheme, !1, this), aabbBounds;
8642
8668
  }
8643
8669
  needUpdateTags(keys) {
8644
8670
  return super.needUpdateTags(keys, RECT_UPDATE_TAG_KEY);
@@ -8830,6 +8856,7 @@ function getFixedLRTB(left, right, top, bottom) {
8830
8856
  }
8831
8857
  class Paragraph {
8832
8858
  constructor(text, newLine, character, ascentDescentMode) {
8859
+ var _a, _b;
8833
8860
  this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic", this.ascentDescentMode = ascentDescentMode;
8834
8861
  const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
8835
8862
  this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
@@ -8842,7 +8869,7 @@ class Paragraph {
8842
8869
  let halfDetaHeight = 0,
8843
8870
  deltaAscent = 0,
8844
8871
  deltaDescent = 0;
8845
- this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height), this.ellipsisStr = "...";
8872
+ this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, this.space = character.space, this.dx = null !== (_a = character.dx) && void 0 !== _a ? _a : 0, this.dy = null !== (_b = character.dy) && void 0 !== _b ? _b : 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height), this.ellipsisStr = "...";
8846
8873
  }
8847
8874
  updateWidth() {
8848
8875
  const {
@@ -8861,11 +8888,11 @@ class Paragraph {
8861
8888
  if ("hide" === this.ellipsis) return;
8862
8889
  if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
8863
8890
  const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
8864
- if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
8891
+ if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) if ("vertical" === direction) ;else {
8865
8892
  const {
8866
8893
  width: width
8867
8894
  } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8868
- "vertical" === direction || (left -= this.ellipsisWidth - width);
8895
+ left -= this.ellipsisWidth - width;
8869
8896
  }
8870
8897
  }
8871
8898
  }
@@ -8876,20 +8903,21 @@ class Paragraph {
8876
8903
  });
8877
8904
  }
8878
8905
  draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
8906
+ var _a;
8879
8907
  let baseline = top + ascent,
8880
8908
  text = this.text,
8881
- left = this.left + deltaLeft;
8909
+ left = this.left + deltaLeft + (null !== (_a = this.space) && void 0 !== _a ? _a : 0) / 2;
8882
8910
  baseline += this.top;
8883
8911
  let direction = this.direction;
8884
8912
  if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
8885
8913
  if ("hide" === this.ellipsis) return;
8886
8914
  if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
8887
8915
  const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
8888
- if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
8916
+ if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) if ("vertical" === direction) ;else {
8889
8917
  const {
8890
8918
  width: width
8891
8919
  } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8892
- "vertical" === direction || (left -= this.ellipsisWidth - width);
8920
+ left -= this.ellipsisWidth - width;
8893
8921
  }
8894
8922
  }
8895
8923
  }
@@ -8904,7 +8932,7 @@ class Paragraph {
8904
8932
  const {
8905
8933
  lineWidth = 1
8906
8934
  } = this.character;
8907
- if (this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill) if (this.character.lineThrough || this.character.underline) {
8935
+ if (this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline + this.dy), this.character.fill && ctx.fillText(text, left, baseline + this.dy), this.character.fill) if (this.character.lineThrough || this.character.underline) {
8908
8936
  if (this.character.underline) {
8909
8937
  const top = 1 + baseline,
8910
8938
  lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
@@ -9033,7 +9061,7 @@ class Image extends Graphic {
9033
9061
  tb1: tb1,
9034
9062
  tb2: tb2
9035
9063
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
9036
- return updateBoundsOfCommonOuterBorder(attribute, imageTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, imageTheme, !1, this), aabbBounds;
9064
+ return updateBoundsOfCommonOuterBorder(attribute, imageTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, imageTheme, !1, this), aabbBounds;
9037
9065
  }
9038
9066
  getDefaultAttribute(name) {
9039
9067
  return DefaultImageAttribute[name];
@@ -9376,7 +9404,7 @@ class RichText extends Graphic {
9376
9404
  maxWidth = richtextTheme.maxWidth,
9377
9405
  maxHeight = richtextTheme.maxHeight,
9378
9406
  textAlign = richtextTheme.textAlign,
9379
- verticalDirection = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : richtextTheme.verticalDirection,
9407
+ textBaseline = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : "top",
9380
9408
  editOptions: editOptions
9381
9409
  } = attribute;
9382
9410
  if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
@@ -9391,7 +9419,7 @@ class RichText extends Graphic {
9391
9419
  }
9392
9420
  editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (_c = attribute.textConfig) || void 0 === _c ? void 0 : _c.length) && (aabbBounds.y2 = aabbBounds.y1 + (null !== (_d = attribute.fontSize) && void 0 !== _d ? _d : 12), aabbBounds.x2 = aabbBounds.x1 + 2);
9393
9421
  let deltaY = 0;
9394
- switch (verticalDirection) {
9422
+ switch (textBaseline) {
9395
9423
  case "top":
9396
9424
  deltaY = 0;
9397
9425
  break;
@@ -9412,7 +9440,7 @@ class RichText extends Graphic {
9412
9440
  case "right":
9413
9441
  deltaX = -aabbBounds.width();
9414
9442
  }
9415
- return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
9443
+ return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
9416
9444
  }
9417
9445
  needUpdateTags(keys) {
9418
9446
  return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
@@ -9630,7 +9658,7 @@ class Path extends Graphic {
9630
9658
  tb1: tb1,
9631
9659
  tb2: tb2
9632
9660
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
9633
- updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
9661
+ updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
9634
9662
  const {
9635
9663
  lineJoin = pathTheme.lineJoin
9636
9664
  } = attribute;
@@ -9687,7 +9715,7 @@ class Area extends Graphic {
9687
9715
  return getTheme(this).area;
9688
9716
  }
9689
9717
  updateAABBBounds(attribute, areaTheme, aabbBounds) {
9690
- this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
9718
+ this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds), this.setWidthHeightWithoutTransform(aabbBounds);
9691
9719
  const {
9692
9720
  lineJoin = areaTheme.lineJoin
9693
9721
  } = attribute;
@@ -9892,7 +9920,7 @@ class Arc extends Graphic {
9892
9920
  tb1: tb1,
9893
9921
  tb2: tb2
9894
9922
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
9895
- updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
9923
+ updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.setWidthHeightWithoutTransform(aabbBounds);
9896
9924
  const {
9897
9925
  lineJoin = arcTheme.lineJoin
9898
9926
  } = attribute;
@@ -9995,7 +10023,7 @@ class Polygon extends Graphic {
9995
10023
  return getTheme(this).polygon;
9996
10024
  }
9997
10025
  updateAABBBounds(attribute, polygonTheme, aabbBounds) {
9998
- this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds);
10026
+ this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
9999
10027
  const {
10000
10028
  lineJoin = polygonTheme.lineJoin
10001
10029
  } = attribute;
@@ -14909,6 +14937,13 @@ const SCROLLBAR_START_EVENT = 'scrollDown';
14909
14937
  const SCROLLBAR_EVENT = 'scrollDrag';
14910
14938
  const SCROLLBAR_END_EVENT = 'scrollUp';
14911
14939
 
14940
+ function getEndTriggersOfDrag() {
14941
+ if (vglobal.env === 'browser') {
14942
+ return ['pointerup', 'pointerleave', 'pointercancel'];
14943
+ }
14944
+ return ['pointerup', 'pointerleave', 'pointerupoutside'];
14945
+ }
14946
+
14912
14947
  const delayMap$2 = {
14913
14948
  debounce: debounce,
14914
14949
  throttle: throttle
@@ -14942,6 +14977,7 @@ class ScrollBar extends AbstractComponent {
14942
14977
  }
14943
14978
  };
14944
14979
  this._onSliderPointerDown = (e) => {
14980
+ this._clearDragEvents();
14945
14981
  const { stopSliderDownPropagation = true } = this.attribute;
14946
14982
  if (stopSliderDownPropagation) {
14947
14983
  e.stopPropagation();
@@ -14953,15 +14989,12 @@ class ScrollBar extends AbstractComponent {
14953
14989
  pos: this._prePos,
14954
14990
  event: e
14955
14991
  });
14956
- if (vglobal.env === 'browser') {
14957
- vglobal.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
14958
- vglobal.addEventListener('pointerup', this._onSliderPointerUp);
14959
- }
14960
- else {
14961
- this.stage.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
14962
- this.stage.addEventListener('pointerup', this._onSliderPointerUp);
14963
- this.stage.addEventListener('pointerupoutside', this._onSliderPointerUp);
14964
- }
14992
+ const triggers = getEndTriggersOfDrag();
14993
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
14994
+ obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: true });
14995
+ triggers.forEach((trigger) => {
14996
+ obj.addEventListener(trigger, this._onSliderPointerUp);
14997
+ });
14965
14998
  };
14966
14999
  this._computeScrollValue = (e) => {
14967
15000
  const { direction } = this.attribute;
@@ -14983,6 +15016,7 @@ class ScrollBar extends AbstractComponent {
14983
15016
  return [currentPos, currentScrollValue];
14984
15017
  };
14985
15018
  this._onSliderPointerMove = (e) => {
15019
+ e.preventDefault();
14986
15020
  const { stopSliderMovePropagation = true } = this.attribute;
14987
15021
  if (stopSliderMovePropagation) {
14988
15022
  e.stopPropagation();
@@ -14996,7 +15030,6 @@ class ScrollBar extends AbstractComponent {
14996
15030
  ? this._onSliderPointerMove
14997
15031
  : delayMap$2[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime);
14998
15032
  this._onSliderPointerUp = (e) => {
14999
- e.preventDefault();
15000
15033
  const { range: preRange, limitRange = [0, 1] } = this.attribute;
15001
15034
  const preScrollRange = this.getScrollRange();
15002
15035
  const [currentPos, currentScrollValue] = this._computeScrollValue(e);
@@ -15005,15 +15038,7 @@ class ScrollBar extends AbstractComponent {
15005
15038
  pre: preRange,
15006
15039
  value: clampRange(range, limitRange[0], limitRange[1])
15007
15040
  });
15008
- if (vglobal.env === 'browser') {
15009
- vglobal.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
15010
- vglobal.removeEventListener('pointerup', this._onSliderPointerUp);
15011
- }
15012
- else {
15013
- this.stage.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
15014
- this.stage.removeEventListener('pointerup', this._onSliderPointerUp);
15015
- this.stage.removeEventListener('pointerupoutside', this._onSliderPointerUp);
15016
- }
15041
+ this._clearDragEvents();
15017
15042
  };
15018
15043
  }
15019
15044
  setScrollRange(range, render = true) {
@@ -15146,6 +15171,14 @@ class ScrollBar extends AbstractComponent {
15146
15171
  ? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
15147
15172
  : clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
15148
15173
  }
15174
+ _clearDragEvents() {
15175
+ const triggers = getEndTriggersOfDrag();
15176
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
15177
+ obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: false });
15178
+ triggers.forEach((trigger) => {
15179
+ obj.removeEventListener(trigger, this._onSliderPointerUp);
15180
+ });
15181
+ }
15149
15182
  _reset() {
15150
15183
  this._sliderRenderBounds = null;
15151
15184
  this._sliderLimitRange = null;
@@ -16227,7 +16260,7 @@ class PopTip extends AbstractComponent {
16227
16260
  }
16228
16261
  render() {
16229
16262
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
16230
- const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, logoText, logoTextStyle = {}, triangleMode = 'default', space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0 } = this.attribute;
16263
+ const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = 'position', logoText, logoTextStyle = {}, triangleMode = 'default', space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute;
16231
16264
  let { title = '', content = '' } = this.attribute;
16232
16265
  title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title;
16233
16266
  content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;
@@ -16309,11 +16342,12 @@ class PopTip extends AbstractComponent {
16309
16342
  poptipHeight += contentShape.AABBBounds.height();
16310
16343
  }
16311
16344
  }
16312
- const layout = position === 'auto';
16345
+ const layout = position === 'auto' || isArray(position);
16346
+ const positionList = isArray(position) ? position : this.positionList;
16313
16347
  let maxBBoxI;
16314
16348
  let maxBBoxSize = -Infinity;
16315
- for (let i = 0; i < this.positionList.length + 1; i++) {
16316
- const p = layout ? this.positionList[i === this.positionList.length ? maxBBoxI : i] : position;
16349
+ for (let i = 0; i < positionList.length + 1; i++) {
16350
+ const p = layout ? positionList[i === positionList.length ? maxBBoxI : i] : position;
16317
16351
  let symbolType = 'arrow2Left';
16318
16352
  let offsetX = (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4;
16319
16353
  let offsetY = 0;
@@ -16322,16 +16356,21 @@ class PopTip extends AbstractComponent {
16322
16356
  }
16323
16357
  else if (triangleMode === 'concise') {
16324
16358
  symbolType = conciseSymbolMap[p];
16325
- offsetX = ['tl', 'bl', 'rt', 'rb'].includes(position)
16359
+ offsetX = ['tl', 'bl', 'rt', 'rb'].includes(p)
16326
16360
  ? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2
16327
16361
  : -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2;
16328
- offsetY = ['tl', 'tr', 'lb', 'rb'].includes(position)
16362
+ offsetY = ['tl', 'tr', 'lb', 'rb'].includes(p)
16329
16363
  ? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2
16330
16364
  : (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;
16331
16365
  }
16332
16366
  const { angle, offset } = this.getAngleAndOffset(p, popTipWidth, poptipHeight, isArray(spaceSize) ? spaceSize : [spaceSize, spaceSize - lineWidth], symbolType);
16367
+ let anchorPoint = { x: 0, y: 0 };
16368
+ if (poptipAnchor === 'bounds' && positionBounds) {
16369
+ anchorPoint = this.calculateAnchorPoint(p, positionBounds);
16370
+ }
16371
+ let bgSymbol;
16333
16372
  if (isBoolean(bgVisible)) {
16334
- const bgSymbol = group.createOrUpdateChild('poptip-symbol-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && (contentVisible || titleVisible), x: offsetX, y: offsetY, strokeBoundsBuffer: -1, boundsPadding: -2, anchor: [0, 0], symbolType, angle: angle, dx: offset[0], dy: offset[1] - ((_j = backgroundStyle.space) !== null && _j !== void 0 ? _j : 0), size: symbolSize, zIndex: 9 }), 'symbol');
16373
+ bgSymbol = group.createOrUpdateChild('poptip-symbol-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && (contentVisible || titleVisible), x: offsetX, y: offsetY, strokeBoundsBuffer: -1, boundsPadding: -2, anchor: [0, 0], symbolType, angle: angle, dx: offset[0], dy: offset[1] - ((_j = backgroundStyle.space) !== null && _j !== void 0 ? _j : 0), size: symbolSize, zIndex: 9 }), 'symbol');
16335
16374
  if (!isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
16336
16375
  bgSymbol.states = state.panel;
16337
16376
  }
@@ -16347,8 +16386,8 @@ class PopTip extends AbstractComponent {
16347
16386
  }
16348
16387
  }
16349
16388
  group.setAttributes({
16350
- x: -offset[0] + dx,
16351
- y: -offset[1] + dy,
16389
+ x: -offset[0] + dx + anchorPoint.x,
16390
+ y: -offset[1] + dy + anchorPoint.y,
16352
16391
  anchor: [offsetX, offsetY]
16353
16392
  });
16354
16393
  if (logoSymbol) {
@@ -16370,20 +16409,61 @@ class PopTip extends AbstractComponent {
16370
16409
  group.createOrUpdateChild('poptip-logo-text', Object.assign(Object.assign({}, logoTextStyle), { x: 0, y: poptipHeight / 2, visible: bgVisible && (contentVisible || titleVisible), text: logoText, textAlign: 'center', textBaseline: 'middle', zIndex: 10 }), 'text');
16371
16410
  }
16372
16411
  }
16373
- if (layout && range) {
16412
+ if (range) {
16374
16413
  _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);
16375
16414
  const b = _tBounds;
16376
16415
  const stageBounds = new Bounds().setValue(0, 0, range[0], range[1]);
16377
- if (rectInsideAnotherRect(b, stageBounds, false)) {
16378
- break;
16416
+ if (layout) {
16417
+ if (rectInsideAnotherRect(b, stageBounds, false)) {
16418
+ break;
16419
+ }
16420
+ else {
16421
+ const bbox = getRectIntersect(b, stageBounds, false);
16422
+ const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
16423
+ if (size > maxBBoxSize) {
16424
+ maxBBoxSize = size;
16425
+ maxBBoxI = i;
16426
+ }
16427
+ }
16379
16428
  }
16380
- else {
16381
- const bbox = getRectIntersect(b, stageBounds, false);
16382
- const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
16383
- if (size > maxBBoxSize) {
16384
- maxBBoxSize = size;
16385
- maxBBoxI = i;
16429
+ if (['top', 'bottom', 'left', 'right'].includes(p)) {
16430
+ const isVerticalPosition = p === 'top' || p === 'bottom';
16431
+ const isHorizontalPosition = p === 'left' || p === 'right';
16432
+ let mainDirectionOverlap = false;
16433
+ if (isVerticalPosition) {
16434
+ mainDirectionOverlap = (p === 'top' && b.y1 < 0) || (p === 'bottom' && b.y2 > stageBounds.y2);
16386
16435
  }
16436
+ else if (isHorizontalPosition) {
16437
+ mainDirectionOverlap = (p === 'left' && b.x1 < 0) || (p === 'right' && b.x2 > stageBounds.x2);
16438
+ }
16439
+ if (!mainDirectionOverlap) {
16440
+ let secondaryOffset = 0;
16441
+ const szNumber = (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;
16442
+ if (isVerticalPosition) {
16443
+ if (b.x1 < 0) {
16444
+ secondaryOffset = -b.x1;
16445
+ }
16446
+ else if (b.x2 > stageBounds.x2) {
16447
+ secondaryOffset = stageBounds.x2 - b.x2;
16448
+ }
16449
+ group.setAttribute('x', group.attribute.x + secondaryOffset);
16450
+ bgSymbol.setAttribute('dx', min(max(bgSymbol.attribute.dx - secondaryOffset, szNumber), b.width() - szNumber));
16451
+ }
16452
+ else if (isHorizontalPosition) {
16453
+ if (b.y1 < 0) {
16454
+ secondaryOffset = -b.y1;
16455
+ }
16456
+ else if (b.y2 > stageBounds.y2) {
16457
+ secondaryOffset = stageBounds.y2 - b.y2;
16458
+ }
16459
+ group.setAttribute('y', group.attribute.y + secondaryOffset);
16460
+ bgSymbol.setAttribute('dy', min(max(bgSymbol.attribute.dy - secondaryOffset, szNumber), b.height() - szNumber));
16461
+ }
16462
+ break;
16463
+ }
16464
+ }
16465
+ if (!layout) {
16466
+ break;
16387
16467
  }
16388
16468
  }
16389
16469
  else {
@@ -16391,6 +16471,35 @@ class PopTip extends AbstractComponent {
16391
16471
  }
16392
16472
  }
16393
16473
  }
16474
+ calculateAnchorPoint(position, positionBounds) {
16475
+ if (!positionBounds) {
16476
+ return { x: 0, y: 0 };
16477
+ }
16478
+ const { x, y } = this.attribute;
16479
+ const { x1, y1, x2, y2 } = positionBounds;
16480
+ const width = x2 - x1;
16481
+ const height = y2 - y1;
16482
+ switch (position) {
16483
+ case 'top':
16484
+ case 'tl':
16485
+ case 'tr':
16486
+ return { x: x1 + width / 2 - x, y: y1 - y };
16487
+ case 'bottom':
16488
+ case 'bl':
16489
+ case 'br':
16490
+ return { x: x1 + width / 2 - x, y: y2 - y };
16491
+ case 'left':
16492
+ case 'lt':
16493
+ case 'lb':
16494
+ return { x: x1 - x, y: y1 + height / 2 - y };
16495
+ case 'right':
16496
+ case 'rt':
16497
+ case 'rb':
16498
+ return { x: x2 - x, y: y1 + height / 2 - y };
16499
+ default:
16500
+ return { x: 0, y: 0 };
16501
+ }
16502
+ }
16394
16503
  getAngleAndOffset(position, width, height, size, symbolType) {
16395
16504
  const sizeH = symbolType === 'arrow2Left' ? size[1] / 2 : size[1];
16396
16505
  switch (position) {
@@ -16522,7 +16631,7 @@ let PopTipRenderContribution = class PopTipRenderContribution {
16522
16631
  poptip.content = (_a = poptip.content) !== null && _a !== void 0 ? _a : graphic.attribute.text;
16523
16632
  }
16524
16633
  const matrix = graphic.globalTransMatrix;
16525
- this.poptipComponent.setAttributes(Object.assign(Object.assign({ visibleAll: true, pickable: false, childrenPickable: false }, poptip), { x: matrix.e, y: matrix.f }));
16634
+ this.poptipComponent.setAttributes(Object.assign(Object.assign({ visibleAll: true, pickable: false, childrenPickable: false, poptipAnchor: 'bounds' }, poptip), { x: matrix.e, y: matrix.f, positionBounds: graphic.globalAABBBounds }));
16526
16635
  drawContext.stage.tryInitInteractiveLayer();
16527
16636
  const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');
16528
16637
  if (interactiveLayer) {
@@ -17397,24 +17506,17 @@ function getPolygonPath(points, closed) {
17397
17506
  }
17398
17507
  function textIntersect(textA, textB, sep) {
17399
17508
  var _a;
17400
- let a;
17401
- let b;
17402
17509
  const angle = (_a = textA.attribute) === null || _a === void 0 ? void 0 : _a.angle;
17403
17510
  const isHorizontal = isAngleHorizontal(angle, Number.EPSILON);
17404
- const isAABBIntersects = (textA, textB, sep) => {
17405
- a = textA.AABBBounds;
17406
- b = textB.AABBBounds;
17407
- return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
17408
- };
17409
17511
  if (isHorizontal) {
17410
- return isAABBIntersects(textA, textB, sep);
17512
+ return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
17411
17513
  }
17412
- a = textA.OBBBounds;
17413
- b = textB.OBBBounds;
17514
+ const a = textA.OBBBounds;
17515
+ const b = textB.OBBBounds;
17414
17516
  if (!a || !b || a.empty() || b.empty()) {
17415
- return isAABBIntersects(textA, textB, sep);
17517
+ return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
17416
17518
  }
17417
- return a.intersects(b);
17519
+ return a.intersects(b) || sep > obbSeparation(a, b);
17418
17520
  }
17419
17521
  function hasOverlap(items, pad) {
17420
17522
  for (let i = 1, n = items.length, a = items[0], b; i < n; a = b, ++i) {
@@ -23010,8 +23112,13 @@ class DataZoom extends AbstractComponent {
23010
23112
  end: 1
23011
23113
  };
23012
23114
  this._statePointToData = state => state;
23115
+ this._handleTouchMove = (e) => {
23116
+ if (this._activeState) {
23117
+ e.preventDefault();
23118
+ }
23119
+ };
23013
23120
  this._onHandlerPointerDown = (e, tag) => {
23014
- e.stopPropagation();
23121
+ this._clearDragEvents();
23015
23122
  if (tag === 'start') {
23016
23123
  this._activeTag = DataZoomActiveTag.startHandler;
23017
23124
  this._activeItem = this._startHandlerMask;
@@ -23035,14 +23142,15 @@ class DataZoom extends AbstractComponent {
23035
23142
  this._activeState = true;
23036
23143
  this._activeCache.startPos = this.eventPosToStagePos(e);
23037
23144
  this._activeCache.lastPos = this.eventPosToStagePos(e);
23038
- if (vglobal.env === 'browser') {
23039
- vglobal.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23040
- vglobal.addEventListener('pointerup', this._onHandlerPointerUp);
23041
- }
23042
- this.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23145
+ const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
23146
+ const triggers = getEndTriggersOfDrag();
23147
+ evtTarget.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
23148
+ triggers.forEach((trigger) => {
23149
+ evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
23150
+ });
23043
23151
  };
23044
23152
  this._pointerMove = (e) => {
23045
- e.stopPropagation();
23153
+ e.preventDefault();
23046
23154
  const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
23047
23155
  const pos = this.eventPosToStagePos(e);
23048
23156
  const { attPos, max } = this._layoutCache;
@@ -23072,12 +23180,12 @@ class DataZoom extends AbstractComponent {
23072
23180
  end = end + dis;
23073
23181
  }
23074
23182
  }
23075
- this._activeCache.lastPos = pos;
23076
23183
  brushSelect && this.renderDragMask();
23077
23184
  }
23078
23185
  start = Math.min(Math.max(start, 0), 1);
23079
23186
  end = Math.min(Math.max(end, 0), 1);
23080
23187
  if (startAttr !== start || endAttr !== end) {
23188
+ this._activeCache.lastPos = pos;
23081
23189
  this.setStateAttr(start, end, true);
23082
23190
  if (realTime) {
23083
23191
  this._dispatchEvent('change', {
@@ -23092,7 +23200,6 @@ class DataZoom extends AbstractComponent {
23092
23200
  ? this._pointerMove
23093
23201
  : delayMap$1[this.attribute.delayType](this._pointerMove, this.attribute.delayTime);
23094
23202
  this._onHandlerPointerUp = (e) => {
23095
- e.preventDefault();
23096
23203
  const { start, end, brushSelect, realTime = true } = this.attribute;
23097
23204
  if (this._activeState) {
23098
23205
  if (this._activeTag === DataZoomActiveTag.background) {
@@ -23107,12 +23214,7 @@ class DataZoom extends AbstractComponent {
23107
23214
  end: this.state.end,
23108
23215
  tag: this._activeTag
23109
23216
  });
23110
- if (vglobal.env === 'browser') {
23111
- vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23112
- vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
23113
- }
23114
- this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23115
- this.removeEventListener('pointerup', this._onHandlerPointerUp);
23217
+ this._clearDragEvents();
23116
23218
  };
23117
23219
  const { position, showDetail } = attributes;
23118
23220
  this._activeCache.startPos = position;
@@ -23160,12 +23262,13 @@ class DataZoom extends AbstractComponent {
23160
23262
  if (this._selectedPreviewGroup) {
23161
23263
  this._selectedPreviewGroup.addEventListener('pointerdown', (e) => this._onHandlerPointerDown(e, selectedTag));
23162
23264
  }
23163
- this.addEventListener('pointerup', this._onHandlerPointerUp);
23164
- this.addEventListener('pointerupoutside', this._onHandlerPointerUp);
23165
23265
  if (showDetail === 'auto') {
23166
23266
  this.addEventListener('pointerenter', this._onHandlerPointerEnter);
23167
23267
  this.addEventListener('pointerleave', this._onHandlerPointerLeave);
23168
23268
  }
23269
+ (vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
23270
+ passive: false
23271
+ });
23169
23272
  }
23170
23273
  dragMaskSize() {
23171
23274
  const { position } = this.attribute;
@@ -23193,13 +23296,19 @@ class DataZoom extends AbstractComponent {
23193
23296
  var _a, _b;
23194
23297
  return (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
23195
23298
  }
23299
+ _clearDragEvents() {
23300
+ const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
23301
+ const triggers = getEndTriggersOfDrag();
23302
+ evtTarget.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
23303
+ triggers.forEach((trigger) => {
23304
+ evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
23305
+ });
23306
+ }
23196
23307
  _onHandlerPointerEnter(e) {
23197
- e.stopPropagation();
23198
23308
  this._showText = true;
23199
23309
  this.renderText();
23200
23310
  }
23201
23311
  _onHandlerPointerLeave(e) {
23202
- e.stopPropagation();
23203
23312
  this._showText = false;
23204
23313
  this.renderText();
23205
23314
  }
@@ -23709,6 +23818,13 @@ class DataZoom extends AbstractComponent {
23709
23818
  setStatePointToData(callback) {
23710
23819
  isFunction(callback) && (this._statePointToData = callback);
23711
23820
  }
23821
+ release(all) {
23822
+ super.release(all);
23823
+ (vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
23824
+ passive: false
23825
+ });
23826
+ this._clearDragEvents();
23827
+ }
23712
23828
  }
23713
23829
  DataZoom.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
23714
23830
 
@@ -23998,21 +24114,30 @@ function commonLineClipIn(line, label, duration, delay, easing) {
23998
24114
  .to({ clipRange: 1 }, stepDuration, easing);
23999
24115
  });
24000
24116
  graphicFadeIn(line.endSymbol, delay + startSymbolDuration + lineDuration, endSymbolDuration, easing);
24001
- graphicFadeIn(label.getTextShape(), delay + startSymbolDuration + lineDuration + endSymbolDuration, labelDuration, easing);
24002
- graphicFadeIn(label.getBgRect(), delay + startSymbolDuration + lineDuration + endSymbolDuration, labelDuration, easing);
24117
+ array(label).forEach(labelNode => {
24118
+ const delayTime = delay + startSymbolDuration + lineDuration + endSymbolDuration;
24119
+ graphicFadeIn(labelNode.getTextShape(), delayTime, labelDuration, easing);
24120
+ graphicFadeIn(labelNode.getBgRect(), delayTime, labelDuration, easing);
24121
+ });
24003
24122
  }
24004
24123
 
24005
24124
  function commonLineFadeIn(line, label, duration, delay, easing) {
24006
24125
  segmentFadeIn(line, delay, duration, easing);
24007
- tagFadeIn(label, delay, duration, easing);
24126
+ array(label).forEach(labelNode => {
24127
+ tagFadeIn(labelNode, delay, duration, easing);
24128
+ });
24008
24129
  }
24009
24130
  function areaFadeIn(area, label, duration, delay, easing) {
24010
24131
  graphicFadeIn(area, delay, duration, easing);
24011
- tagFadeIn(label, delay, duration, easing);
24132
+ array(label).forEach(labelNode => {
24133
+ tagFadeIn(labelNode, delay, duration, easing);
24134
+ });
24012
24135
  }
24013
24136
  function arcAreaFadeIn(area, label, duration, delay, easing) {
24014
24137
  graphicFadeIn(area, delay, duration, easing);
24015
- tagFadeIn(label, delay, duration, easing);
24138
+ array(label).forEach(labelNode => {
24139
+ tagFadeIn(labelNode, delay, duration, easing);
24140
+ });
24016
24141
  }
24017
24142
  function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
24018
24143
  var _a;
@@ -24028,15 +24153,21 @@ function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
24028
24153
 
24029
24154
  function commonLineFadeOut(line, label, duration, delay, easing) {
24030
24155
  segmentFadeOut(line, delay, duration, easing);
24031
- tagFadeOut(label, delay, duration, easing);
24156
+ array(label).forEach(labelNode => {
24157
+ tagFadeOut(labelNode, delay, duration, easing);
24158
+ });
24032
24159
  }
24033
24160
  function areaFadeOut(area, label, duration, delay, easing) {
24034
24161
  graphicFadeOut(area, delay, duration, easing);
24035
- tagFadeOut(label, delay, duration, easing);
24162
+ array(label).forEach(labelNode => {
24163
+ tagFadeOut(labelNode, delay, duration, easing);
24164
+ });
24036
24165
  }
24037
24166
  function arcAreaFadeOut(area, label, duration, delay, easing) {
24038
24167
  graphicFadeOut(area, delay, duration, easing);
24039
- tagFadeOut(label, delay, duration, easing);
24168
+ array(label).forEach(labelNode => {
24169
+ tagFadeOut(labelNode, delay, duration, easing);
24170
+ });
24040
24171
  }
24041
24172
  function pointFadeOut(itemLine, decorativeLine, item, duration, delay, easing) {
24042
24173
  var _a;
@@ -24190,6 +24321,48 @@ const DefaultExitMarkerAnimation = {
24190
24321
  delay: 0
24191
24322
  };
24192
24323
 
24324
+ class MarkLabelMixin {
24325
+ getLabel() {
24326
+ return this._label;
24327
+ }
24328
+ _addMarkLabels(container, labelName, defaultLabelAttrs) {
24329
+ const { label, state } = this.attribute;
24330
+ const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
24331
+ const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
24332
+ const labelShapes = array(label).map((labelAttrs, index) => {
24333
+ var _a, _b;
24334
+ const finalLabelAttrs = merge({}, defaultLabelAttrs, labelAttrs);
24335
+ const markLabel = new Tag(Object.assign(Object.assign({}, finalLabelAttrs), { state: {
24336
+ panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
24337
+ text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
24338
+ } }));
24339
+ markLabel.name = labelName;
24340
+ container.add(markLabel);
24341
+ this.setLabelPos(markLabel, finalLabelAttrs);
24342
+ return markLabel;
24343
+ });
24344
+ this._label = array(labelShapes).length === 1 ? labelShapes[0] : labelShapes;
24345
+ }
24346
+ _updateMarkLabels(defaultLabelAttrs) {
24347
+ const { label, state } = this.attribute;
24348
+ const labelShapes = array(this._label);
24349
+ const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
24350
+ const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
24351
+ if (labelShapes.length) {
24352
+ const labels = array(label);
24353
+ labelShapes.forEach((labelItem, index) => {
24354
+ var _a, _b;
24355
+ const finalLabelAttrs = merge({}, defaultLabelAttrs, labels[index]);
24356
+ labelItem.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, finalLabelAttrs), { state: {
24357
+ panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
24358
+ text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
24359
+ } }));
24360
+ this.setLabelPos(labelItem, finalLabelAttrs);
24361
+ });
24362
+ }
24363
+ }
24364
+ }
24365
+
24193
24366
  class MarkCommonLine extends Marker {
24194
24367
  constructor() {
24195
24368
  super(...arguments);
@@ -24200,20 +24373,17 @@ class MarkCommonLine extends Marker {
24200
24373
  getLine() {
24201
24374
  return this._line;
24202
24375
  }
24203
- getLabel() {
24204
- return this._label;
24205
- }
24206
- setLabelPos() {
24207
- const { label = {}, limitRect } = this.attribute;
24208
- const { position, confine, autoRotate } = label;
24209
- const labelPoint = this.getPointAttrByPosition(position);
24376
+ setLabelPos(labelNode, labelAttrs) {
24377
+ const { limitRect } = this.attribute;
24378
+ const { position, confine, autoRotate } = labelAttrs;
24379
+ const labelPoint = this.getPointAttrByPosition(position, labelAttrs);
24210
24380
  const labelAngle = position.toString().toLocaleLowerCase().includes('start')
24211
24381
  ? this._line.getStartAngle() || 0
24212
24382
  : this._line.getEndAngle() || 0;
24213
- this._label.setAttributes(Object.assign(Object.assign({}, labelPoint.position), { angle: autoRotate ? this.getRotateByAngle(labelPoint.angle) : 0, textStyle: Object.assign(Object.assign({}, this.getTextStyle(position, labelAngle, autoRotate)), label.textStyle) }));
24383
+ labelNode.setAttributes(Object.assign(Object.assign({}, labelPoint.position), { angle: autoRotate ? this.getRotateByAngle(labelPoint.angle, labelAttrs) : 0, textStyle: Object.assign(Object.assign({}, this.getTextStyle(position, labelAngle, autoRotate)), labelAttrs.textStyle) }));
24214
24384
  if (limitRect && confine) {
24215
24385
  const { x, y, width, height } = limitRect;
24216
- limitShapeInBounds(this._label, {
24386
+ limitShapeInBounds(labelNode, {
24217
24387
  x1: x,
24218
24388
  y1: y,
24219
24389
  x2: x + width,
@@ -24222,32 +24392,18 @@ class MarkCommonLine extends Marker {
24222
24392
  }
24223
24393
  }
24224
24394
  initMarker(container) {
24225
- const { label, state } = this.attribute;
24226
24395
  const line = this.createSegment();
24227
24396
  line.name = 'mark-common-line-line';
24228
24397
  this._line = line;
24229
24398
  container.add(line);
24230
- const markLabel = new Tag(Object.assign(Object.assign({}, label), { state: {
24231
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
24232
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
24233
- } }));
24234
- markLabel.name = 'mark-common-line-label';
24235
- this._label = markLabel;
24236
- container.add(markLabel);
24237
- this.setLabelPos();
24399
+ this.addMarkLineLabels(container);
24238
24400
  }
24239
24401
  updateMarker() {
24240
- const { label, state } = this.attribute;
24241
24402
  this.setLineAttributes();
24242
- if (this._label) {
24243
- this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
24244
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
24245
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
24246
- } }));
24247
- this.setLabelPos();
24248
- }
24403
+ this.updateMarkLineLabels();
24249
24404
  }
24250
24405
  }
24406
+ mixin(MarkCommonLine, MarkLabelMixin);
24251
24407
 
24252
24408
  const FUZZY_EQUAL_DELTA = 0.001;
24253
24409
  const DEFAULT_MARK_LINE_THEME = {
@@ -24436,6 +24592,7 @@ const DEFAULT_MARK_ARC_LINE_THEME = {
24436
24592
  lineWidth: 0
24437
24593
  },
24438
24594
  label: {
24595
+ autoRotate: true,
24439
24596
  position: IMarkCommonArcLabelPosition.arcOuterMiddle,
24440
24597
  refX: 0,
24441
24598
  refY: 0,
@@ -24490,6 +24647,7 @@ const DEFAULT_MARK_AREA_THEME = {
24490
24647
  const DEFAULT_MARK_ARC_AREA_THEME = {
24491
24648
  interactive: true,
24492
24649
  label: {
24650
+ autoRotate: true,
24493
24651
  position: IMarkCommonArcLabelPosition.arcOuterMiddle,
24494
24652
  textStyle: {
24495
24653
  fill: '#fff',
@@ -24748,10 +24906,9 @@ class MarkLine extends MarkCommonLine {
24748
24906
  super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkLine.defaultAttributes, attributes));
24749
24907
  this.name = 'markLine';
24750
24908
  }
24751
- getPointAttrByPosition(position) {
24909
+ getPointAttrByPosition(position, labelAttrs) {
24752
24910
  var _a;
24753
- const { label = {} } = this.attribute;
24754
- const { refX = 0, refY = 0 } = label;
24911
+ const { refX = 0, refY = 0 } = labelAttrs;
24755
24912
  const points = this._line.getMainSegmentPoints();
24756
24913
  const lineEndAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
24757
24914
  const labelAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle;
@@ -24783,10 +24940,10 @@ class MarkLine extends MarkCommonLine {
24783
24940
  angle: labelAngle
24784
24941
  };
24785
24942
  }
24786
- getRotateByAngle(angle) {
24943
+ getRotateByAngle(angle, labelAttrs) {
24787
24944
  var _a;
24788
24945
  const itemAngle = isPostiveXAxis(angle) ? angle : angle - Math.PI;
24789
- return itemAngle + ((_a = this.attribute.label.refAngle) !== null && _a !== void 0 ? _a : 0);
24946
+ return itemAngle + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
24790
24947
  }
24791
24948
  getTextStyle(position, labelAngle, autoRotate) {
24792
24949
  if (fuzzyEqualNumber(Math.abs(labelAngle), Math.PI / 2, FUZZY_EQUAL_DELTA) ||
@@ -24857,6 +25014,12 @@ class MarkLine extends MarkCommonLine {
24857
25014
  });
24858
25015
  return validFlag;
24859
25016
  }
25017
+ addMarkLineLabels(container) {
25018
+ this._addMarkLabels(container, 'mark-common-line-label', MarkLine.defaultAttributes.label);
25019
+ }
25020
+ updateMarkLineLabels() {
25021
+ this._updateMarkLabels(MarkLine.defaultAttributes.label);
25022
+ }
24860
25023
  }
24861
25024
  MarkLine.defaultAttributes = DEFAULT_MARK_LINE_THEME;
24862
25025
 
@@ -24873,9 +25036,6 @@ class MarkArea extends Marker {
24873
25036
  getArea() {
24874
25037
  return this._area;
24875
25038
  }
24876
- getLabel() {
24877
- return this._label;
24878
- }
24879
25039
  constructor(attributes, options) {
24880
25040
  super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArea.defaultAttributes, attributes));
24881
25041
  this.name = 'markArea';
@@ -24902,16 +25062,15 @@ class MarkArea extends Marker {
24902
25062
  }
24903
25063
  return result;
24904
25064
  }
24905
- setLabelPos() {
25065
+ setLabelPos(labelNode, labelAttrs) {
24906
25066
  var _a;
24907
- if (this._label && this._area) {
24908
- const { label = {} } = this.attribute;
24909
- const labelPosition = (_a = label.position) !== null && _a !== void 0 ? _a : 'middle';
25067
+ if (this._area) {
25068
+ const labelPosition = (_a = labelAttrs.position) !== null && _a !== void 0 ? _a : 'middle';
24910
25069
  const labelPoint = this.getPointAttrByPosition(labelPosition);
24911
- this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle) }));
24912
- if (this.attribute.limitRect && label.confine) {
25070
+ labelNode.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), labelAttrs.textStyle) }));
25071
+ if (this.attribute.limitRect && labelAttrs.confine) {
24913
25072
  const { x, y, width, height } = this.attribute.limitRect;
24914
- limitShapeInBounds(this._label, {
25073
+ limitShapeInBounds(labelNode, {
24915
25074
  x1: x,
24916
25075
  y1: y,
24917
25076
  x2: x + width,
@@ -24921,34 +25080,21 @@ class MarkArea extends Marker {
24921
25080
  }
24922
25081
  }
24923
25082
  initMarker(container) {
24924
- const { points, label, areaStyle, state } = this.attribute;
25083
+ const { points, areaStyle, state } = this.attribute;
24925
25084
  const area = graphicCreator.polygon(Object.assign({ points: points }, areaStyle));
24926
25085
  area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
24927
25086
  area.name = 'mark-area-polygon';
24928
25087
  this._area = area;
24929
25088
  container.add(area);
24930
- const markLabel = new Tag(Object.assign(Object.assign({}, label), { state: {
24931
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
24932
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
24933
- } }));
24934
- markLabel.name = 'mark-area-label';
24935
- this._label = markLabel;
24936
- container.add(markLabel);
24937
- this.setLabelPos();
25089
+ this._addMarkLabels(container, 'mark-area-label', MarkArea.defaultAttributes.label);
24938
25090
  }
24939
25091
  updateMarker() {
24940
- const { points, label, areaStyle, state } = this.attribute;
25092
+ const { points, areaStyle, state } = this.attribute;
24941
25093
  if (this._area) {
24942
25094
  this._area.setAttributes(Object.assign({ points: points }, areaStyle));
24943
25095
  this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
24944
25096
  }
24945
- if (this._label) {
24946
- this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
24947
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
24948
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
24949
- } }));
24950
- }
24951
- this.setLabelPos();
25097
+ this._updateMarkLabels(MarkArea.defaultAttributes.label);
24952
25098
  }
24953
25099
  isValidPoints() {
24954
25100
  const { points } = this.attribute;
@@ -24966,6 +25112,7 @@ class MarkArea extends Marker {
24966
25112
  }
24967
25113
  }
24968
25114
  MarkArea.defaultAttributes = DEFAULT_MARK_AREA_THEME;
25115
+ mixin(MarkArea, MarkLabelMixin);
24969
25116
 
24970
25117
  loadMarkArcLineComponent();
24971
25118
  function registerMarkArcLineAnimate() {
@@ -24978,14 +25125,12 @@ class MarkArcLine extends MarkCommonLine {
24978
25125
  }
24979
25126
  }
24980
25127
  constructor(attributes, options) {
24981
- super((options === null || options === void 0 ? void 0 : options.skipDefault)
24982
- ? attributes
24983
- : merge({}, MarkArcLine.defaultAttributes, attributes, { label: { autoRotate: true } }));
25128
+ super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcLine.defaultAttributes, attributes));
24984
25129
  this.name = 'markArcLine';
24985
25130
  }
24986
- getPointAttrByPosition(direction) {
24987
- const { center, radius, startAngle, endAngle, label } = this.attribute;
24988
- const { refX = 0, refY = 0 } = label;
25131
+ getPointAttrByPosition(direction, labelAttrs) {
25132
+ const { center, radius, startAngle, endAngle } = this.attribute;
25133
+ const { refX = 0, refY = 0 } = labelAttrs;
24989
25134
  let angle;
24990
25135
  switch (direction) {
24991
25136
  case IMarkCommonArcLabelPosition.arcInnerStart:
@@ -25017,9 +25162,9 @@ class MarkArcLine extends MarkCommonLine {
25017
25162
  getTextStyle(position) {
25018
25163
  return DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[position];
25019
25164
  }
25020
- getRotateByAngle(angle) {
25165
+ getRotateByAngle(angle, labelAttrs) {
25021
25166
  var _a;
25022
- return angle - Math.PI / 2 + ((_a = this.attribute.label.refAngle) !== null && _a !== void 0 ? _a : 0);
25167
+ return angle - Math.PI / 2 + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
25023
25168
  }
25024
25169
  createSegment() {
25025
25170
  const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle, state } = this
@@ -25062,6 +25207,12 @@ class MarkArcLine extends MarkCommonLine {
25062
25207
  isValidPoints() {
25063
25208
  return true;
25064
25209
  }
25210
+ addMarkLineLabels(container) {
25211
+ this._addMarkLabels(container, 'mark-common-line-label', MarkArcLine.defaultAttributes.label);
25212
+ }
25213
+ updateMarkLineLabels() {
25214
+ this._updateMarkLabels(MarkArcLine.defaultAttributes.label);
25215
+ }
25065
25216
  }
25066
25217
  MarkArcLine.defaultAttributes = DEFAULT_MARK_ARC_LINE_THEME;
25067
25218
 
@@ -25078,20 +25229,15 @@ class MarkArcArea extends Marker {
25078
25229
  getArea() {
25079
25230
  return this._area;
25080
25231
  }
25081
- getLabel() {
25082
- return this._label;
25083
- }
25084
25232
  constructor(attributes, options) {
25085
- super((options === null || options === void 0 ? void 0 : options.skipDefault)
25086
- ? attributes
25087
- : merge({}, MarkArcArea.defaultAttributes, attributes, { label: { autoRotate: true } }));
25233
+ super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcArea.defaultAttributes, attributes));
25088
25234
  this.name = 'markArcArea';
25089
25235
  this.defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;
25090
25236
  this.defaultExitAnimation = DefaultExitMarkerAnimation;
25091
25237
  }
25092
- getPointAttrByPosition(position) {
25093
- const { center, innerRadius, outerRadius, startAngle, endAngle, label } = this.attribute;
25094
- const { refX = 0, refY = 0 } = label;
25238
+ getPointAttrByPosition(position, labelAttrs) {
25239
+ const { center, innerRadius, outerRadius, startAngle, endAngle } = this.attribute;
25240
+ const { refX = 0, refY = 0 } = labelAttrs;
25095
25241
  let radius;
25096
25242
  let angle;
25097
25243
  switch (position) {
@@ -25135,16 +25281,15 @@ class MarkArcArea extends Marker {
25135
25281
  angle
25136
25282
  };
25137
25283
  }
25138
- setLabelPos() {
25284
+ setLabelPos(labelNode, labelAttrs) {
25139
25285
  var _a;
25140
- if (this._label && this._area) {
25141
- const { label = {} } = this.attribute;
25142
- const { position: labelPosition = 'arcInnerMiddle', autoRotate } = label;
25143
- const labelAttr = this.getPointAttrByPosition(labelPosition);
25144
- this._label.setAttributes(Object.assign(Object.assign({}, labelAttr.position), { angle: autoRotate ? labelAttr.angle - Math.PI / 2 + ((_a = label.refAngle) !== null && _a !== void 0 ? _a : 0) : 0, textStyle: Object.assign(Object.assign({}, DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[labelPosition]), label.textStyle) }));
25145
- if (this.attribute.limitRect && label.confine) {
25286
+ if (this._area) {
25287
+ const { position: labelPosition = 'arcInnerMiddle', autoRotate } = labelAttrs;
25288
+ const labelAttr = this.getPointAttrByPosition(labelPosition, labelAttrs);
25289
+ labelNode.setAttributes(Object.assign(Object.assign({}, labelAttr.position), { angle: autoRotate ? labelAttr.angle - Math.PI / 2 + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0) : 0, textStyle: Object.assign(Object.assign({}, DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[labelPosition]), labelAttrs.textStyle) }));
25290
+ if (this.attribute.limitRect && labelAttrs.confine) {
25146
25291
  const { x, y, width, height } = this.attribute.limitRect;
25147
- limitShapeInBounds(this._label, {
25292
+ limitShapeInBounds(labelNode, {
25148
25293
  x1: x,
25149
25294
  y1: y,
25150
25295
  x2: x + width,
@@ -25154,7 +25299,7 @@ class MarkArcArea extends Marker {
25154
25299
  }
25155
25300
  }
25156
25301
  initMarker(container) {
25157
- const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this
25302
+ const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, state } = this
25158
25303
  .attribute;
25159
25304
  const area = graphicCreator.arc(Object.assign({ x: center.x, y: center.y, innerRadius,
25160
25305
  outerRadius,
@@ -25164,14 +25309,7 @@ class MarkArcArea extends Marker {
25164
25309
  area.name = 'polar-mark-area-area';
25165
25310
  this._area = area;
25166
25311
  container.add(area);
25167
- const markLabel = new Tag(Object.assign(Object.assign({}, label), { state: {
25168
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
25169
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
25170
- } }));
25171
- markLabel.name = 'mark-area-label';
25172
- this._label = markLabel;
25173
- container.add(markLabel);
25174
- this.setLabelPos();
25312
+ this._addMarkLabels(container, 'mark-area-label', MarkArcArea.defaultAttributes.label);
25175
25313
  }
25176
25314
  updateMarker() {
25177
25315
  const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this
@@ -25183,19 +25321,14 @@ class MarkArcArea extends Marker {
25183
25321
  endAngle }, areaStyle));
25184
25322
  this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
25185
25323
  }
25186
- if (this._label) {
25187
- this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
25188
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
25189
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
25190
- } }));
25191
- this.setLabelPos();
25192
- }
25324
+ this._updateMarkLabels(MarkArcArea.defaultAttributes.label);
25193
25325
  }
25194
25326
  isValidPoints() {
25195
25327
  return true;
25196
25328
  }
25197
25329
  }
25198
25330
  MarkArcArea.defaultAttributes = DEFAULT_MARK_ARC_AREA_THEME;
25331
+ mixin(MarkArcArea, MarkLabelMixin);
25199
25332
 
25200
25333
  loadMarkPointComponent();
25201
25334
  function registerMarkPointAnimate() {
@@ -27216,28 +27349,21 @@ class Slider extends AbstractComponent {
27216
27349
  this._dispatchTooltipEvent('sliderTooltipHide');
27217
27350
  };
27218
27351
  this._onHandlerPointerdown = (e) => {
27219
- e.stopPropagation();
27352
+ this._clearAllDragEvents();
27220
27353
  this._isChanging = true;
27221
27354
  const { x, y } = this.stage.eventPointTransform(e);
27222
27355
  this._currentHandler = e.target;
27223
27356
  this._prePos = this._isHorizontal ? x : y;
27224
- if (vglobal.env === 'browser') {
27225
- vglobal.addEventListener('pointermove', this._onHandlerPointerMove, {
27226
- capture: true
27227
- });
27228
- vglobal.addEventListener('pointerup', this._onHandlerPointerUp);
27229
- }
27230
- else {
27231
- this.stage.addEventListener('pointermove', this._onHandlerPointerMove, {
27232
- capture: true
27233
- });
27234
- this.stage.addEventListener('pointerup', this._onHandlerPointerUp);
27235
- this.stage.addEventListener('pointerupoutside', this._onHandlerPointerUp);
27236
- }
27357
+ const triggers = getEndTriggersOfDrag();
27358
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
27359
+ obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
27360
+ triggers.forEach((trigger) => {
27361
+ obj.addEventListener(trigger, this._onHandlerPointerUp);
27362
+ });
27237
27363
  };
27238
27364
  this._onHandlerPointerMove = (e) => {
27239
27365
  var _a, _b;
27240
- e.stopPropagation();
27366
+ e.preventDefault();
27241
27367
  this._isChanging = true;
27242
27368
  const { railWidth, railHeight, min, max } = this.attribute;
27243
27369
  if (max === min) {
@@ -27273,44 +27399,29 @@ class Slider extends AbstractComponent {
27273
27399
  this._dispatchChangeEvent();
27274
27400
  };
27275
27401
  this._onHandlerPointerUp = (e) => {
27276
- e.preventDefault();
27277
27402
  this._isChanging = false;
27278
27403
  this._currentHandler = null;
27279
- if (vglobal.env === 'browser') {
27280
- vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, {
27281
- capture: true
27282
- });
27283
- vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
27284
- }
27285
- else {
27286
- this.stage.removeEventListener('pointermove', this._onHandlerPointerMove, {
27287
- capture: true
27288
- });
27289
- this.stage.removeEventListener('pointerup', this._onHandlerPointerUp);
27290
- this.stage.removeEventListener('pointerupoutside', this._onHandlerPointerUp);
27404
+ this._clearAllDragEvents();
27405
+ };
27406
+ this._handleTouchMove = (e) => {
27407
+ if (this._isChanging) {
27408
+ e.preventDefault();
27291
27409
  }
27292
27410
  };
27293
27411
  this._onTrackPointerdown = (e) => {
27294
- e.stopPropagation();
27412
+ this._clearAllDragEvents();
27295
27413
  this._isChanging = true;
27296
27414
  const { x, y } = this.stage.eventPointTransform(e);
27297
27415
  this._prePos = this._isHorizontal ? x : y;
27298
- if (vglobal.env === 'browser') {
27299
- vglobal.addEventListener('pointermove', this._onTrackPointerMove, {
27300
- capture: true
27301
- });
27302
- vglobal.addEventListener('pointerup', this._onTrackPointerUp);
27303
- }
27304
- else {
27305
- this.stage.addEventListener('pointermove', this._onTrackPointerMove, {
27306
- capture: true
27307
- });
27308
- this.stage.addEventListener('pointerup', this._onTrackPointerUp);
27309
- this.stage.addEventListener('pointerupoutside', this._onTrackPointerUp);
27310
- }
27416
+ const triggers = getEndTriggersOfDrag();
27417
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
27418
+ obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
27419
+ triggers.forEach((trigger) => {
27420
+ obj.addEventListener(trigger, this._onTrackPointerUp);
27421
+ });
27311
27422
  };
27312
27423
  this._onTrackPointerMove = (e) => {
27313
- e.stopPropagation();
27424
+ e.preventDefault();
27314
27425
  this._isChanging = true;
27315
27426
  const { railWidth, railHeight, min, max, inverse } = this.attribute;
27316
27427
  if (max === min) {
@@ -27362,24 +27473,11 @@ class Slider extends AbstractComponent {
27362
27473
  this._dispatchChangeEvent();
27363
27474
  };
27364
27475
  this._onTrackPointerUp = (e) => {
27365
- e.preventDefault();
27366
27476
  this._isChanging = false;
27367
- if (vglobal.env === 'browser') {
27368
- vglobal.removeEventListener('pointermove', this._onTrackPointerMove, {
27369
- capture: true
27370
- });
27371
- vglobal.removeEventListener('pointerup', this._onTrackPointerUp);
27372
- }
27373
- else {
27374
- this.stage.removeEventListener('pointermove', this._onTrackPointerMove, {
27375
- capture: true
27376
- });
27377
- this.stage.removeEventListener('pointerup', this._onTrackPointerUp);
27378
- this.stage.removeEventListener('pointerupoutside', this._onTrackPointerUp);
27379
- }
27477
+ this._clearAllDragEvents();
27380
27478
  };
27381
27479
  this._onRailPointerDown = (e) => {
27382
- e.stopPropagation();
27480
+ this._clearAllDragEvents();
27383
27481
  this._isChanging = true;
27384
27482
  const { railWidth, railHeight, min, max } = this.attribute;
27385
27483
  if (max === min) {
@@ -27757,6 +27855,9 @@ class Slider extends AbstractComponent {
27757
27855
  this._track.addEventListener('pointerdown', this._onTrackPointerdown);
27758
27856
  }
27759
27857
  this._railContainer.addEventListener('pointerdown', this._onRailPointerDown);
27858
+ (vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
27859
+ passive: false
27860
+ });
27760
27861
  }
27761
27862
  }
27762
27863
  _bindTooltipEvents() {
@@ -27767,6 +27868,18 @@ class Slider extends AbstractComponent {
27767
27868
  this._mainContainer.addEventListener('pointermove', this._onTooltipUpdate);
27768
27869
  this._mainContainer.addEventListener('pointerleave', this._onTooltipHide);
27769
27870
  }
27871
+ _clearAllDragEvents() {
27872
+ const triggers = getEndTriggersOfDrag();
27873
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
27874
+ obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
27875
+ triggers.forEach((trigger) => {
27876
+ obj.removeEventListener(trigger, this._onHandlerPointerUp);
27877
+ });
27878
+ obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
27879
+ triggers.forEach((trigger) => {
27880
+ obj.removeEventListener(trigger, this._onTrackPointerUp);
27881
+ });
27882
+ }
27770
27883
  _updateTrack() {
27771
27884
  const { inverse, railWidth, railHeight } = this.attribute;
27772
27885
  const startHandler = this._startHandler;
@@ -27907,6 +28020,13 @@ class Slider extends AbstractComponent {
27907
28020
  endHandler
27908
28021
  };
27909
28022
  }
28023
+ release(all) {
28024
+ super.release(all);
28025
+ (vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
28026
+ passive: false
28027
+ });
28028
+ this._clearAllDragEvents();
28029
+ }
27910
28030
  }
27911
28031
  Slider.defaultAttributes = {
27912
28032
  slidable: true,
@@ -29606,7 +29726,7 @@ var IOperateType;
29606
29726
  const DEFAULT_BRUSH_ATTRIBUTES = {
29607
29727
  trigger: 'pointerdown',
29608
29728
  updateTrigger: 'pointermove',
29609
- endTrigger: ['pointerup', 'pointerleave'],
29729
+ endTrigger: 'pointerup',
29610
29730
  resetTrigger: 'pointerupoutside',
29611
29731
  hasMask: true,
29612
29732
  brushMode: 'single',
@@ -29660,7 +29780,6 @@ class Brush extends AbstractComponent {
29660
29780
  this._isDownBeforeUpOutside = true;
29661
29781
  return;
29662
29782
  }
29663
- this._isDownBeforeUpOutside = false;
29664
29783
  e.stopPropagation();
29665
29784
  const brushMoved = (_a = this.attribute.brushMoved) !== null && _a !== void 0 ? _a : true;
29666
29785
  this._activeMoveState = brushMoved && this._isPosInBrushMask(e);
@@ -29683,14 +29802,6 @@ class Brush extends AbstractComponent {
29683
29802
  : delayMap[this.attribute.delayType](this._onBrushing, this.attribute.delayTime);
29684
29803
  this._onBrushEnd = (e) => {
29685
29804
  var _a;
29686
- if (this._isDownBeforeUpOutside) {
29687
- if (!this._isEmptyMask()) {
29688
- this._clearMask();
29689
- this._dispatchBrushEvent(IOperateType.brushClear, e);
29690
- }
29691
- this._isDownBeforeUpOutside = false;
29692
- return;
29693
- }
29694
29805
  if (!this._activeDrawState && !this._activeMoveState) {
29695
29806
  return;
29696
29807
  }
@@ -29698,29 +29809,29 @@ class Brush extends AbstractComponent {
29698
29809
  const { removeOnClick = true } = this.attribute;
29699
29810
  if (this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick) {
29700
29811
  if ((_a = this._operatingMask) === null || _a === void 0 ? void 0 : _a._AABBBounds.empty()) {
29701
- if (!this._isEmptyMask()) {
29702
- this._clearMask();
29703
- this._dispatchBrushEvent(IOperateType.brushClear, e);
29704
- }
29705
- }
29706
- else {
29707
- delete this._brushMaskAABBBoundsDict[this._operatingMask.name];
29708
- this._container.setAttributes({});
29709
- this._container.removeChild(this._operatingMask);
29710
- if (!this._isEmptyMask()) {
29711
- this._dispatchBrushEvent(IOperateType.brushClear, e);
29712
- }
29713
- else {
29714
- this._dispatchBrushEvent(IOperateType.drawEnd, e);
29715
- }
29812
+ this._dispatchEvent(IOperateType.brushClear, {
29813
+ operateMask: this._operatingMask,
29814
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29815
+ event: e
29816
+ });
29716
29817
  }
29818
+ this._container.incrementalClearChild();
29819
+ this._brushMaskAABBBoundsDict = {};
29717
29820
  }
29718
29821
  else {
29719
29822
  if (this._activeDrawState) {
29720
- this._dispatchBrushEvent(IOperateType.drawEnd, e);
29823
+ this._dispatchEvent(IOperateType.drawEnd, {
29824
+ operateMask: this._operatingMask,
29825
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29826
+ event: e
29827
+ });
29721
29828
  }
29722
29829
  if (this._activeMoveState) {
29723
- this._dispatchBrushEvent(IOperateType.moveEnd, e);
29830
+ this._dispatchEvent(IOperateType.moveEnd, {
29831
+ operateMask: this._operatingMask,
29832
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29833
+ event: e
29834
+ });
29724
29835
  }
29725
29836
  }
29726
29837
  this._activeDrawState = false;
@@ -29732,14 +29843,23 @@ class Brush extends AbstractComponent {
29732
29843
  };
29733
29844
  this._onBrushClear = (e) => {
29734
29845
  e.preventDefault();
29735
- if (!this._isEmptyMask()) {
29736
- this._clearMask();
29737
- this._dispatchBrushEvent(IOperateType.brushClear, e);
29846
+ const { removeOnClick = true } = this.attribute;
29847
+ if (this._isDownBeforeUpOutside && removeOnClick) {
29848
+ this._dispatchEvent(IOperateType.brushClear, {
29849
+ operateMask: this._operatingMask,
29850
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29851
+ event: e
29852
+ });
29853
+ this._container.incrementalClearChild();
29854
+ this._brushMaskAABBBoundsDict = {};
29738
29855
  }
29739
29856
  this._activeDrawState = false;
29740
29857
  this._activeMoveState = false;
29741
29858
  this._isDrawedBeforeEnd = false;
29742
29859
  this._isDownBeforeUpOutside = false;
29860
+ if (this._operatingMask) {
29861
+ this._operatingMask.setAttribute('pickable', false);
29862
+ }
29743
29863
  };
29744
29864
  }
29745
29865
  _bindBrushEvents() {
@@ -29747,19 +29867,44 @@ class Brush extends AbstractComponent {
29747
29867
  return;
29748
29868
  }
29749
29869
  const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
29750
- array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart));
29870
+ array(trigger).forEach(t => vglobal.addEventListener(t, this._onBrushStart));
29751
29871
  array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay));
29752
29872
  array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
29753
29873
  array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
29754
29874
  }
29875
+ _isPosInBrushMask(e) {
29876
+ const pos = this.eventPosToStagePos(e);
29877
+ const brushMasks = this._container.getChildren();
29878
+ for (let i = 0; i < brushMasks.length; i++) {
29879
+ const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
29880
+ const pointsConsiderOffset = points.map((point) => {
29881
+ return {
29882
+ x: point.x + dx,
29883
+ y: point.y + dy
29884
+ };
29885
+ });
29886
+ if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
29887
+ this._operatingMask = brushMasks[i];
29888
+ return true;
29889
+ }
29890
+ }
29891
+ return false;
29892
+ }
29755
29893
  _initDraw(e) {
29756
29894
  const { brushMode } = this.attribute;
29757
29895
  const pos = this.eventPosToStagePos(e);
29758
29896
  this._cacheDrawPoints = [pos];
29759
29897
  this._isDrawedBeforeEnd = false;
29760
- brushMode === 'single' && this._clearMask();
29898
+ if (brushMode === 'single') {
29899
+ this._brushMaskAABBBoundsDict = {};
29900
+ this._container.incrementalClearChild();
29901
+ }
29761
29902
  this._addBrushMask();
29762
- this._dispatchBrushEvent(IOperateType.drawStart, e);
29903
+ this._dispatchEvent(IOperateType.drawStart, {
29904
+ operateMask: this._operatingMask,
29905
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29906
+ event: e
29907
+ });
29763
29908
  }
29764
29909
  _initMove(e) {
29765
29910
  var _a, _b;
@@ -29776,7 +29921,11 @@ class Brush extends AbstractComponent {
29776
29921
  this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX];
29777
29922
  this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY];
29778
29923
  this._operatingMask.setAttribute('pickable', true);
29779
- this._dispatchBrushEvent(IOperateType.moveStart, e);
29924
+ this._dispatchEvent(IOperateType.moveStart, {
29925
+ operateMask: this._operatingMask,
29926
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29927
+ event: e
29928
+ });
29780
29929
  }
29781
29930
  _drawing(e) {
29782
29931
  var _a, _b;
@@ -29803,8 +29952,12 @@ class Brush extends AbstractComponent {
29803
29952
  !!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold);
29804
29953
  if (this._isDrawedBeforeEnd) {
29805
29954
  this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
29955
+ this._dispatchEvent(IOperateType.drawing, {
29956
+ operateMask: this._operatingMask,
29957
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29958
+ event: e
29959
+ });
29806
29960
  }
29807
- this._dispatchBrushEvent(IOperateType.drawing, e);
29808
29961
  }
29809
29962
  _moving(e) {
29810
29963
  const startPos = this._cacheMovePoint;
@@ -29823,20 +29976,11 @@ class Brush extends AbstractComponent {
29823
29976
  dy: moveY
29824
29977
  });
29825
29978
  this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
29826
- this._dispatchBrushEvent(IOperateType.moving, e);
29827
- }
29828
- render() {
29829
- this.releaseBrushEvents();
29830
- this._bindBrushEvents();
29831
- const group = this.createOrUpdateChild('brush-container', {}, 'group');
29832
- this._container = group;
29833
- }
29834
- releaseBrushEvents() {
29835
- const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
29836
- array(trigger).forEach(t => this.stage.removeEventListener(t, this._onBrushStart));
29837
- array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay));
29838
- array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd));
29839
- array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear));
29979
+ this._dispatchEvent(IOperateType.moving, {
29980
+ operateMask: this._operatingMask,
29981
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29982
+ event: e
29983
+ });
29840
29984
  }
29841
29985
  _computeMaskPoints() {
29842
29986
  const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute;
@@ -29905,30 +30049,12 @@ class Brush extends AbstractComponent {
29905
30049
  _addBrushMask() {
29906
30050
  var _a;
29907
30051
  const { brushStyle, hasMask } = this.attribute;
29908
- const brushMask = graphicCreator.polygon(Object.assign(Object.assign({ points: cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? ((_a = brushStyle.opacity) !== null && _a !== void 0 ? _a : 1) : 0 }));
30052
+ const brushMask = graphicCreator.polygon(Object.assign(Object.assign({ points: cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? (_a = brushStyle.opacity) !== null && _a !== void 0 ? _a : 1 : 0 }));
29909
30053
  brushMask.name = `brush-${Date.now()}`;
29910
30054
  this._operatingMask = brushMask;
29911
30055
  this._container.add(brushMask);
29912
30056
  this._brushMaskAABBBoundsDict[brushMask.name] = brushMask.AABBBounds;
29913
30057
  }
29914
- _isPosInBrushMask(e) {
29915
- const pos = this.eventPosToStagePos(e);
29916
- const brushMasks = this._container.getChildren();
29917
- for (let i = 0; i < brushMasks.length; i++) {
29918
- const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
29919
- const pointsConsiderOffset = points.map((point) => {
29920
- return {
29921
- x: point.x + dx,
29922
- y: point.y + dy
29923
- };
29924
- });
29925
- if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
29926
- this._operatingMask = brushMasks[i];
29927
- return true;
29928
- }
29929
- }
29930
- return false;
29931
- }
29932
30058
  _outOfInteractiveRange(e) {
29933
30059
  const { interactiveRange } = this.attribute;
29934
30060
  const { minY = -Infinity, maxY = Infinity, minX = -Infinity, maxX = Infinity } = interactiveRange;
@@ -29941,21 +30067,17 @@ class Brush extends AbstractComponent {
29941
30067
  eventPosToStagePos(e) {
29942
30068
  return this.stage.eventPointTransform(e);
29943
30069
  }
29944
- _dispatchBrushEvent(operateType, e) {
29945
- this._dispatchEvent(operateType, {
29946
- operateMask: this._operatingMask,
29947
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
29948
- event: e
29949
- });
29950
- }
29951
- _clearMask() {
29952
- this._brushMaskAABBBoundsDict = {};
29953
- this._container.incrementalClearChild();
29954
- this._operatingMask = null;
30070
+ render() {
30071
+ this._bindBrushEvents();
30072
+ const group = this.createOrUpdateChild('brush-container', {}, 'group');
30073
+ this._container = group;
29955
30074
  }
29956
- _isEmptyMask() {
29957
- return (isEmpty(this._brushMaskAABBBoundsDict) ||
29958
- Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty()));
30075
+ releaseBrushEvents() {
30076
+ const { delayType = 'throttle', delayTime = 0, trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
30077
+ array(trigger).forEach(t => vglobal.removeEventListener(t, this._onBrushStart));
30078
+ array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay));
30079
+ array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd));
30080
+ array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear));
29959
30081
  }
29960
30082
  }
29961
30083
  Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
@@ -31257,10 +31379,10 @@ class Switch extends AbstractComponent {
31257
31379
  });
31258
31380
  this._circle.setAttributes({
31259
31381
  y: circleY,
31260
- x: this.attribute.checked ? circleX : maxWidth - circleX
31382
+ x: !this.attribute.checked ? circleX : maxWidth - circleX
31261
31383
  });
31262
31384
  this._text.setAttributes({
31263
- x: this.attribute.checked ? textX : maxWidth - textX - textWidth,
31385
+ x: !this.attribute.checked ? textX : maxWidth - textX - textWidth,
31264
31386
  y: textY
31265
31387
  });
31266
31388
  }
@@ -31498,6 +31620,6 @@ StoryLabelItem.defaultAttributes = {
31498
31620
  theme: 'default'
31499
31621
  };
31500
31622
 
31501
- const version = "0.22.7-alpha.8";
31623
+ const version = "0.22.7";
31502
31624
 
31503
31625
  export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };