@visactor/vchart 1.13.7 → 1.13.8-alpha.0

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
@@ -63613,7 +63613,7 @@ const registerVChartCore = () => {
63613
63613
  };
63614
63614
  registerVChartCore();
63615
63615
 
63616
- const version = "1.13.7";
63616
+ const version = "1.13.8-alpha.0";
63617
63617
 
63618
63618
  const addVChartProperty = (data, op) => {
63619
63619
  const context = op.beforeCall();
@@ -72661,10 +72661,22 @@ class BarSeries extends CartesianSeries {
72661
72661
  xField: this._fieldX[0],
72662
72662
  direction: this.direction,
72663
72663
  growFrom: () => {
72664
- var _a, _b;
72665
- return this.direction === 'horizontal'
72666
- ? (_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale(0).scale(0)
72667
- : (_b = this._yAxisHelper) === null || _b === void 0 ? void 0 : _b.getScale(0).scale(0);
72664
+ var _a;
72665
+ const scale = this.direction === 'horizontal' ? (_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale(0) : this._yAxisHelper.getScale(0);
72666
+ if (scale) {
72667
+ const domain = scale.domain();
72668
+ const domainMin = minInArray(domain);
72669
+ const domainMax = maxInArray(domain);
72670
+ if (domainMax < 0) {
72671
+ return scale.scale(domainMax);
72672
+ }
72673
+ else if (domainMin > 0) {
72674
+ return scale.scale(domainMin);
72675
+ }
72676
+ else {
72677
+ return scale.scale(0);
72678
+ }
72679
+ }
72668
72680
  }
72669
72681
  };
72670
72682
  const appearPreset = (_a = this._spec.animationAppear) === null || _a === void 0 ? void 0 : _a.preset;
@@ -73999,8 +74011,24 @@ class Zoomable {
73999
74011
  });
74000
74012
  }
74001
74013
  }
74014
+ _clearDragEvent() {
74015
+ const move = this._getZoomTriggerEvent('move');
74016
+ const end = this._getZoomTriggerEvent('end');
74017
+ if (this._handleDragMouseMove) {
74018
+ this._eventObj.off(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, this._handleDragMouseMove);
74019
+ this._handleDragMouseMove = undefined;
74020
+ }
74021
+ if (this._handleDragMouseUp) {
74022
+ end.forEach(endEventType => {
74023
+ this._eventObj.off(endEventType, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, this._handleDragMouseUp);
74024
+ this._eventObj.allow(endEventType);
74025
+ });
74026
+ this._handleDragMouseUp = undefined;
74027
+ }
74028
+ }
74002
74029
  _handleDrag(params, callback, option) {
74003
74030
  var _a, _b, _c;
74031
+ this._clearDragEvent();
74004
74032
  if (this._option.disableTriggerEvent) {
74005
74033
  return;
74006
74034
  }
@@ -74018,7 +74046,7 @@ class Zoomable {
74018
74046
  let moveY = event.canvasY;
74019
74047
  let upX = event.canvasX;
74020
74048
  let upY = event.canvasY;
74021
- const mouseup = delayMap[delayType]((params) => {
74049
+ this._handleDragMouseUp = delayMap[delayType]((params) => {
74022
74050
  this._clickEnable = true;
74023
74051
  const event = params.event;
74024
74052
  const dx = event.canvasX - upX;
@@ -74034,18 +74062,14 @@ class Zoomable {
74034
74062
  model: this
74035
74063
  });
74036
74064
  this._zoomableTrigger.pointerId = null;
74037
- this._eventObj.off(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mousemove);
74038
- end.forEach(endEventType => {
74039
- this._eventObj.off(endEventType, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mouseup);
74040
- this._eventObj.allow(endEventType);
74041
- });
74065
+ this._clearDragEvent();
74042
74066
  }, delayTime);
74043
- const mousemove = delayMap[delayType]((params) => {
74067
+ this._handleDragMouseMove = delayMap[delayType]((params) => {
74044
74068
  if (!this._zoomableTrigger.parserDragEvent(params.event)) {
74045
74069
  return;
74046
74070
  }
74047
74071
  this._clickEnable = false;
74048
- end.forEach(endEventType => this._eventObj.prevent(endEventType, mouseup));
74072
+ end.forEach(endEventType => this._eventObj.prevent(endEventType, this._handleDragMouseUp));
74049
74073
  const event = params.event;
74050
74074
  const dx = event.canvasX - moveX;
74051
74075
  const dy = event.canvasY - moveY;
@@ -74060,9 +74084,9 @@ class Zoomable {
74060
74084
  model: this
74061
74085
  });
74062
74086
  }, delayTime);
74063
- this._eventObj.on(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mousemove);
74087
+ this._eventObj.on(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, this._handleDragMouseMove);
74064
74088
  end.forEach(endEventType => {
74065
- this._eventObj.on(endEventType, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mouseup);
74089
+ this._eventObj.on(endEventType, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, this._handleDragMouseUp);
74066
74090
  });
74067
74091
  }
74068
74092
  }
package/build/index.js CHANGED
@@ -63619,7 +63619,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
63619
63619
  };
63620
63620
  registerVChartCore();
63621
63621
 
63622
- const version = "1.13.7";
63622
+ const version = "1.13.8-alpha.0";
63623
63623
 
63624
63624
  const addVChartProperty = (data, op) => {
63625
63625
  const context = op.beforeCall();
@@ -72667,10 +72667,22 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
72667
72667
  xField: this._fieldX[0],
72668
72668
  direction: this.direction,
72669
72669
  growFrom: () => {
72670
- var _a, _b;
72671
- return this.direction === 'horizontal'
72672
- ? (_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale(0).scale(0)
72673
- : (_b = this._yAxisHelper) === null || _b === void 0 ? void 0 : _b.getScale(0).scale(0);
72670
+ var _a;
72671
+ const scale = this.direction === 'horizontal' ? (_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale(0) : this._yAxisHelper.getScale(0);
72672
+ if (scale) {
72673
+ const domain = scale.domain();
72674
+ const domainMin = minInArray(domain);
72675
+ const domainMax = maxInArray(domain);
72676
+ if (domainMax < 0) {
72677
+ return scale.scale(domainMax);
72678
+ }
72679
+ else if (domainMin > 0) {
72680
+ return scale.scale(domainMin);
72681
+ }
72682
+ else {
72683
+ return scale.scale(0);
72684
+ }
72685
+ }
72674
72686
  }
72675
72687
  };
72676
72688
  const appearPreset = (_a = this._spec.animationAppear) === null || _a === void 0 ? void 0 : _a.preset;
@@ -74005,8 +74017,24 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
74005
74017
  });
74006
74018
  }
74007
74019
  }
74020
+ _clearDragEvent() {
74021
+ const move = this._getZoomTriggerEvent('move');
74022
+ const end = this._getZoomTriggerEvent('end');
74023
+ if (this._handleDragMouseMove) {
74024
+ this._eventObj.off(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, this._handleDragMouseMove);
74025
+ this._handleDragMouseMove = undefined;
74026
+ }
74027
+ if (this._handleDragMouseUp) {
74028
+ end.forEach(endEventType => {
74029
+ this._eventObj.off(endEventType, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, this._handleDragMouseUp);
74030
+ this._eventObj.allow(endEventType);
74031
+ });
74032
+ this._handleDragMouseUp = undefined;
74033
+ }
74034
+ }
74008
74035
  _handleDrag(params, callback, option) {
74009
74036
  var _a, _b, _c;
74037
+ this._clearDragEvent();
74010
74038
  if (this._option.disableTriggerEvent) {
74011
74039
  return;
74012
74040
  }
@@ -74024,7 +74052,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
74024
74052
  let moveY = event.canvasY;
74025
74053
  let upX = event.canvasX;
74026
74054
  let upY = event.canvasY;
74027
- const mouseup = delayMap[delayType]((params) => {
74055
+ this._handleDragMouseUp = delayMap[delayType]((params) => {
74028
74056
  this._clickEnable = true;
74029
74057
  const event = params.event;
74030
74058
  const dx = event.canvasX - upX;
@@ -74040,18 +74068,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
74040
74068
  model: this
74041
74069
  });
74042
74070
  this._zoomableTrigger.pointerId = null;
74043
- this._eventObj.off(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mousemove);
74044
- end.forEach(endEventType => {
74045
- this._eventObj.off(endEventType, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mouseup);
74046
- this._eventObj.allow(endEventType);
74047
- });
74071
+ this._clearDragEvent();
74048
74072
  }, delayTime);
74049
- const mousemove = delayMap[delayType]((params) => {
74073
+ this._handleDragMouseMove = delayMap[delayType]((params) => {
74050
74074
  if (!this._zoomableTrigger.parserDragEvent(params.event)) {
74051
74075
  return;
74052
74076
  }
74053
74077
  this._clickEnable = false;
74054
- end.forEach(endEventType => this._eventObj.prevent(endEventType, mouseup));
74078
+ end.forEach(endEventType => this._eventObj.prevent(endEventType, this._handleDragMouseUp));
74055
74079
  const event = params.event;
74056
74080
  const dx = event.canvasX - moveX;
74057
74081
  const dy = event.canvasY - moveY;
@@ -74066,9 +74090,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
74066
74090
  model: this
74067
74091
  });
74068
74092
  }, delayTime);
74069
- this._eventObj.on(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mousemove);
74093
+ this._eventObj.on(move, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, this._handleDragMouseMove);
74070
74094
  end.forEach(endEventType => {
74071
- this._eventObj.on(endEventType, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, mouseup);
74095
+ this._eventObj.on(endEventType, { level: Event_Bubble_Level.chart, source: Event_Source_Type.chart }, this._handleDragMouseUp);
74072
74096
  });
74073
74097
  }
74074
74098
  }