@visactor/vchart 1.13.9-alpha.0 → 1.13.9-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.es.js CHANGED
@@ -31426,7 +31426,7 @@ const SCROLLBAR_EVENT$1 = "scrollDrag";
31426
31426
  const SCROLLBAR_END_EVENT$1 = "scrollUp";
31427
31427
 
31428
31428
  function getEndTriggersOfDrag() {
31429
- return "browser" === vglobal.env ? ["pointerup", "pointerleave"] : ["pointerup", "pointerleave", "pointerupoutside"];
31429
+ return "browser" === vglobal.env ? ["pointerup", "pointerleave", "pointercancel"] : ["pointerup", "pointerleave", "pointerupoutside"];
31430
31430
  }
31431
31431
 
31432
31432
  const delayMap$3 = {
@@ -31461,6 +31461,7 @@ let ScrollBar$1 = class ScrollBar extends AbstractComponent {
31461
31461
  }
31462
31462
  this.setScrollRange([currentScrollValue - (range[1] - range[0]) / 2, currentScrollValue + (range[1] - range[0]) / 2], !1), this.stage && !this.stage.autoRender && this.stage.renderNextFrame();
31463
31463
  }, this._onSliderPointerDown = e => {
31464
+ this._clearDragEvents();
31464
31465
  const {
31465
31466
  stopSliderDownPropagation = !0
31466
31467
  } = this.attribute;
@@ -31479,7 +31480,8 @@ let ScrollBar$1 = class ScrollBar extends AbstractComponent {
31479
31480
  const triggers = getEndTriggersOfDrag(),
31480
31481
  obj = "browser" === vglobal.env ? vglobal : this.stage;
31481
31482
  obj.addEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
31482
- capture: !0
31483
+ capture: !0,
31484
+ passive: !0
31483
31485
  }), triggers.forEach(trigger => {
31484
31486
  obj.addEventListener(trigger, this._onSliderPointerUp);
31485
31487
  });
@@ -31500,6 +31502,7 @@ let ScrollBar$1 = class ScrollBar extends AbstractComponent {
31500
31502
  } = this.getSliderRenderBounds();
31501
31503
  return "vertical" === direction ? (currentPos = y, delta = currentPos - this._prePos, currentScrollValue = delta / height) : (currentPos = x, delta = currentPos - this._prePos, currentScrollValue = delta / width), [currentPos, currentScrollValue];
31502
31504
  }, this._onSliderPointerMove = e => {
31505
+ e.preventDefault();
31503
31506
  const {
31504
31507
  stopSliderMovePropagation = !0
31505
31508
  } = this.attribute;
@@ -31508,7 +31511,6 @@ let ScrollBar$1 = class ScrollBar extends AbstractComponent {
31508
31511
  [currentPos, currentScrollValue] = this._computeScrollValue(e);
31509
31512
  this.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], !0), this._prePos = currentPos;
31510
31513
  }, this._onSliderPointerMoveWithDelay = 0 === this.attribute.delayTime ? this._onSliderPointerMove : delayMap$3[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime), this._onSliderPointerUp = e => {
31511
- e.preventDefault();
31512
31514
  const {
31513
31515
  range: preRange,
31514
31516
  limitRange = [0, 1]
@@ -31519,14 +31521,7 @@ let ScrollBar$1 = class ScrollBar extends AbstractComponent {
31519
31521
  this._dispatchEvent(SCROLLBAR_END_EVENT$1, {
31520
31522
  pre: preRange,
31521
31523
  value: clampRange$1(range, limitRange[0], limitRange[1])
31522
- });
31523
- const triggers = getEndTriggersOfDrag(),
31524
- obj = "browser" === vglobal.env ? vglobal : this.stage;
31525
- obj.removeEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
31526
- capture: !0
31527
- }), triggers.forEach(trigger => {
31528
- obj.removeEventListener(trigger, this._onSliderPointerUp);
31529
- });
31524
+ }), this._clearDragEvents();
31530
31525
  };
31531
31526
  }
31532
31527
  setScrollRange(range) {
@@ -31675,6 +31670,16 @@ let ScrollBar$1 = class ScrollBar extends AbstractComponent {
31675
31670
  sliderSize = this._sliderSize;
31676
31671
  return "horizontal" === direction ? clampRange$1([x1 + min * width, x1 + max * width], x1, width - sliderSize) : clampRange$1([y1 + min * height, y1 + max * height], y1, height - sliderSize);
31677
31672
  }
31673
+ _clearDragEvents() {
31674
+ const triggers = getEndTriggersOfDrag(),
31675
+ obj = "browser" === vglobal.env ? vglobal : this.stage;
31676
+ obj.removeEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
31677
+ capture: !0,
31678
+ passive: !1
31679
+ }), triggers.forEach(trigger => {
31680
+ obj.removeEventListener(trigger, this._onSliderPointerUp);
31681
+ });
31682
+ }
31678
31683
  _reset() {
31679
31684
  this._sliderRenderBounds = null, this._sliderLimitRange = null;
31680
31685
  }
@@ -39023,14 +39028,20 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
39023
39028
  }, this.state = {
39024
39029
  start: 0,
39025
39030
  end: 1
39026
- }, this._statePointToData = state => state, this._onHandlerPointerDown = (e, tag) => {
39027
- e.stopPropagation(), "start" === tag ? (this._activeTag = DataZoomActiveTag.startHandler, this._activeItem = this._startHandlerMask) : "end" === tag ? (this._activeTag = DataZoomActiveTag.endHandler, this._activeItem = this._endHandlerMask) : "middleRect" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerRect) : "middleSymbol" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerSymbol) : "background" === tag && (this._activeTag = DataZoomActiveTag.background, this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this.eventPosToStagePos(e), this._activeCache.lastPos = this.eventPosToStagePos(e), "browser" === vglobal.env && (vglobal.addEventListener("pointermove", this._onHandlerPointerMove, {
39028
- capture: !0
39029
- }), vglobal.addEventListener("pointerup", this._onHandlerPointerUp)), this.addEventListener("pointermove", this._onHandlerPointerMove, {
39030
- capture: !0
39031
+ }, this._statePointToData = state => state, this._handleTouchMove = e => {
39032
+ this._activeState && e.preventDefault();
39033
+ }, this._onHandlerPointerDown = (e, tag) => {
39034
+ this._clearDragEvents(), "start" === tag ? (this._activeTag = DataZoomActiveTag.startHandler, this._activeItem = this._startHandlerMask) : "end" === tag ? (this._activeTag = DataZoomActiveTag.endHandler, this._activeItem = this._endHandlerMask) : "middleRect" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerRect) : "middleSymbol" === tag ? (this._activeTag = DataZoomActiveTag.middleHandler, this._activeItem = this._middleHandlerSymbol) : "background" === tag && (this._activeTag = DataZoomActiveTag.background, this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this.eventPosToStagePos(e), this._activeCache.lastPos = this.eventPosToStagePos(e);
39035
+ const evtTarget = "browser" === vglobal.env ? vglobal : this.stage,
39036
+ triggers = getEndTriggersOfDrag();
39037
+ evtTarget.addEventListener("pointermove", this._onHandlerPointerMove, {
39038
+ capture: !0,
39039
+ passive: !1
39040
+ }), triggers.forEach(trigger => {
39041
+ evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
39031
39042
  });
39032
39043
  }, this._pointerMove = e => {
39033
- e.stopPropagation();
39044
+ e.preventDefault();
39034
39045
  const {
39035
39046
  start: startAttr,
39036
39047
  end: endAttr,
@@ -39047,13 +39058,12 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
39047
39058
  start: start,
39048
39059
  end: end
39049
39060
  } = this.state;
39050
- this._activeState && (this._activeTag === DataZoomActiveTag.middleHandler ? this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis) : this._activeTag === DataZoomActiveTag.startHandler ? start + dis > end ? (start = end, end = start + dis, this._activeTag = DataZoomActiveTag.endHandler) : start += dis : this._activeTag === DataZoomActiveTag.endHandler && (end + dis < start ? (end = start, start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis), this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1), end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0), realTime && this._dispatchEvent("change", {
39061
+ this._activeState && (this._activeTag === DataZoomActiveTag.middleHandler ? this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis) : this._activeTag === DataZoomActiveTag.startHandler ? start + dis > end ? (start = end, end = start + dis, this._activeTag = DataZoomActiveTag.endHandler) : start += dis : this._activeTag === DataZoomActiveTag.endHandler && (end + dis < start ? (end = start, start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis), brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1), end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this._activeCache.lastPos = pos, this.setStateAttr(start, end, !0), realTime && this._dispatchEvent("change", {
39051
39062
  start: start,
39052
39063
  end: end,
39053
39064
  tag: this._activeTag
39054
39065
  }));
39055
39066
  }, this._onHandlerPointerMove = 0 === this.attribute.delayTime ? this._pointerMove : delayMap$2[this.attribute.delayType](this._pointerMove, this.attribute.delayTime), this._onHandlerPointerUp = e => {
39056
- e.preventDefault();
39057
39067
  const {
39058
39068
  start: start,
39059
39069
  end: end,
@@ -39068,11 +39078,7 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
39068
39078
  start: this.state.start,
39069
39079
  end: this.state.end,
39070
39080
  tag: this._activeTag
39071
- }), "browser" === vglobal.env && (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
39072
- capture: !0
39073
- }), vglobal.removeEventListener("pointerup", this._onHandlerPointerUp)), this.removeEventListener("pointermove", this._onHandlerPointerMove, {
39074
- capture: !0
39075
- }), this.removeEventListener("pointerup", this._onHandlerPointerUp);
39081
+ }), this._clearDragEvents();
39076
39082
  };
39077
39083
  const {
39078
39084
  position: position,
@@ -39091,7 +39097,9 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
39091
39097
  } = this.attribute;
39092
39098
  this._startHandlerMask && this._startHandlerMask.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "start")), this._endHandlerMask && this._endHandlerMask.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "end")), this._middleHandlerSymbol && this._middleHandlerSymbol.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "middleSymbol")), this._middleHandlerRect && this._middleHandlerRect.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "middleRect"));
39093
39099
  const selectedTag = brushSelect ? "background" : "middleRect";
39094
- this._selectedBackground && this._selectedBackground.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, selectedTag)), brushSelect && this._background && this._background.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "background")), brushSelect && this._previewGroup && this._previewGroup.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "background")), this._selectedPreviewGroup && this._selectedPreviewGroup.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, selectedTag)), this.addEventListener("pointerup", this._onHandlerPointerUp), this.addEventListener("pointerupoutside", this._onHandlerPointerUp), "auto" === showDetail && (this.addEventListener("pointerenter", this._onHandlerPointerEnter), this.addEventListener("pointerleave", this._onHandlerPointerLeave));
39100
+ this._selectedBackground && this._selectedBackground.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, selectedTag)), brushSelect && this._background && this._background.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "background")), brushSelect && this._previewGroup && this._previewGroup.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, "background")), this._selectedPreviewGroup && this._selectedPreviewGroup.addEventListener("pointerdown", e => this._onHandlerPointerDown(e, selectedTag)), "auto" === showDetail && (this.addEventListener("pointerenter", this._onHandlerPointerEnter), this.addEventListener("pointerleave", this._onHandlerPointerLeave)), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
39101
+ passive: !1
39102
+ });
39095
39103
  }
39096
39104
  dragMaskSize() {
39097
39105
  const {
@@ -39122,11 +39130,21 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
39122
39130
  y: 0
39123
39131
  };
39124
39132
  }
39133
+ _clearDragEvents() {
39134
+ const evtTarget = "browser" === vglobal.env ? vglobal : this.stage,
39135
+ triggers = getEndTriggersOfDrag();
39136
+ evtTarget.removeEventListener("pointermove", this._onHandlerPointerMove, {
39137
+ capture: !0,
39138
+ passive: !1
39139
+ }), triggers.forEach(trigger => {
39140
+ evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
39141
+ });
39142
+ }
39125
39143
  _onHandlerPointerEnter(e) {
39126
- e.stopPropagation(), this._showText = !0, this.renderText();
39144
+ this._showText = !0, this.renderText();
39127
39145
  }
39128
39146
  _onHandlerPointerLeave(e) {
39129
- e.stopPropagation(), this._showText = !1, this.renderText();
39147
+ this._showText = !1, this.renderText();
39130
39148
  }
39131
39149
  backgroundDragZoom(startPos, endPos) {
39132
39150
  const {
@@ -39665,6 +39683,11 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
39665
39683
  setStatePointToData(callback) {
39666
39684
  isFunction$1(callback) && (this._statePointToData = callback);
39667
39685
  }
39686
+ release(all) {
39687
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
39688
+ passive: !1
39689
+ }), this._clearDragEvents();
39690
+ }
39668
39691
  };
39669
39692
  DataZoom$1.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
39670
39693
 
@@ -42606,7 +42629,7 @@ class Slider extends AbstractComponent {
42606
42629
  } = this.attribute;
42607
42630
  tooltip && tooltip.alwaysShow || (this._tooltipState = null, this._tooltipShape && this._tooltipShape.setAttribute("visible", !1), this._tooltipText && this._tooltipText.setAttribute("visible", !1), this._dispatchTooltipEvent("sliderTooltipHide"));
42608
42631
  }, this._onHandlerPointerdown = e => {
42609
- e.stopPropagation(), this._isChanging = !0;
42632
+ this._clearAllDragEvents(), this._isChanging = !0;
42610
42633
  const {
42611
42634
  x: x,
42612
42635
  y: y
@@ -42615,13 +42638,14 @@ class Slider extends AbstractComponent {
42615
42638
  const triggers = getEndTriggersOfDrag(),
42616
42639
  obj = "browser" === vglobal.env ? vglobal : this.stage;
42617
42640
  obj.addEventListener("pointermove", this._onHandlerPointerMove, {
42618
- capture: !0
42641
+ capture: !0,
42642
+ passive: !1
42619
42643
  }), triggers.forEach(trigger => {
42620
42644
  obj.addEventListener(trigger, this._onHandlerPointerUp);
42621
42645
  });
42622
42646
  }, this._onHandlerPointerMove = e => {
42623
42647
  var _a, _b;
42624
- e.stopPropagation(), this._isChanging = !0;
42648
+ e.preventDefault(), this._isChanging = !0;
42625
42649
  const {
42626
42650
  railWidth: railWidth,
42627
42651
  railHeight: railHeight,
@@ -42642,16 +42666,11 @@ class Slider extends AbstractComponent {
42642
42666
  currentValue = this.calculateValueByPos(newPos);
42643
42667
  "text" === this._currentHandler.type ? this._updateHandlerText(this._currentHandler, newPos, currentValue) : this._updateHandler(this._currentHandler, newPos, currentValue), this._updateTrack(), this._prePos = currentPos, this._dispatchChangeEvent();
42644
42668
  }, this._onHandlerPointerUp = e => {
42645
- e.preventDefault(), this._isChanging = !1, this._currentHandler = null;
42646
- const triggers = getEndTriggersOfDrag(),
42647
- obj = "browser" === vglobal.env ? vglobal : this.stage;
42648
- obj.removeEventListener("pointermove", this._onHandlerPointerMove, {
42649
- capture: !0
42650
- }), triggers.forEach(trigger => {
42651
- obj.removeEventListener(trigger, this._onHandlerPointerUp);
42652
- });
42669
+ this._isChanging = !1, this._currentHandler = null, this._clearAllDragEvents();
42670
+ }, this._handleTouchMove = e => {
42671
+ this._isChanging && e.preventDefault();
42653
42672
  }, this._onTrackPointerdown = e => {
42654
- e.stopPropagation(), this._isChanging = !0;
42673
+ this._clearAllDragEvents(), this._isChanging = !0;
42655
42674
  const {
42656
42675
  x: x,
42657
42676
  y: y
@@ -42660,12 +42679,13 @@ class Slider extends AbstractComponent {
42660
42679
  const triggers = getEndTriggersOfDrag(),
42661
42680
  obj = "browser" === vglobal.env ? vglobal : this.stage;
42662
42681
  obj.addEventListener("pointermove", this._onTrackPointerMove, {
42663
- capture: !0
42682
+ capture: !0,
42683
+ passive: !1
42664
42684
  }), triggers.forEach(trigger => {
42665
42685
  obj.addEventListener(trigger, this._onTrackPointerUp);
42666
42686
  });
42667
42687
  }, this._onTrackPointerMove = e => {
42668
- e.stopPropagation(), this._isChanging = !0;
42688
+ e.preventDefault(), this._isChanging = !0;
42669
42689
  const {
42670
42690
  railWidth: railWidth,
42671
42691
  railHeight: railHeight,
@@ -42706,16 +42726,9 @@ class Slider extends AbstractComponent {
42706
42726
  }
42707
42727
  this._prePos = currentPos, this._dispatchChangeEvent();
42708
42728
  }, this._onTrackPointerUp = e => {
42709
- e.preventDefault(), this._isChanging = !1;
42710
- const triggers = getEndTriggersOfDrag(),
42711
- obj = "browser" === vglobal.env ? vglobal : this.stage;
42712
- obj.removeEventListener("pointermove", this._onTrackPointerMove, {
42713
- capture: !0
42714
- }), triggers.forEach(trigger => {
42715
- obj.removeEventListener(trigger, this._onTrackPointerUp);
42716
- });
42729
+ this._isChanging = !1, this._clearAllDragEvents();
42717
42730
  }, this._onRailPointerDown = e => {
42718
- e.stopPropagation(), this._isChanging = !0;
42731
+ this._clearAllDragEvents(), this._isChanging = !0;
42719
42732
  const {
42720
42733
  railWidth: railWidth,
42721
42734
  railHeight: railHeight,
@@ -43036,11 +43049,28 @@ class Slider extends AbstractComponent {
43036
43049
  slidable: slidable,
43037
43050
  range: range
43038
43051
  } = this.attribute;
43039
- slidable && (this._startHandler && this._startHandler.addEventListener("pointerdown", this._onHandlerPointerdown), this._startHandlerText && this._startHandlerText.addEventListener("pointerdown", this._onHandlerPointerdown), this._endHandler && this._endHandler.addEventListener("pointerdown", this._onHandlerPointerdown), this._endHandlerText && this._endHandlerText.addEventListener("pointerdown", this._onHandlerPointerdown), isObject$2(range) && range.draggableTrack && this._track.addEventListener("pointerdown", this._onTrackPointerdown), this._railContainer.addEventListener("pointerdown", this._onRailPointerDown));
43052
+ slidable && (this._startHandler && this._startHandler.addEventListener("pointerdown", this._onHandlerPointerdown), this._startHandlerText && this._startHandlerText.addEventListener("pointerdown", this._onHandlerPointerdown), this._endHandler && this._endHandler.addEventListener("pointerdown", this._onHandlerPointerdown), this._endHandlerText && this._endHandlerText.addEventListener("pointerdown", this._onHandlerPointerdown), isObject$2(range) && range.draggableTrack && this._track.addEventListener("pointerdown", this._onTrackPointerdown), this._railContainer.addEventListener("pointerdown", this._onRailPointerDown), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
43053
+ passive: !1
43054
+ }));
43040
43055
  }
43041
43056
  _bindTooltipEvents() {
43042
43057
  this.attribute.disableTriggerEvent || (this._mainContainer.addEventListener("pointerenter", this._onTooltipShow), this._mainContainer.addEventListener("pointermove", this._onTooltipUpdate), this._mainContainer.addEventListener("pointerleave", this._onTooltipHide));
43043
43058
  }
43059
+ _clearAllDragEvents() {
43060
+ const triggers = getEndTriggersOfDrag(),
43061
+ obj = "browser" === vglobal.env ? vglobal : this.stage;
43062
+ obj.removeEventListener("pointermove", this._onHandlerPointerMove, {
43063
+ capture: !0,
43064
+ passive: !1
43065
+ }), triggers.forEach(trigger => {
43066
+ obj.removeEventListener(trigger, this._onHandlerPointerUp);
43067
+ }), obj.removeEventListener("pointermove", this._onTrackPointerMove, {
43068
+ capture: !0,
43069
+ passive: !1
43070
+ }), triggers.forEach(trigger => {
43071
+ obj.removeEventListener(trigger, this._onTrackPointerUp);
43072
+ });
43073
+ }
43044
43074
  _updateTrack() {
43045
43075
  const {
43046
43076
  inverse: inverse,
@@ -43139,6 +43169,11 @@ class Slider extends AbstractComponent {
43139
43169
  endHandler: endHandler
43140
43170
  };
43141
43171
  }
43172
+ release(all) {
43173
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
43174
+ passive: !1
43175
+ }), this._clearAllDragEvents();
43176
+ }
43142
43177
  }
43143
43178
  Slider.defaultAttributes = {
43144
43179
  slidable: !0,
@@ -44420,7 +44455,7 @@ var IOperateType;
44420
44455
  const DEFAULT_BRUSH_ATTRIBUTES = {
44421
44456
  trigger: "pointerdown",
44422
44457
  updateTrigger: "pointermove",
44423
- endTrigger: "pointerup",
44458
+ endTrigger: ["pointerup", "pointerleave"],
44424
44459
  resetTrigger: "pointerupoutside",
44425
44460
  hasMask: !0,
44426
44461
  brushMode: "single",
@@ -44458,41 +44493,22 @@ let Brush$1 = class Brush extends AbstractComponent {
44458
44493
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, Brush.defaultAttributes, attributes)), this.name = "brush", this._activeDrawState = !1, this._cacheDrawPoints = [], this._isDrawedBeforeEnd = !1, this._isDownBeforeUpOutside = !1, this._activeMoveState = !1, this._operatingMaskMoveDx = 0, this._operatingMaskMoveDy = 0, this._operatingMaskMoveRangeX = [-1 / 0, 1 / 0], this._operatingMaskMoveRangeY = [-1 / 0, 1 / 0], this._brushMaskAABBBoundsDict = {}, this._onBrushStart = e => {
44459
44494
  var _a;
44460
44495
  if (this._outOfInteractiveRange(e)) return void (this._isDownBeforeUpOutside = !0);
44461
- e.stopPropagation();
44496
+ this._isDownBeforeUpOutside = !1, e.stopPropagation();
44462
44497
  const brushMoved = null === (_a = this.attribute.brushMoved) || void 0 === _a || _a;
44463
44498
  this._activeMoveState = brushMoved && this._isPosInBrushMask(e), this._activeDrawState = !this._activeMoveState, this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e);
44464
44499
  }, this._onBrushing = e => {
44465
44500
  this._outOfInteractiveRange(e) || ((this._activeDrawState || this._activeMoveState) && e.stopPropagation(), this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e));
44466
44501
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap$1[this.attribute.delayType](this._onBrushing, this.attribute.delayTime), this._onBrushEnd = e => {
44467
44502
  var _a;
44503
+ if (this._isDownBeforeUpOutside) return this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), void (this._isDownBeforeUpOutside = !1);
44468
44504
  if (!this._activeDrawState && !this._activeMoveState) return;
44469
44505
  e.preventDefault();
44470
44506
  const {
44471
44507
  removeOnClick = !0
44472
44508
  } = this.attribute;
44473
- this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick ? ((null === (_a = this._operatingMask) || void 0 === _a ? void 0 : _a._AABBBounds.empty()) && this._dispatchEvent(IOperateType.brushClear, {
44474
- operateMask: this._operatingMask,
44475
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44476
- event: e
44477
- }), this._container.incrementalClearChild(), this._brushMaskAABBBoundsDict = {}) : (this._activeDrawState && this._dispatchEvent(IOperateType.drawEnd, {
44478
- operateMask: this._operatingMask,
44479
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44480
- event: e
44481
- }), this._activeMoveState && this._dispatchEvent(IOperateType.moveEnd, {
44482
- operateMask: this._operatingMask,
44483
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44484
- event: e
44485
- })), this._activeDrawState = !1, this._activeMoveState = !1, this._isDrawedBeforeEnd = !1, this._operatingMask && this._operatingMask.setAttribute("pickable", !1);
44509
+ this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick ? (null === (_a = this._operatingMask) || void 0 === _a ? void 0 : _a._AABBBounds.empty()) ? this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)) : (delete this._brushMaskAABBBoundsDict[this._operatingMask.name], this._container.setAttributes({}), this._container.removeChild(this._operatingMask), this._isEmptyMask() ? this._dispatchBrushEvent(IOperateType.drawEnd, e) : this._dispatchBrushEvent(IOperateType.brushClear, e)) : (this._activeDrawState && this._dispatchBrushEvent(IOperateType.drawEnd, e), this._activeMoveState && this._dispatchBrushEvent(IOperateType.moveEnd, e)), this._activeDrawState = !1, this._activeMoveState = !1, this._isDrawedBeforeEnd = !1, this._operatingMask && this._operatingMask.setAttribute("pickable", !1);
44486
44510
  }, this._onBrushClear = e => {
44487
- e.preventDefault();
44488
- const {
44489
- removeOnClick = !0
44490
- } = this.attribute;
44491
- this._isDownBeforeUpOutside && removeOnClick && (this._dispatchEvent(IOperateType.brushClear, {
44492
- operateMask: this._operatingMask,
44493
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44494
- event: e
44495
- }), this._container.incrementalClearChild(), this._brushMaskAABBBoundsDict = {}), this._activeDrawState = !1, this._activeMoveState = !1, this._isDrawedBeforeEnd = !1, this._isDownBeforeUpOutside = !1, this._operatingMask && this._operatingMask.setAttribute("pickable", !1);
44511
+ e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1, this._isDrawedBeforeEnd = !1, this._isDownBeforeUpOutside = !1;
44496
44512
  };
44497
44513
  }
44498
44514
  _bindBrushEvents() {
@@ -44503,35 +44519,14 @@ let Brush$1 = class Brush extends AbstractComponent {
44503
44519
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
44504
44520
  resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger
44505
44521
  } = this.attribute;
44506
- array(trigger).forEach(t => vglobal.addEventListener(t, this._onBrushStart)), array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay)), array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd)), array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
44507
- }
44508
- _isPosInBrushMask(e) {
44509
- const pos = this.eventPosToStagePos(e),
44510
- brushMasks = this._container.getChildren();
44511
- for (let i = 0; i < brushMasks.length; i++) {
44512
- const {
44513
- points = [],
44514
- dx = 0,
44515
- dy = 0
44516
- } = brushMasks[i].attribute,
44517
- pointsConsiderOffset = points.map(point => ({
44518
- x: point.x + dx,
44519
- y: point.y + dy
44520
- }));
44521
- if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) return this._operatingMask = brushMasks[i], !0;
44522
- }
44523
- return !1;
44522
+ array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart)), array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay)), array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd)), array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
44524
44523
  }
44525
44524
  _initDraw(e) {
44526
44525
  const {
44527
44526
  brushMode: brushMode
44528
44527
  } = this.attribute,
44529
44528
  pos = this.eventPosToStagePos(e);
44530
- this._cacheDrawPoints = [pos], this._isDrawedBeforeEnd = !1, "single" === brushMode && (this._brushMaskAABBBoundsDict = {}, this._container.incrementalClearChild()), this._addBrushMask(), this._dispatchEvent(IOperateType.drawStart, {
44531
- operateMask: this._operatingMask,
44532
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44533
- event: e
44534
- });
44529
+ this._cacheDrawPoints = [pos], this._isDrawedBeforeEnd = !1, "single" === brushMode && this._clearMask(), this._addBrushMask(), this._dispatchBrushEvent(IOperateType.drawStart, e);
44535
44530
  }
44536
44531
  _initMove(e) {
44537
44532
  var _a, _b;
@@ -44555,11 +44550,7 @@ let Brush$1 = class Brush extends AbstractComponent {
44555
44550
  maxMoveStepX = maxX - x2,
44556
44551
  minMoveStepY = minY - y1,
44557
44552
  maxMoveStepY = maxY - y2;
44558
- this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX], this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY], this._operatingMask.setAttribute("pickable", !0), this._dispatchEvent(IOperateType.moveStart, {
44559
- operateMask: this._operatingMask,
44560
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44561
- event: e
44562
- });
44553
+ this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX], this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY], this._operatingMask.setAttribute("pickable", !0), this._dispatchBrushEvent(IOperateType.moveStart, e);
44563
44554
  }
44564
44555
  _drawing(e) {
44565
44556
  var _a, _b;
@@ -44582,11 +44573,7 @@ let Brush$1 = class Brush extends AbstractComponent {
44582
44573
  y1 = 0,
44583
44574
  y2 = 0
44584
44575
  } = null === (_b = this._operatingMask) || void 0 === _b ? void 0 : _b._AABBBounds;
44585
- this._isDrawedBeforeEnd = !this._operatingMask._AABBBounds.empty() && !!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold), this._isDrawedBeforeEnd && (this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._dispatchEvent(IOperateType.drawing, {
44586
- operateMask: this._operatingMask,
44587
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44588
- event: e
44589
- }));
44576
+ this._isDrawedBeforeEnd = !this._operatingMask._AABBBounds.empty() && !!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold), this._isDrawedBeforeEnd && (this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds), this._dispatchBrushEvent(IOperateType.drawing, e);
44590
44577
  }
44591
44578
  _moving(e) {
44592
44579
  const startPos = this._cacheMovePoint,
@@ -44599,11 +44586,21 @@ let Brush$1 = class Brush extends AbstractComponent {
44599
44586
  this._operatingMask.setAttributes({
44600
44587
  dx: moveX,
44601
44588
  dy: moveY
44602
- }), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._dispatchEvent(IOperateType.moving, {
44603
- operateMask: this._operatingMask,
44604
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44605
- event: e
44606
- });
44589
+ }), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._dispatchBrushEvent(IOperateType.moving, e);
44590
+ }
44591
+ render() {
44592
+ this.releaseBrushEvents(), this._bindBrushEvents();
44593
+ const group = this.createOrUpdateChild("brush-container", {}, "group");
44594
+ this._container = group;
44595
+ }
44596
+ releaseBrushEvents() {
44597
+ const {
44598
+ trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger,
44599
+ updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
44600
+ endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
44601
+ resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger
44602
+ } = this.attribute;
44603
+ array(trigger).forEach(t => this.stage.removeEventListener(t, this._onBrushStart)), array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay)), array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd)), array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear));
44607
44604
  }
44608
44605
  _computeMaskPoints() {
44609
44606
  const {
@@ -44661,6 +44658,23 @@ let Brush$1 = class Brush extends AbstractComponent {
44661
44658
  }));
44662
44659
  brushMask.name = `brush-${Date.now()}`, this._operatingMask = brushMask, this._container.add(brushMask), this._brushMaskAABBBoundsDict[brushMask.name] = brushMask.AABBBounds;
44663
44660
  }
44661
+ _isPosInBrushMask(e) {
44662
+ const pos = this.eventPosToStagePos(e),
44663
+ brushMasks = this._container.getChildren();
44664
+ for (let i = 0; i < brushMasks.length; i++) {
44665
+ const {
44666
+ points = [],
44667
+ dx = 0,
44668
+ dy = 0
44669
+ } = brushMasks[i].attribute,
44670
+ pointsConsiderOffset = points.map(point => ({
44671
+ x: point.x + dx,
44672
+ y: point.y + dy
44673
+ }));
44674
+ if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) return this._operatingMask = brushMasks[i], !0;
44675
+ }
44676
+ return !1;
44677
+ }
44664
44678
  _outOfInteractiveRange(e) {
44665
44679
  const {
44666
44680
  interactiveRange: interactiveRange
@@ -44677,21 +44691,18 @@ let Brush$1 = class Brush extends AbstractComponent {
44677
44691
  eventPosToStagePos(e) {
44678
44692
  return this.stage.eventPointTransform(e);
44679
44693
  }
44680
- render() {
44681
- this._bindBrushEvents();
44682
- const group = this.createOrUpdateChild("brush-container", {}, "group");
44683
- this._container = group;
44694
+ _dispatchBrushEvent(operateType, e) {
44695
+ this._dispatchEvent(operateType, {
44696
+ operateMask: this._operatingMask,
44697
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44698
+ event: e
44699
+ });
44684
44700
  }
44685
- releaseBrushEvents() {
44686
- const {
44687
- delayType = "throttle",
44688
- delayTime = 0,
44689
- trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger,
44690
- updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
44691
- endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
44692
- resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger
44693
- } = this.attribute;
44694
- array(trigger).forEach(t => vglobal.removeEventListener(t, this._onBrushStart)), array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay)), array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd)), array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear));
44701
+ _clearMask() {
44702
+ this._brushMaskAABBBoundsDict = {}, this._container.incrementalClearChild(), this._operatingMask = null;
44703
+ }
44704
+ _isEmptyMask() {
44705
+ return isEmpty(this._brushMaskAABBBoundsDict) || Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty());
44695
44706
  }
44696
44707
  };
44697
44708
  Brush$1.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
@@ -63678,7 +63689,7 @@ const registerVChartCore = () => {
63678
63689
  };
63679
63690
  registerVChartCore();
63680
63691
 
63681
- const version = "1.13.9-alpha.0";
63692
+ const version = "1.13.9-alpha.10";
63682
63693
 
63683
63694
  const addVChartProperty = (data, op) => {
63684
63695
  const context = op.beforeCall();