@visactor/vrender-components 0.22.7-alpha.5 → 0.22.7-alpha.6

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 (54) hide show
  1. package/cjs/crosshair/base.js +2 -1
  2. package/cjs/crosshair/type.js +1 -2
  3. package/cjs/data-zoom/data-zoom.d.ts +2 -0
  4. package/cjs/data-zoom/data-zoom.js +34 -24
  5. package/cjs/data-zoom/data-zoom.js.map +1 -1
  6. package/cjs/index.d.ts +1 -1
  7. package/cjs/index.js +1 -1
  8. package/cjs/index.js.map +1 -1
  9. package/cjs/poptip/contribution.js +2 -4
  10. package/cjs/poptip/contribution.js.map +1 -1
  11. package/cjs/poptip/poptip.d.ts +0 -5
  12. package/cjs/poptip/poptip.js +18 -87
  13. package/cjs/poptip/poptip.js.map +1 -1
  14. package/cjs/poptip/type.d.ts +1 -4
  15. package/cjs/poptip/type.js.map +1 -1
  16. package/cjs/scrollbar/scrollbar.d.ts +1 -0
  17. package/cjs/scrollbar/scrollbar.js +21 -12
  18. package/cjs/scrollbar/scrollbar.js.map +1 -1
  19. package/cjs/slider/slider.d.ts +2 -0
  20. package/cjs/slider/slider.js +43 -27
  21. package/cjs/slider/slider.js.map +1 -1
  22. package/cjs/switch/switch.js +2 -2
  23. package/cjs/switch/switch.js.map +1 -1
  24. package/cjs/util/event.d.ts +1 -0
  25. package/cjs/util/event.js +14 -0
  26. package/cjs/util/event.js.map +1 -0
  27. package/dist/index.es.js +115 -215
  28. package/es/crosshair/base.js +2 -1
  29. package/es/crosshair/type.js +1 -2
  30. package/es/data-zoom/data-zoom.d.ts +2 -0
  31. package/es/data-zoom/data-zoom.js +33 -21
  32. package/es/data-zoom/data-zoom.js.map +1 -1
  33. package/es/index.d.ts +1 -1
  34. package/es/index.js +1 -1
  35. package/es/index.js.map +1 -1
  36. package/es/poptip/contribution.js +2 -4
  37. package/es/poptip/contribution.js.map +1 -1
  38. package/es/poptip/poptip.d.ts +0 -5
  39. package/es/poptip/poptip.js +19 -85
  40. package/es/poptip/poptip.js.map +1 -1
  41. package/es/poptip/type.d.ts +1 -4
  42. package/es/poptip/type.js.map +1 -1
  43. package/es/scrollbar/scrollbar.d.ts +1 -0
  44. package/es/scrollbar/scrollbar.js +22 -11
  45. package/es/scrollbar/scrollbar.js.map +1 -1
  46. package/es/slider/slider.d.ts +2 -0
  47. package/es/slider/slider.js +44 -26
  48. package/es/slider/slider.js.map +1 -1
  49. package/es/switch/switch.js +2 -2
  50. package/es/switch/switch.js.map +1 -1
  51. package/es/util/event.d.ts +1 -0
  52. package/es/util/event.js +6 -0
  53. package/es/util/event.js.map +1 -0
  54. package/package.json +5 -5
package/dist/index.es.js CHANGED
@@ -2835,7 +2835,6 @@ function applyStrokeStyle(ctx, character) {
2835
2835
  ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
2836
2836
  }
2837
2837
  function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
2838
- if (desc.length <= 1) return 0;
2839
2838
  if (!width || width <= 0) return 0;
2840
2839
  const textMeasure = application.graphicUtil.textMeasure;
2841
2840
  let index = guessIndex,
@@ -2869,13 +2868,6 @@ function testLetter2(string, index) {
2869
2868
  }
2870
2869
  function measureTextCanvas(text, character) {
2871
2870
  let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "actual";
2872
- var _a;
2873
- if ("" === text) return {
2874
- ascent: 0,
2875
- height: 0,
2876
- descent: 0,
2877
- width: 0
2878
- };
2879
2871
  const measurement = application.graphicUtil.textMeasure.measureText(text, character),
2880
2872
  result = {
2881
2873
  ascent: 0,
@@ -2885,9 +2877,7 @@ function measureTextCanvas(text, character) {
2885
2877
  },
2886
2878
  ascent = "actual" === mode ? measurement.actualBoundingBoxAscent : measurement.fontBoundingBoxAscent,
2887
2879
  descent = "actual" === mode ? measurement.actualBoundingBoxDescent : measurement.fontBoundingBoxDescent;
2888
- "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);
2889
- const space = null !== (_a = character.space) && void 0 !== _a ? _a : 0;
2890
- return result.width += space, result;
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;
2891
2881
  }
2892
2882
 
2893
2883
  var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
@@ -4172,7 +4162,7 @@ class FederatedEvent {
4172
4162
  }
4173
4163
  _composedDetailPath(params) {
4174
4164
  if (params && params.graphic) {
4175
- const g = params.graphic;
4165
+ const g = this.pickParams.graphic;
4176
4166
  if (g.stage) {
4177
4167
  const path = g.stage.eventSystem.manager.propagationPath(g);
4178
4168
  this.detailPath.push(path), this._composedDetailPath(params.params);
@@ -8840,7 +8830,6 @@ function getFixedLRTB(left, right, top, bottom) {
8840
8830
  }
8841
8831
  class Paragraph {
8842
8832
  constructor(text, newLine, character, ascentDescentMode) {
8843
- var _a, _b;
8844
8833
  this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic", this.ascentDescentMode = ascentDescentMode;
8845
8834
  const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
8846
8835
  this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
@@ -8853,7 +8842,7 @@ class Paragraph {
8853
8842
  let halfDetaHeight = 0,
8854
8843
  deltaAscent = 0,
8855
8844
  deltaDescent = 0;
8856
- 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 = "...";
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 = "...";
8857
8846
  }
8858
8847
  updateWidth() {
8859
8848
  const {
@@ -8872,11 +8861,11 @@ class Paragraph {
8872
8861
  if ("hide" === this.ellipsis) return;
8873
8862
  if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
8874
8863
  const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
8875
- if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) if ("vertical" === direction) ;else {
8864
+ if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
8876
8865
  const {
8877
8866
  width: width
8878
8867
  } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8879
- left -= this.ellipsisWidth - width;
8868
+ "vertical" === direction || (left -= this.ellipsisWidth - width);
8880
8869
  }
8881
8870
  }
8882
8871
  }
@@ -8887,21 +8876,20 @@ class Paragraph {
8887
8876
  });
8888
8877
  }
8889
8878
  draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
8890
- var _a;
8891
8879
  let baseline = top + ascent,
8892
8880
  text = this.text,
8893
- left = this.left + deltaLeft + (null !== (_a = this.space) && void 0 !== _a ? _a : 0) / 2;
8881
+ left = this.left + deltaLeft;
8894
8882
  baseline += this.top;
8895
8883
  let direction = this.direction;
8896
8884
  if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
8897
8885
  if ("hide" === this.ellipsis) return;
8898
8886
  if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
8899
8887
  const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
8900
- if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) if ("vertical" === direction) ;else {
8888
+ if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
8901
8889
  const {
8902
8890
  width: width
8903
8891
  } = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
8904
- left -= this.ellipsisWidth - width;
8892
+ "vertical" === direction || (left -= this.ellipsisWidth - width);
8905
8893
  }
8906
8894
  }
8907
8895
  }
@@ -8916,7 +8904,7 @@ class Paragraph {
8916
8904
  const {
8917
8905
  lineWidth = 1
8918
8906
  } = this.character;
8919
- 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) {
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) {
8920
8908
  if (this.character.underline) {
8921
8909
  const top = 1 + baseline,
8922
8910
  lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
@@ -14921,6 +14909,13 @@ const SCROLLBAR_START_EVENT = 'scrollDown';
14921
14909
  const SCROLLBAR_EVENT = 'scrollDrag';
14922
14910
  const SCROLLBAR_END_EVENT = 'scrollUp';
14923
14911
 
14912
+ function getEndTriggersOfDrag() {
14913
+ if (vglobal.env === 'browser') {
14914
+ return ['pointerup', 'pointerleave', 'pointercancel'];
14915
+ }
14916
+ return ['pointerup', 'pointerleave', 'pointerupoutside'];
14917
+ }
14918
+
14924
14919
  const delayMap$2 = {
14925
14920
  debounce: debounce,
14926
14921
  throttle: throttle
@@ -14954,6 +14949,7 @@ class ScrollBar extends AbstractComponent {
14954
14949
  }
14955
14950
  };
14956
14951
  this._onSliderPointerDown = (e) => {
14952
+ this._clearDragEvents();
14957
14953
  const { stopSliderDownPropagation = true } = this.attribute;
14958
14954
  if (stopSliderDownPropagation) {
14959
14955
  e.stopPropagation();
@@ -14965,15 +14961,12 @@ class ScrollBar extends AbstractComponent {
14965
14961
  pos: this._prePos,
14966
14962
  event: e
14967
14963
  });
14968
- if (vglobal.env === 'browser') {
14969
- vglobal.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
14970
- vglobal.addEventListener('pointerup', this._onSliderPointerUp);
14971
- }
14972
- else {
14973
- this.stage.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
14974
- this.stage.addEventListener('pointerup', this._onSliderPointerUp);
14975
- this.stage.addEventListener('pointerupoutside', this._onSliderPointerUp);
14976
- }
14964
+ const triggers = getEndTriggersOfDrag();
14965
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
14966
+ obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: true });
14967
+ triggers.forEach((trigger) => {
14968
+ obj.addEventListener(trigger, this._onSliderPointerUp);
14969
+ });
14977
14970
  };
14978
14971
  this._computeScrollValue = (e) => {
14979
14972
  const { direction } = this.attribute;
@@ -14995,6 +14988,7 @@ class ScrollBar extends AbstractComponent {
14995
14988
  return [currentPos, currentScrollValue];
14996
14989
  };
14997
14990
  this._onSliderPointerMove = (e) => {
14991
+ e.preventDefault();
14998
14992
  const { stopSliderMovePropagation = true } = this.attribute;
14999
14993
  if (stopSliderMovePropagation) {
15000
14994
  e.stopPropagation();
@@ -15008,7 +15002,6 @@ class ScrollBar extends AbstractComponent {
15008
15002
  ? this._onSliderPointerMove
15009
15003
  : delayMap$2[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime);
15010
15004
  this._onSliderPointerUp = (e) => {
15011
- e.preventDefault();
15012
15005
  const { range: preRange, limitRange = [0, 1] } = this.attribute;
15013
15006
  const preScrollRange = this.getScrollRange();
15014
15007
  const [currentPos, currentScrollValue] = this._computeScrollValue(e);
@@ -15017,15 +15010,7 @@ class ScrollBar extends AbstractComponent {
15017
15010
  pre: preRange,
15018
15011
  value: clampRange(range, limitRange[0], limitRange[1])
15019
15012
  });
15020
- if (vglobal.env === 'browser') {
15021
- vglobal.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
15022
- vglobal.removeEventListener('pointerup', this._onSliderPointerUp);
15023
- }
15024
- else {
15025
- this.stage.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
15026
- this.stage.removeEventListener('pointerup', this._onSliderPointerUp);
15027
- this.stage.removeEventListener('pointerupoutside', this._onSliderPointerUp);
15028
- }
15013
+ this._clearDragEvents();
15029
15014
  };
15030
15015
  }
15031
15016
  setScrollRange(range, render = true) {
@@ -15158,6 +15143,14 @@ class ScrollBar extends AbstractComponent {
15158
15143
  ? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
15159
15144
  : clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
15160
15145
  }
15146
+ _clearDragEvents() {
15147
+ const triggers = getEndTriggersOfDrag();
15148
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
15149
+ obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: false });
15150
+ triggers.forEach((trigger) => {
15151
+ obj.removeEventListener(trigger, this._onSliderPointerUp);
15152
+ });
15153
+ }
15161
15154
  _reset() {
15162
15155
  this._sliderRenderBounds = null;
15163
15156
  this._sliderLimitRange = null;
@@ -16239,7 +16232,7 @@ class PopTip extends AbstractComponent {
16239
16232
  }
16240
16233
  render() {
16241
16234
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
16242
- 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;
16235
+ 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;
16243
16236
  let { title = '', content = '' } = this.attribute;
16244
16237
  title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title;
16245
16238
  content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;
@@ -16321,12 +16314,11 @@ class PopTip extends AbstractComponent {
16321
16314
  poptipHeight += contentShape.AABBBounds.height();
16322
16315
  }
16323
16316
  }
16324
- const layout = position === 'auto' || isArray(position);
16325
- const positionList = isArray(position) ? position : this.positionList;
16317
+ const layout = position === 'auto';
16326
16318
  let maxBBoxI;
16327
16319
  let maxBBoxSize = -Infinity;
16328
- for (let i = 0; i < positionList.length + 1; i++) {
16329
- const p = layout ? positionList[i === positionList.length ? maxBBoxI : i] : position;
16320
+ for (let i = 0; i < this.positionList.length + 1; i++) {
16321
+ const p = layout ? this.positionList[i === this.positionList.length ? maxBBoxI : i] : position;
16330
16322
  let symbolType = 'arrow2Left';
16331
16323
  let offsetX = (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4;
16332
16324
  let offsetY = 0;
@@ -16335,21 +16327,16 @@ class PopTip extends AbstractComponent {
16335
16327
  }
16336
16328
  else if (triangleMode === 'concise') {
16337
16329
  symbolType = conciseSymbolMap[p];
16338
- offsetX = ['tl', 'bl', 'rt', 'rb'].includes(p)
16330
+ offsetX = ['tl', 'bl', 'rt', 'rb'].includes(position)
16339
16331
  ? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2
16340
16332
  : -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2;
16341
- offsetY = ['tl', 'tr', 'lb', 'rb'].includes(p)
16333
+ offsetY = ['tl', 'tr', 'lb', 'rb'].includes(position)
16342
16334
  ? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2
16343
16335
  : (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;
16344
16336
  }
16345
16337
  const { angle, offset } = this.getAngleAndOffset(p, popTipWidth, poptipHeight, isArray(spaceSize) ? spaceSize : [spaceSize, spaceSize - lineWidth], symbolType);
16346
- let anchorPoint = { x: 0, y: 0 };
16347
- if (poptipAnchor === 'bounds' && positionBounds) {
16348
- anchorPoint = this.calculateAnchorPoint(p, positionBounds);
16349
- }
16350
- let bgSymbol;
16351
16338
  if (isBoolean(bgVisible)) {
16352
- 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');
16339
+ 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');
16353
16340
  if (!isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
16354
16341
  bgSymbol.states = state.panel;
16355
16342
  }
@@ -16365,8 +16352,8 @@ class PopTip extends AbstractComponent {
16365
16352
  }
16366
16353
  }
16367
16354
  group.setAttributes({
16368
- x: -offset[0] + dx + anchorPoint.x,
16369
- y: -offset[1] + dy + anchorPoint.y,
16355
+ x: -offset[0] + dx,
16356
+ y: -offset[1] + dy,
16370
16357
  anchor: [offsetX, offsetY]
16371
16358
  });
16372
16359
  if (logoSymbol) {
@@ -16388,97 +16375,27 @@ class PopTip extends AbstractComponent {
16388
16375
  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');
16389
16376
  }
16390
16377
  }
16391
- if (range) {
16378
+ if (layout && range) {
16392
16379
  _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);
16393
16380
  const b = _tBounds;
16394
16381
  const stageBounds = new Bounds().setValue(0, 0, range[0], range[1]);
16395
- if (layout) {
16396
- if (rectInsideAnotherRect(b, stageBounds, false)) {
16397
- break;
16398
- }
16399
- else {
16400
- const bbox = getRectIntersect(b, stageBounds, false);
16401
- const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
16402
- if (size > maxBBoxSize) {
16403
- maxBBoxSize = size;
16404
- maxBBoxI = i;
16405
- }
16406
- }
16382
+ if (rectInsideAnotherRect(b, stageBounds, false)) {
16383
+ break;
16407
16384
  }
16408
- if (['top', 'bottom', 'left', 'right'].includes(p)) {
16409
- const isVerticalPosition = p === 'top' || p === 'bottom';
16410
- const isHorizontalPosition = p === 'left' || p === 'right';
16411
- let mainDirectionOverlap = false;
16412
- if (isVerticalPosition) {
16413
- mainDirectionOverlap = (p === 'top' && b.y1 < 0) || (p === 'bottom' && b.y2 > stageBounds.y2);
16414
- }
16415
- else if (isHorizontalPosition) {
16416
- mainDirectionOverlap = (p === 'left' && b.x1 < 0) || (p === 'right' && b.x2 > stageBounds.x2);
16417
- }
16418
- if (!mainDirectionOverlap) {
16419
- let secondaryOffset = 0;
16420
- const szNumber = (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;
16421
- if (isVerticalPosition) {
16422
- if (b.x1 < 0) {
16423
- secondaryOffset = -b.x1;
16424
- }
16425
- else if (b.x2 > stageBounds.x2) {
16426
- secondaryOffset = stageBounds.x2 - b.x2;
16427
- }
16428
- group.setAttribute('x', group.attribute.x + secondaryOffset);
16429
- bgSymbol.setAttribute('dx', min(max(bgSymbol.attribute.dx - secondaryOffset, szNumber), b.width() - szNumber));
16430
- }
16431
- else if (isHorizontalPosition) {
16432
- if (b.y1 < 0) {
16433
- secondaryOffset = -b.y1;
16434
- }
16435
- else if (b.y2 > stageBounds.y2) {
16436
- secondaryOffset = stageBounds.y2 - b.y2;
16437
- }
16438
- group.setAttribute('y', group.attribute.y + secondaryOffset);
16439
- bgSymbol.setAttribute('dy', min(max(bgSymbol.attribute.dy - secondaryOffset, szNumber), b.height() - szNumber));
16440
- }
16441
- break;
16385
+ else {
16386
+ const bbox = getRectIntersect(b, stageBounds, false);
16387
+ const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
16388
+ if (size > maxBBoxSize) {
16389
+ maxBBoxSize = size;
16390
+ maxBBoxI = i;
16442
16391
  }
16443
16392
  }
16444
- if (!layout) {
16445
- break;
16446
- }
16447
16393
  }
16448
16394
  else {
16449
16395
  break;
16450
16396
  }
16451
16397
  }
16452
16398
  }
16453
- calculateAnchorPoint(position, positionBounds) {
16454
- if (!positionBounds) {
16455
- return { x: 0, y: 0 };
16456
- }
16457
- const { x, y } = this.attribute;
16458
- const { x1, y1, x2, y2 } = positionBounds;
16459
- const width = x2 - x1;
16460
- const height = y2 - y1;
16461
- switch (position) {
16462
- case 'top':
16463
- case 'tl':
16464
- case 'tr':
16465
- return { x: x1 + width / 2 - x, y: y1 - y };
16466
- case 'bottom':
16467
- case 'bl':
16468
- case 'br':
16469
- return { x: x1 + width / 2 - x, y: y2 - y };
16470
- case 'left':
16471
- case 'lt':
16472
- case 'lb':
16473
- return { x: x1 - x, y: y1 + height / 2 - y };
16474
- case 'right':
16475
- case 'rt':
16476
- case 'rb':
16477
- return { x: x2 - x, y: y1 + height / 2 - y };
16478
- default:
16479
- return { x: 0, y: 0 };
16480
- }
16481
- }
16482
16399
  getAngleAndOffset(position, width, height, size, symbolType) {
16483
16400
  const sizeH = symbolType === 'arrow2Left' ? size[1] / 2 : size[1];
16484
16401
  switch (position) {
@@ -16610,7 +16527,7 @@ let PopTipRenderContribution = class PopTipRenderContribution {
16610
16527
  poptip.content = (_a = poptip.content) !== null && _a !== void 0 ? _a : graphic.attribute.text;
16611
16528
  }
16612
16529
  const matrix = graphic.globalTransMatrix;
16613
- 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 }));
16530
+ this.poptipComponent.setAttributes(Object.assign(Object.assign({ visibleAll: true, pickable: false, childrenPickable: false }, poptip), { x: matrix.e, y: matrix.f }));
16614
16531
  drawContext.stage.tryInitInteractiveLayer();
16615
16532
  const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');
16616
16533
  if (interactiveLayer) {
@@ -23098,8 +23015,13 @@ class DataZoom extends AbstractComponent {
23098
23015
  end: 1
23099
23016
  };
23100
23017
  this._statePointToData = state => state;
23018
+ this._handleTouchMove = (e) => {
23019
+ if (this._activeState) {
23020
+ e.preventDefault();
23021
+ }
23022
+ };
23101
23023
  this._onHandlerPointerDown = (e, tag) => {
23102
- e.stopPropagation();
23024
+ this._clearDragEvents();
23103
23025
  if (tag === 'start') {
23104
23026
  this._activeTag = DataZoomActiveTag.startHandler;
23105
23027
  this._activeItem = this._startHandlerMask;
@@ -23123,14 +23045,15 @@ class DataZoom extends AbstractComponent {
23123
23045
  this._activeState = true;
23124
23046
  this._activeCache.startPos = this.eventPosToStagePos(e);
23125
23047
  this._activeCache.lastPos = this.eventPosToStagePos(e);
23126
- if (vglobal.env === 'browser') {
23127
- vglobal.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23128
- vglobal.addEventListener('pointerup', this._onHandlerPointerUp);
23129
- }
23130
- this.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23048
+ const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
23049
+ const triggers = getEndTriggersOfDrag();
23050
+ evtTarget.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
23051
+ triggers.forEach((trigger) => {
23052
+ evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
23053
+ });
23131
23054
  };
23132
23055
  this._pointerMove = (e) => {
23133
- e.stopPropagation();
23056
+ e.preventDefault();
23134
23057
  const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
23135
23058
  const pos = this.eventPosToStagePos(e);
23136
23059
  const { attPos, max } = this._layoutCache;
@@ -23160,12 +23083,12 @@ class DataZoom extends AbstractComponent {
23160
23083
  end = end + dis;
23161
23084
  }
23162
23085
  }
23163
- this._activeCache.lastPos = pos;
23164
23086
  brushSelect && this.renderDragMask();
23165
23087
  }
23166
23088
  start = Math.min(Math.max(start, 0), 1);
23167
23089
  end = Math.min(Math.max(end, 0), 1);
23168
23090
  if (startAttr !== start || endAttr !== end) {
23091
+ this._activeCache.lastPos = pos;
23169
23092
  this.setStateAttr(start, end, true);
23170
23093
  if (realTime) {
23171
23094
  this._dispatchEvent('change', {
@@ -23180,7 +23103,6 @@ class DataZoom extends AbstractComponent {
23180
23103
  ? this._pointerMove
23181
23104
  : delayMap$1[this.attribute.delayType](this._pointerMove, this.attribute.delayTime);
23182
23105
  this._onHandlerPointerUp = (e) => {
23183
- e.preventDefault();
23184
23106
  const { start, end, brushSelect, realTime = true } = this.attribute;
23185
23107
  if (this._activeState) {
23186
23108
  if (this._activeTag === DataZoomActiveTag.background) {
@@ -23195,12 +23117,7 @@ class DataZoom extends AbstractComponent {
23195
23117
  end: this.state.end,
23196
23118
  tag: this._activeTag
23197
23119
  });
23198
- if (vglobal.env === 'browser') {
23199
- vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23200
- vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
23201
- }
23202
- this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23203
- this.removeEventListener('pointerup', this._onHandlerPointerUp);
23120
+ this._clearDragEvents();
23204
23121
  };
23205
23122
  const { position, showDetail } = attributes;
23206
23123
  this._activeCache.startPos = position;
@@ -23248,12 +23165,11 @@ class DataZoom extends AbstractComponent {
23248
23165
  if (this._selectedPreviewGroup) {
23249
23166
  this._selectedPreviewGroup.addEventListener('pointerdown', (e) => this._onHandlerPointerDown(e, selectedTag));
23250
23167
  }
23251
- this.addEventListener('pointerup', this._onHandlerPointerUp);
23252
- this.addEventListener('pointerupoutside', this._onHandlerPointerUp);
23253
23168
  if (showDetail === 'auto') {
23254
23169
  this.addEventListener('pointerenter', this._onHandlerPointerEnter);
23255
23170
  this.addEventListener('pointerleave', this._onHandlerPointerLeave);
23256
23171
  }
23172
+ vglobal.addEventListener('touchmove', this._handleTouchMove, { passive: false });
23257
23173
  }
23258
23174
  dragMaskSize() {
23259
23175
  const { position } = this.attribute;
@@ -23281,13 +23197,19 @@ class DataZoom extends AbstractComponent {
23281
23197
  var _a, _b;
23282
23198
  return (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
23283
23199
  }
23200
+ _clearDragEvents() {
23201
+ const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
23202
+ const triggers = getEndTriggersOfDrag();
23203
+ evtTarget.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
23204
+ triggers.forEach((trigger) => {
23205
+ evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
23206
+ });
23207
+ }
23284
23208
  _onHandlerPointerEnter(e) {
23285
- e.stopPropagation();
23286
23209
  this._showText = true;
23287
23210
  this.renderText();
23288
23211
  }
23289
23212
  _onHandlerPointerLeave(e) {
23290
- e.stopPropagation();
23291
23213
  this._showText = false;
23292
23214
  this.renderText();
23293
23215
  }
@@ -27304,28 +27226,21 @@ class Slider extends AbstractComponent {
27304
27226
  this._dispatchTooltipEvent('sliderTooltipHide');
27305
27227
  };
27306
27228
  this._onHandlerPointerdown = (e) => {
27307
- e.stopPropagation();
27229
+ this._clearAllDragEvents();
27308
27230
  this._isChanging = true;
27309
27231
  const { x, y } = this.stage.eventPointTransform(e);
27310
27232
  this._currentHandler = e.target;
27311
27233
  this._prePos = this._isHorizontal ? x : y;
27312
- if (vglobal.env === 'browser') {
27313
- vglobal.addEventListener('pointermove', this._onHandlerPointerMove, {
27314
- capture: true
27315
- });
27316
- vglobal.addEventListener('pointerup', this._onHandlerPointerUp);
27317
- }
27318
- else {
27319
- this.stage.addEventListener('pointermove', this._onHandlerPointerMove, {
27320
- capture: true
27321
- });
27322
- this.stage.addEventListener('pointerup', this._onHandlerPointerUp);
27323
- this.stage.addEventListener('pointerupoutside', this._onHandlerPointerUp);
27324
- }
27234
+ const triggers = getEndTriggersOfDrag();
27235
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
27236
+ obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
27237
+ triggers.forEach((trigger) => {
27238
+ obj.addEventListener(trigger, this._onHandlerPointerUp);
27239
+ });
27325
27240
  };
27326
27241
  this._onHandlerPointerMove = (e) => {
27327
27242
  var _a, _b;
27328
- e.stopPropagation();
27243
+ e.preventDefault();
27329
27244
  this._isChanging = true;
27330
27245
  const { railWidth, railHeight, min, max } = this.attribute;
27331
27246
  if (max === min) {
@@ -27361,44 +27276,29 @@ class Slider extends AbstractComponent {
27361
27276
  this._dispatchChangeEvent();
27362
27277
  };
27363
27278
  this._onHandlerPointerUp = (e) => {
27364
- e.preventDefault();
27365
27279
  this._isChanging = false;
27366
27280
  this._currentHandler = null;
27367
- if (vglobal.env === 'browser') {
27368
- vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, {
27369
- capture: true
27370
- });
27371
- vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
27372
- }
27373
- else {
27374
- this.stage.removeEventListener('pointermove', this._onHandlerPointerMove, {
27375
- capture: true
27376
- });
27377
- this.stage.removeEventListener('pointerup', this._onHandlerPointerUp);
27378
- this.stage.removeEventListener('pointerupoutside', this._onHandlerPointerUp);
27281
+ this._clearAllDragEvents();
27282
+ };
27283
+ this._handleTouchMove = (e) => {
27284
+ if (this._isChanging) {
27285
+ e.preventDefault();
27379
27286
  }
27380
27287
  };
27381
27288
  this._onTrackPointerdown = (e) => {
27382
- e.stopPropagation();
27289
+ this._clearAllDragEvents();
27383
27290
  this._isChanging = true;
27384
27291
  const { x, y } = this.stage.eventPointTransform(e);
27385
27292
  this._prePos = this._isHorizontal ? x : y;
27386
- if (vglobal.env === 'browser') {
27387
- vglobal.addEventListener('pointermove', this._onTrackPointerMove, {
27388
- capture: true
27389
- });
27390
- vglobal.addEventListener('pointerup', this._onTrackPointerUp);
27391
- }
27392
- else {
27393
- this.stage.addEventListener('pointermove', this._onTrackPointerMove, {
27394
- capture: true
27395
- });
27396
- this.stage.addEventListener('pointerup', this._onTrackPointerUp);
27397
- this.stage.addEventListener('pointerupoutside', this._onTrackPointerUp);
27398
- }
27293
+ const triggers = getEndTriggersOfDrag();
27294
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
27295
+ obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
27296
+ triggers.forEach((trigger) => {
27297
+ obj.addEventListener(trigger, this._onTrackPointerUp);
27298
+ });
27399
27299
  };
27400
27300
  this._onTrackPointerMove = (e) => {
27401
- e.stopPropagation();
27301
+ e.preventDefault();
27402
27302
  this._isChanging = true;
27403
27303
  const { railWidth, railHeight, min, max, inverse } = this.attribute;
27404
27304
  if (max === min) {
@@ -27450,24 +27350,11 @@ class Slider extends AbstractComponent {
27450
27350
  this._dispatchChangeEvent();
27451
27351
  };
27452
27352
  this._onTrackPointerUp = (e) => {
27453
- e.preventDefault();
27454
27353
  this._isChanging = false;
27455
- if (vglobal.env === 'browser') {
27456
- vglobal.removeEventListener('pointermove', this._onTrackPointerMove, {
27457
- capture: true
27458
- });
27459
- vglobal.removeEventListener('pointerup', this._onTrackPointerUp);
27460
- }
27461
- else {
27462
- this.stage.removeEventListener('pointermove', this._onTrackPointerMove, {
27463
- capture: true
27464
- });
27465
- this.stage.removeEventListener('pointerup', this._onTrackPointerUp);
27466
- this.stage.removeEventListener('pointerupoutside', this._onTrackPointerUp);
27467
- }
27354
+ this._clearAllDragEvents();
27468
27355
  };
27469
27356
  this._onRailPointerDown = (e) => {
27470
- e.stopPropagation();
27357
+ this._clearAllDragEvents();
27471
27358
  this._isChanging = true;
27472
27359
  const { railWidth, railHeight, min, max } = this.attribute;
27473
27360
  if (max === min) {
@@ -27845,6 +27732,7 @@ class Slider extends AbstractComponent {
27845
27732
  this._track.addEventListener('pointerdown', this._onTrackPointerdown);
27846
27733
  }
27847
27734
  this._railContainer.addEventListener('pointerdown', this._onRailPointerDown);
27735
+ vglobal.addEventListener('touchmove', this._handleTouchMove, { passive: false });
27848
27736
  }
27849
27737
  }
27850
27738
  _bindTooltipEvents() {
@@ -27855,6 +27743,18 @@ class Slider extends AbstractComponent {
27855
27743
  this._mainContainer.addEventListener('pointermove', this._onTooltipUpdate);
27856
27744
  this._mainContainer.addEventListener('pointerleave', this._onTooltipHide);
27857
27745
  }
27746
+ _clearAllDragEvents() {
27747
+ const triggers = getEndTriggersOfDrag();
27748
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
27749
+ obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
27750
+ triggers.forEach((trigger) => {
27751
+ obj.removeEventListener(trigger, this._onHandlerPointerUp);
27752
+ });
27753
+ obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
27754
+ triggers.forEach((trigger) => {
27755
+ obj.removeEventListener(trigger, this._onTrackPointerUp);
27756
+ });
27757
+ }
27858
27758
  _updateTrack() {
27859
27759
  const { inverse, railWidth, railHeight } = this.attribute;
27860
27760
  const startHandler = this._startHandler;
@@ -31347,10 +31247,10 @@ class Switch extends AbstractComponent {
31347
31247
  });
31348
31248
  this._circle.setAttributes({
31349
31249
  y: circleY,
31350
- x: !this.attribute.checked ? circleX : maxWidth - circleX
31250
+ x: this.attribute.checked ? circleX : maxWidth - circleX
31351
31251
  });
31352
31252
  this._text.setAttributes({
31353
- x: !this.attribute.checked ? textX : maxWidth - textX - textWidth,
31253
+ x: this.attribute.checked ? textX : maxWidth - textX - textWidth,
31354
31254
  y: textY
31355
31255
  });
31356
31256
  }
@@ -31588,6 +31488,6 @@ StoryLabelItem.defaultAttributes = {
31588
31488
  theme: 'default'
31589
31489
  };
31590
31490
 
31591
- const version = "0.22.7-alpha.5";
31491
+ const version = "0.22.7-alpha.6";
31592
31492
 
31593
31493
  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 };