@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.js CHANGED
@@ -31432,7 +31432,7 @@
31432
31432
  const SCROLLBAR_END_EVENT$1 = "scrollUp";
31433
31433
 
31434
31434
  function getEndTriggersOfDrag() {
31435
- return "browser" === vglobal.env ? ["pointerup", "pointerleave"] : ["pointerup", "pointerleave", "pointerupoutside"];
31435
+ return "browser" === vglobal.env ? ["pointerup", "pointerleave", "pointercancel"] : ["pointerup", "pointerleave", "pointerupoutside"];
31436
31436
  }
31437
31437
 
31438
31438
  const delayMap$3 = {
@@ -31467,6 +31467,7 @@
31467
31467
  }
31468
31468
  this.setScrollRange([currentScrollValue - (range[1] - range[0]) / 2, currentScrollValue + (range[1] - range[0]) / 2], !1), this.stage && !this.stage.autoRender && this.stage.renderNextFrame();
31469
31469
  }, this._onSliderPointerDown = e => {
31470
+ this._clearDragEvents();
31470
31471
  const {
31471
31472
  stopSliderDownPropagation = !0
31472
31473
  } = this.attribute;
@@ -31485,7 +31486,8 @@
31485
31486
  const triggers = getEndTriggersOfDrag(),
31486
31487
  obj = "browser" === vglobal.env ? vglobal : this.stage;
31487
31488
  obj.addEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
31488
- capture: !0
31489
+ capture: !0,
31490
+ passive: !0
31489
31491
  }), triggers.forEach(trigger => {
31490
31492
  obj.addEventListener(trigger, this._onSliderPointerUp);
31491
31493
  });
@@ -31506,6 +31508,7 @@
31506
31508
  } = this.getSliderRenderBounds();
31507
31509
  return "vertical" === direction ? (currentPos = y, delta = currentPos - this._prePos, currentScrollValue = delta / height) : (currentPos = x, delta = currentPos - this._prePos, currentScrollValue = delta / width), [currentPos, currentScrollValue];
31508
31510
  }, this._onSliderPointerMove = e => {
31511
+ e.preventDefault();
31509
31512
  const {
31510
31513
  stopSliderMovePropagation = !0
31511
31514
  } = this.attribute;
@@ -31514,7 +31517,6 @@
31514
31517
  [currentPos, currentScrollValue] = this._computeScrollValue(e);
31515
31518
  this.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], !0), this._prePos = currentPos;
31516
31519
  }, this._onSliderPointerMoveWithDelay = 0 === this.attribute.delayTime ? this._onSliderPointerMove : delayMap$3[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime), this._onSliderPointerUp = e => {
31517
- e.preventDefault();
31518
31520
  const {
31519
31521
  range: preRange,
31520
31522
  limitRange = [0, 1]
@@ -31525,14 +31527,7 @@
31525
31527
  this._dispatchEvent(SCROLLBAR_END_EVENT$1, {
31526
31528
  pre: preRange,
31527
31529
  value: clampRange$1(range, limitRange[0], limitRange[1])
31528
- });
31529
- const triggers = getEndTriggersOfDrag(),
31530
- obj = "browser" === vglobal.env ? vglobal : this.stage;
31531
- obj.removeEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
31532
- capture: !0
31533
- }), triggers.forEach(trigger => {
31534
- obj.removeEventListener(trigger, this._onSliderPointerUp);
31535
- });
31530
+ }), this._clearDragEvents();
31536
31531
  };
31537
31532
  }
31538
31533
  setScrollRange(range) {
@@ -31681,6 +31676,16 @@
31681
31676
  sliderSize = this._sliderSize;
31682
31677
  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);
31683
31678
  }
31679
+ _clearDragEvents() {
31680
+ const triggers = getEndTriggersOfDrag(),
31681
+ obj = "browser" === vglobal.env ? vglobal : this.stage;
31682
+ obj.removeEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
31683
+ capture: !0,
31684
+ passive: !1
31685
+ }), triggers.forEach(trigger => {
31686
+ obj.removeEventListener(trigger, this._onSliderPointerUp);
31687
+ });
31688
+ }
31684
31689
  _reset() {
31685
31690
  this._sliderRenderBounds = null, this._sliderLimitRange = null;
31686
31691
  }
@@ -39029,14 +39034,20 @@
39029
39034
  }, this.state = {
39030
39035
  start: 0,
39031
39036
  end: 1
39032
- }, this._statePointToData = state => state, this._onHandlerPointerDown = (e, tag) => {
39033
- 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, {
39034
- capture: !0
39035
- }), vglobal.addEventListener("pointerup", this._onHandlerPointerUp)), this.addEventListener("pointermove", this._onHandlerPointerMove, {
39036
- capture: !0
39037
+ }, this._statePointToData = state => state, this._handleTouchMove = e => {
39038
+ this._activeState && e.preventDefault();
39039
+ }, this._onHandlerPointerDown = (e, tag) => {
39040
+ 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);
39041
+ const evtTarget = "browser" === vglobal.env ? vglobal : this.stage,
39042
+ triggers = getEndTriggersOfDrag();
39043
+ evtTarget.addEventListener("pointermove", this._onHandlerPointerMove, {
39044
+ capture: !0,
39045
+ passive: !1
39046
+ }), triggers.forEach(trigger => {
39047
+ evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
39037
39048
  });
39038
39049
  }, this._pointerMove = e => {
39039
- e.stopPropagation();
39050
+ e.preventDefault();
39040
39051
  const {
39041
39052
  start: startAttr,
39042
39053
  end: endAttr,
@@ -39053,13 +39064,12 @@
39053
39064
  start: start,
39054
39065
  end: end
39055
39066
  } = this.state;
39056
- 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", {
39067
+ 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", {
39057
39068
  start: start,
39058
39069
  end: end,
39059
39070
  tag: this._activeTag
39060
39071
  }));
39061
39072
  }, this._onHandlerPointerMove = 0 === this.attribute.delayTime ? this._pointerMove : delayMap$2[this.attribute.delayType](this._pointerMove, this.attribute.delayTime), this._onHandlerPointerUp = e => {
39062
- e.preventDefault();
39063
39073
  const {
39064
39074
  start: start,
39065
39075
  end: end,
@@ -39074,11 +39084,7 @@
39074
39084
  start: this.state.start,
39075
39085
  end: this.state.end,
39076
39086
  tag: this._activeTag
39077
- }), "browser" === vglobal.env && (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
39078
- capture: !0
39079
- }), vglobal.removeEventListener("pointerup", this._onHandlerPointerUp)), this.removeEventListener("pointermove", this._onHandlerPointerMove, {
39080
- capture: !0
39081
- }), this.removeEventListener("pointerup", this._onHandlerPointerUp);
39087
+ }), this._clearDragEvents();
39082
39088
  };
39083
39089
  const {
39084
39090
  position: position,
@@ -39097,7 +39103,9 @@
39097
39103
  } = this.attribute;
39098
39104
  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"));
39099
39105
  const selectedTag = brushSelect ? "background" : "middleRect";
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)), this.addEventListener("pointerup", this._onHandlerPointerUp), this.addEventListener("pointerupoutside", this._onHandlerPointerUp), "auto" === showDetail && (this.addEventListener("pointerenter", this._onHandlerPointerEnter), this.addEventListener("pointerleave", this._onHandlerPointerLeave));
39106
+ 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, {
39107
+ passive: !1
39108
+ });
39101
39109
  }
39102
39110
  dragMaskSize() {
39103
39111
  const {
@@ -39128,11 +39136,21 @@
39128
39136
  y: 0
39129
39137
  };
39130
39138
  }
39139
+ _clearDragEvents() {
39140
+ const evtTarget = "browser" === vglobal.env ? vglobal : this.stage,
39141
+ triggers = getEndTriggersOfDrag();
39142
+ evtTarget.removeEventListener("pointermove", this._onHandlerPointerMove, {
39143
+ capture: !0,
39144
+ passive: !1
39145
+ }), triggers.forEach(trigger => {
39146
+ evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
39147
+ });
39148
+ }
39131
39149
  _onHandlerPointerEnter(e) {
39132
- e.stopPropagation(), this._showText = !0, this.renderText();
39150
+ this._showText = !0, this.renderText();
39133
39151
  }
39134
39152
  _onHandlerPointerLeave(e) {
39135
- e.stopPropagation(), this._showText = !1, this.renderText();
39153
+ this._showText = !1, this.renderText();
39136
39154
  }
39137
39155
  backgroundDragZoom(startPos, endPos) {
39138
39156
  const {
@@ -39671,6 +39689,11 @@
39671
39689
  setStatePointToData(callback) {
39672
39690
  isFunction$1(callback) && (this._statePointToData = callback);
39673
39691
  }
39692
+ release(all) {
39693
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
39694
+ passive: !1
39695
+ }), this._clearDragEvents();
39696
+ }
39674
39697
  };
39675
39698
  DataZoom$1.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
39676
39699
 
@@ -42612,7 +42635,7 @@
42612
42635
  } = this.attribute;
42613
42636
  tooltip && tooltip.alwaysShow || (this._tooltipState = null, this._tooltipShape && this._tooltipShape.setAttribute("visible", !1), this._tooltipText && this._tooltipText.setAttribute("visible", !1), this._dispatchTooltipEvent("sliderTooltipHide"));
42614
42637
  }, this._onHandlerPointerdown = e => {
42615
- e.stopPropagation(), this._isChanging = !0;
42638
+ this._clearAllDragEvents(), this._isChanging = !0;
42616
42639
  const {
42617
42640
  x: x,
42618
42641
  y: y
@@ -42621,13 +42644,14 @@
42621
42644
  const triggers = getEndTriggersOfDrag(),
42622
42645
  obj = "browser" === vglobal.env ? vglobal : this.stage;
42623
42646
  obj.addEventListener("pointermove", this._onHandlerPointerMove, {
42624
- capture: !0
42647
+ capture: !0,
42648
+ passive: !1
42625
42649
  }), triggers.forEach(trigger => {
42626
42650
  obj.addEventListener(trigger, this._onHandlerPointerUp);
42627
42651
  });
42628
42652
  }, this._onHandlerPointerMove = e => {
42629
42653
  var _a, _b;
42630
- e.stopPropagation(), this._isChanging = !0;
42654
+ e.preventDefault(), this._isChanging = !0;
42631
42655
  const {
42632
42656
  railWidth: railWidth,
42633
42657
  railHeight: railHeight,
@@ -42648,16 +42672,11 @@
42648
42672
  currentValue = this.calculateValueByPos(newPos);
42649
42673
  "text" === this._currentHandler.type ? this._updateHandlerText(this._currentHandler, newPos, currentValue) : this._updateHandler(this._currentHandler, newPos, currentValue), this._updateTrack(), this._prePos = currentPos, this._dispatchChangeEvent();
42650
42674
  }, this._onHandlerPointerUp = e => {
42651
- e.preventDefault(), this._isChanging = !1, this._currentHandler = null;
42652
- const triggers = getEndTriggersOfDrag(),
42653
- obj = "browser" === vglobal.env ? vglobal : this.stage;
42654
- obj.removeEventListener("pointermove", this._onHandlerPointerMove, {
42655
- capture: !0
42656
- }), triggers.forEach(trigger => {
42657
- obj.removeEventListener(trigger, this._onHandlerPointerUp);
42658
- });
42675
+ this._isChanging = !1, this._currentHandler = null, this._clearAllDragEvents();
42676
+ }, this._handleTouchMove = e => {
42677
+ this._isChanging && e.preventDefault();
42659
42678
  }, this._onTrackPointerdown = e => {
42660
- e.stopPropagation(), this._isChanging = !0;
42679
+ this._clearAllDragEvents(), this._isChanging = !0;
42661
42680
  const {
42662
42681
  x: x,
42663
42682
  y: y
@@ -42666,12 +42685,13 @@
42666
42685
  const triggers = getEndTriggersOfDrag(),
42667
42686
  obj = "browser" === vglobal.env ? vglobal : this.stage;
42668
42687
  obj.addEventListener("pointermove", this._onTrackPointerMove, {
42669
- capture: !0
42688
+ capture: !0,
42689
+ passive: !1
42670
42690
  }), triggers.forEach(trigger => {
42671
42691
  obj.addEventListener(trigger, this._onTrackPointerUp);
42672
42692
  });
42673
42693
  }, this._onTrackPointerMove = e => {
42674
- e.stopPropagation(), this._isChanging = !0;
42694
+ e.preventDefault(), this._isChanging = !0;
42675
42695
  const {
42676
42696
  railWidth: railWidth,
42677
42697
  railHeight: railHeight,
@@ -42712,16 +42732,9 @@
42712
42732
  }
42713
42733
  this._prePos = currentPos, this._dispatchChangeEvent();
42714
42734
  }, this._onTrackPointerUp = e => {
42715
- e.preventDefault(), this._isChanging = !1;
42716
- const triggers = getEndTriggersOfDrag(),
42717
- obj = "browser" === vglobal.env ? vglobal : this.stage;
42718
- obj.removeEventListener("pointermove", this._onTrackPointerMove, {
42719
- capture: !0
42720
- }), triggers.forEach(trigger => {
42721
- obj.removeEventListener(trigger, this._onTrackPointerUp);
42722
- });
42735
+ this._isChanging = !1, this._clearAllDragEvents();
42723
42736
  }, this._onRailPointerDown = e => {
42724
- e.stopPropagation(), this._isChanging = !0;
42737
+ this._clearAllDragEvents(), this._isChanging = !0;
42725
42738
  const {
42726
42739
  railWidth: railWidth,
42727
42740
  railHeight: railHeight,
@@ -43042,11 +43055,28 @@
43042
43055
  slidable: slidable,
43043
43056
  range: range
43044
43057
  } = this.attribute;
43045
- 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));
43058
+ 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, {
43059
+ passive: !1
43060
+ }));
43046
43061
  }
43047
43062
  _bindTooltipEvents() {
43048
43063
  this.attribute.disableTriggerEvent || (this._mainContainer.addEventListener("pointerenter", this._onTooltipShow), this._mainContainer.addEventListener("pointermove", this._onTooltipUpdate), this._mainContainer.addEventListener("pointerleave", this._onTooltipHide));
43049
43064
  }
43065
+ _clearAllDragEvents() {
43066
+ const triggers = getEndTriggersOfDrag(),
43067
+ obj = "browser" === vglobal.env ? vglobal : this.stage;
43068
+ obj.removeEventListener("pointermove", this._onHandlerPointerMove, {
43069
+ capture: !0,
43070
+ passive: !1
43071
+ }), triggers.forEach(trigger => {
43072
+ obj.removeEventListener(trigger, this._onHandlerPointerUp);
43073
+ }), obj.removeEventListener("pointermove", this._onTrackPointerMove, {
43074
+ capture: !0,
43075
+ passive: !1
43076
+ }), triggers.forEach(trigger => {
43077
+ obj.removeEventListener(trigger, this._onTrackPointerUp);
43078
+ });
43079
+ }
43050
43080
  _updateTrack() {
43051
43081
  const {
43052
43082
  inverse: inverse,
@@ -43145,6 +43175,11 @@
43145
43175
  endHandler: endHandler
43146
43176
  };
43147
43177
  }
43178
+ release(all) {
43179
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
43180
+ passive: !1
43181
+ }), this._clearAllDragEvents();
43182
+ }
43148
43183
  }
43149
43184
  Slider.defaultAttributes = {
43150
43185
  slidable: !0,
@@ -44426,7 +44461,7 @@
44426
44461
  const DEFAULT_BRUSH_ATTRIBUTES = {
44427
44462
  trigger: "pointerdown",
44428
44463
  updateTrigger: "pointermove",
44429
- endTrigger: "pointerup",
44464
+ endTrigger: ["pointerup", "pointerleave"],
44430
44465
  resetTrigger: "pointerupoutside",
44431
44466
  hasMask: !0,
44432
44467
  brushMode: "single",
@@ -44464,41 +44499,22 @@
44464
44499
  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 => {
44465
44500
  var _a;
44466
44501
  if (this._outOfInteractiveRange(e)) return void (this._isDownBeforeUpOutside = !0);
44467
- e.stopPropagation();
44502
+ this._isDownBeforeUpOutside = !1, e.stopPropagation();
44468
44503
  const brushMoved = null === (_a = this.attribute.brushMoved) || void 0 === _a || _a;
44469
44504
  this._activeMoveState = brushMoved && this._isPosInBrushMask(e), this._activeDrawState = !this._activeMoveState, this._activeDrawState && this._initDraw(e), this._activeMoveState && this._initMove(e);
44470
44505
  }, this._onBrushing = e => {
44471
44506
  this._outOfInteractiveRange(e) || ((this._activeDrawState || this._activeMoveState) && e.stopPropagation(), this._activeDrawState && this._drawing(e), this._activeMoveState && this._moving(e));
44472
44507
  }, this._onBrushingWithDelay = 0 === this.attribute.delayTime ? this._onBrushing : delayMap$1[this.attribute.delayType](this._onBrushing, this.attribute.delayTime), this._onBrushEnd = e => {
44473
44508
  var _a;
44509
+ if (this._isDownBeforeUpOutside) return this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), void (this._isDownBeforeUpOutside = !1);
44474
44510
  if (!this._activeDrawState && !this._activeMoveState) return;
44475
44511
  e.preventDefault();
44476
44512
  const {
44477
44513
  removeOnClick = !0
44478
44514
  } = this.attribute;
44479
- this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick ? ((null === (_a = this._operatingMask) || void 0 === _a ? void 0 : _a._AABBBounds.empty()) && this._dispatchEvent(IOperateType.brushClear, {
44480
- operateMask: this._operatingMask,
44481
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44482
- event: e
44483
- }), this._container.incrementalClearChild(), this._brushMaskAABBBoundsDict = {}) : (this._activeDrawState && this._dispatchEvent(IOperateType.drawEnd, {
44484
- operateMask: this._operatingMask,
44485
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44486
- event: e
44487
- }), this._activeMoveState && this._dispatchEvent(IOperateType.moveEnd, {
44488
- operateMask: this._operatingMask,
44489
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44490
- event: e
44491
- })), this._activeDrawState = !1, this._activeMoveState = !1, this._isDrawedBeforeEnd = !1, this._operatingMask && this._operatingMask.setAttribute("pickable", !1);
44515
+ 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);
44492
44516
  }, this._onBrushClear = e => {
44493
- e.preventDefault();
44494
- const {
44495
- removeOnClick = !0
44496
- } = this.attribute;
44497
- this._isDownBeforeUpOutside && removeOnClick && (this._dispatchEvent(IOperateType.brushClear, {
44498
- operateMask: this._operatingMask,
44499
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44500
- event: e
44501
- }), this._container.incrementalClearChild(), this._brushMaskAABBBoundsDict = {}), this._activeDrawState = !1, this._activeMoveState = !1, this._isDrawedBeforeEnd = !1, this._isDownBeforeUpOutside = !1, this._operatingMask && this._operatingMask.setAttribute("pickable", !1);
44517
+ e.preventDefault(), this._isEmptyMask() || (this._clearMask(), this._dispatchBrushEvent(IOperateType.brushClear, e)), this._activeDrawState = !1, this._activeMoveState = !1, this._isDrawedBeforeEnd = !1, this._isDownBeforeUpOutside = !1;
44502
44518
  };
44503
44519
  }
44504
44520
  _bindBrushEvents() {
@@ -44509,35 +44525,14 @@
44509
44525
  endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
44510
44526
  resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger
44511
44527
  } = this.attribute;
44512
- 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));
44513
- }
44514
- _isPosInBrushMask(e) {
44515
- const pos = this.eventPosToStagePos(e),
44516
- brushMasks = this._container.getChildren();
44517
- for (let i = 0; i < brushMasks.length; i++) {
44518
- const {
44519
- points = [],
44520
- dx = 0,
44521
- dy = 0
44522
- } = brushMasks[i].attribute,
44523
- pointsConsiderOffset = points.map(point => ({
44524
- x: point.x + dx,
44525
- y: point.y + dy
44526
- }));
44527
- if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) return this._operatingMask = brushMasks[i], !0;
44528
- }
44529
- return !1;
44528
+ 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));
44530
44529
  }
44531
44530
  _initDraw(e) {
44532
44531
  const {
44533
44532
  brushMode: brushMode
44534
44533
  } = this.attribute,
44535
44534
  pos = this.eventPosToStagePos(e);
44536
- this._cacheDrawPoints = [pos], this._isDrawedBeforeEnd = !1, "single" === brushMode && (this._brushMaskAABBBoundsDict = {}, this._container.incrementalClearChild()), this._addBrushMask(), this._dispatchEvent(IOperateType.drawStart, {
44537
- operateMask: this._operatingMask,
44538
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44539
- event: e
44540
- });
44535
+ this._cacheDrawPoints = [pos], this._isDrawedBeforeEnd = !1, "single" === brushMode && this._clearMask(), this._addBrushMask(), this._dispatchBrushEvent(IOperateType.drawStart, e);
44541
44536
  }
44542
44537
  _initMove(e) {
44543
44538
  var _a, _b;
@@ -44561,11 +44556,7 @@
44561
44556
  maxMoveStepX = maxX - x2,
44562
44557
  minMoveStepY = minY - y1,
44563
44558
  maxMoveStepY = maxY - y2;
44564
- this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX], this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY], this._operatingMask.setAttribute("pickable", !0), this._dispatchEvent(IOperateType.moveStart, {
44565
- operateMask: this._operatingMask,
44566
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44567
- event: e
44568
- });
44559
+ this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX], this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY], this._operatingMask.setAttribute("pickable", !0), this._dispatchBrushEvent(IOperateType.moveStart, e);
44569
44560
  }
44570
44561
  _drawing(e) {
44571
44562
  var _a, _b;
@@ -44588,11 +44579,7 @@
44588
44579
  y1 = 0,
44589
44580
  y2 = 0
44590
44581
  } = null === (_b = this._operatingMask) || void 0 === _b ? void 0 : _b._AABBBounds;
44591
- 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, {
44592
- operateMask: this._operatingMask,
44593
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44594
- event: e
44595
- }));
44582
+ 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);
44596
44583
  }
44597
44584
  _moving(e) {
44598
44585
  const startPos = this._cacheMovePoint,
@@ -44605,11 +44592,21 @@
44605
44592
  this._operatingMask.setAttributes({
44606
44593
  dx: moveX,
44607
44594
  dy: moveY
44608
- }), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._dispatchEvent(IOperateType.moving, {
44609
- operateMask: this._operatingMask,
44610
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44611
- event: e
44612
- });
44595
+ }), this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds, this._dispatchBrushEvent(IOperateType.moving, e);
44596
+ }
44597
+ render() {
44598
+ this.releaseBrushEvents(), this._bindBrushEvents();
44599
+ const group = this.createOrUpdateChild("brush-container", {}, "group");
44600
+ this._container = group;
44601
+ }
44602
+ releaseBrushEvents() {
44603
+ const {
44604
+ trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger,
44605
+ updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
44606
+ endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
44607
+ resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger
44608
+ } = this.attribute;
44609
+ 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));
44613
44610
  }
44614
44611
  _computeMaskPoints() {
44615
44612
  const {
@@ -44667,6 +44664,23 @@
44667
44664
  }));
44668
44665
  brushMask.name = `brush-${Date.now()}`, this._operatingMask = brushMask, this._container.add(brushMask), this._brushMaskAABBBoundsDict[brushMask.name] = brushMask.AABBBounds;
44669
44666
  }
44667
+ _isPosInBrushMask(e) {
44668
+ const pos = this.eventPosToStagePos(e),
44669
+ brushMasks = this._container.getChildren();
44670
+ for (let i = 0; i < brushMasks.length; i++) {
44671
+ const {
44672
+ points = [],
44673
+ dx = 0,
44674
+ dy = 0
44675
+ } = brushMasks[i].attribute,
44676
+ pointsConsiderOffset = points.map(point => ({
44677
+ x: point.x + dx,
44678
+ y: point.y + dy
44679
+ }));
44680
+ if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) return this._operatingMask = brushMasks[i], !0;
44681
+ }
44682
+ return !1;
44683
+ }
44670
44684
  _outOfInteractiveRange(e) {
44671
44685
  const {
44672
44686
  interactiveRange: interactiveRange
@@ -44683,21 +44697,18 @@
44683
44697
  eventPosToStagePos(e) {
44684
44698
  return this.stage.eventPointTransform(e);
44685
44699
  }
44686
- render() {
44687
- this._bindBrushEvents();
44688
- const group = this.createOrUpdateChild("brush-container", {}, "group");
44689
- this._container = group;
44700
+ _dispatchBrushEvent(operateType, e) {
44701
+ this._dispatchEvent(operateType, {
44702
+ operateMask: this._operatingMask,
44703
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
44704
+ event: e
44705
+ });
44690
44706
  }
44691
- releaseBrushEvents() {
44692
- const {
44693
- delayType = "throttle",
44694
- delayTime = 0,
44695
- trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger,
44696
- updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger,
44697
- endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger,
44698
- resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger
44699
- } = this.attribute;
44700
- 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));
44707
+ _clearMask() {
44708
+ this._brushMaskAABBBoundsDict = {}, this._container.incrementalClearChild(), this._operatingMask = null;
44709
+ }
44710
+ _isEmptyMask() {
44711
+ return isEmpty(this._brushMaskAABBBoundsDict) || Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty());
44701
44712
  }
44702
44713
  };
44703
44714
  Brush$1.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
@@ -63684,7 +63695,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
63684
63695
  };
63685
63696
  registerVChartCore();
63686
63697
 
63687
- const version = "1.13.9-alpha.0";
63698
+ const version = "1.13.9-alpha.10";
63688
63699
 
63689
63700
  const addVChartProperty = (data, op) => {
63690
63701
  const context = op.beforeCall();