@visactor/vchart 1.13.22-alpha.2 → 1.13.22-alpha.4

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
@@ -64288,7 +64288,7 @@ const registerVChartCore = () => {
64288
64288
  };
64289
64289
  registerVChartCore();
64290
64290
 
64291
- const version = "1.13.22-alpha.2";
64291
+ const version = "1.13.22-alpha.4";
64292
64292
 
64293
64293
  const addVChartProperty = (data, op) => {
64294
64294
  const context = op.beforeCall();
@@ -104735,10 +104735,6 @@ class ScrollPlugin extends BasePlugin {
104735
104735
  };
104736
104736
  this.onWheel = (e) => {
104737
104737
  var _a, _b;
104738
- if (this._spec.preventDefault !== false) {
104739
- e.preventDefault();
104740
- e.stopPropagation();
104741
- }
104742
104738
  const scrollX = e.deltaX;
104743
104739
  const scrollY = e.deltaY;
104744
104740
  const rootMark = this.getRootMark();
@@ -104748,6 +104744,7 @@ class ScrollPlugin extends BasePlugin {
104748
104744
  const { percent: yPercent, y } = (_a = this._computeFinalScrollY(rootMark.attribute.y - scrollY)) !== null && _a !== void 0 ? _a : {};
104749
104745
  const { percent: xPercent, x } = (_b = this._computeFinalScrollX(rootMark.attribute.x - scrollX)) !== null && _b !== void 0 ? _b : {};
104750
104746
  const eventResult = {};
104747
+ const isScroll = isValidNumber$1(x) || isValidNumber$1(y);
104751
104748
  if (isValidNumber$1(x)) {
104752
104749
  this._updateScrollX(rootMark, x, xPercent);
104753
104750
  eventResult.x = x;
@@ -104756,6 +104753,12 @@ class ScrollPlugin extends BasePlugin {
104756
104753
  this._updateScrollY(rootMark, y, yPercent);
104757
104754
  eventResult.y = y;
104758
104755
  }
104756
+ if (isScroll) {
104757
+ if (this._spec.preventDefault !== false) {
104758
+ e.preventDefault();
104759
+ e.stopPropagation();
104760
+ }
104761
+ }
104759
104762
  this._event.emit('chartScroll', eventResult);
104760
104763
  };
104761
104764
  }
@@ -104812,6 +104815,7 @@ class ScrollPlugin extends BasePlugin {
104812
104815
  }
104813
104816
  _computeFinalScrollY(y) {
104814
104817
  var _a;
104818
+ y = Math.max(this._scrollLimit.y.min, Math.min(y, this._scrollLimit.y.max));
104815
104819
  if (this._lastScrollY === y) {
104816
104820
  return null;
104817
104821
  }
@@ -104819,15 +104823,15 @@ class ScrollPlugin extends BasePlugin {
104819
104823
  if (((_a = this._spec.y) === null || _a === void 0 ? void 0 : _a.enable) === false) {
104820
104824
  return null;
104821
104825
  }
104822
- const finalY = Math.max(this._scrollLimit.y.min, Math.min(y, this._scrollLimit.y.max));
104823
- const percent = Math.abs(finalY / this._scrollLimit.y.size);
104826
+ const percent = Math.abs(y / this._scrollLimit.y.size);
104824
104827
  return {
104825
- y: finalY,
104828
+ y,
104826
104829
  percent
104827
104830
  };
104828
104831
  }
104829
104832
  _computeFinalScrollX(x) {
104830
104833
  var _a;
104834
+ x = Math.max(this._scrollLimit.x.min, Math.min(x, this._scrollLimit.x.max));
104831
104835
  if (this._lastScrollX === x) {
104832
104836
  return null;
104833
104837
  }
@@ -104835,10 +104839,9 @@ class ScrollPlugin extends BasePlugin {
104835
104839
  if (((_a = this._spec.x) === null || _a === void 0 ? void 0 : _a.enable) === false) {
104836
104840
  return null;
104837
104841
  }
104838
- const finalX = Math.max(this._scrollLimit.x.min, Math.min(x, this._scrollLimit.x.max));
104839
- const percent = Math.abs(finalX / this._scrollLimit.x.size);
104842
+ const percent = Math.abs(x / this._scrollLimit.x.size);
104840
104843
  return {
104841
- x: finalX,
104844
+ x,
104842
104845
  percent
104843
104846
  };
104844
104847
  }
package/build/index.js CHANGED
@@ -64294,7 +64294,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64294
64294
  };
64295
64295
  registerVChartCore();
64296
64296
 
64297
- const version = "1.13.22-alpha.2";
64297
+ const version = "1.13.22-alpha.4";
64298
64298
 
64299
64299
  const addVChartProperty = (data, op) => {
64300
64300
  const context = op.beforeCall();
@@ -104741,10 +104741,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104741
104741
  };
104742
104742
  this.onWheel = (e) => {
104743
104743
  var _a, _b;
104744
- if (this._spec.preventDefault !== false) {
104745
- e.preventDefault();
104746
- e.stopPropagation();
104747
- }
104748
104744
  const scrollX = e.deltaX;
104749
104745
  const scrollY = e.deltaY;
104750
104746
  const rootMark = this.getRootMark();
@@ -104754,6 +104750,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104754
104750
  const { percent: yPercent, y } = (_a = this._computeFinalScrollY(rootMark.attribute.y - scrollY)) !== null && _a !== void 0 ? _a : {};
104755
104751
  const { percent: xPercent, x } = (_b = this._computeFinalScrollX(rootMark.attribute.x - scrollX)) !== null && _b !== void 0 ? _b : {};
104756
104752
  const eventResult = {};
104753
+ const isScroll = isValidNumber$1(x) || isValidNumber$1(y);
104757
104754
  if (isValidNumber$1(x)) {
104758
104755
  this._updateScrollX(rootMark, x, xPercent);
104759
104756
  eventResult.x = x;
@@ -104762,6 +104759,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104762
104759
  this._updateScrollY(rootMark, y, yPercent);
104763
104760
  eventResult.y = y;
104764
104761
  }
104762
+ if (isScroll) {
104763
+ if (this._spec.preventDefault !== false) {
104764
+ e.preventDefault();
104765
+ e.stopPropagation();
104766
+ }
104767
+ }
104765
104768
  this._event.emit('chartScroll', eventResult);
104766
104769
  };
104767
104770
  }
@@ -104818,6 +104821,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104818
104821
  }
104819
104822
  _computeFinalScrollY(y) {
104820
104823
  var _a;
104824
+ y = Math.max(this._scrollLimit.y.min, Math.min(y, this._scrollLimit.y.max));
104821
104825
  if (this._lastScrollY === y) {
104822
104826
  return null;
104823
104827
  }
@@ -104825,15 +104829,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104825
104829
  if (((_a = this._spec.y) === null || _a === void 0 ? void 0 : _a.enable) === false) {
104826
104830
  return null;
104827
104831
  }
104828
- const finalY = Math.max(this._scrollLimit.y.min, Math.min(y, this._scrollLimit.y.max));
104829
- const percent = Math.abs(finalY / this._scrollLimit.y.size);
104832
+ const percent = Math.abs(y / this._scrollLimit.y.size);
104830
104833
  return {
104831
- y: finalY,
104834
+ y,
104832
104835
  percent
104833
104836
  };
104834
104837
  }
104835
104838
  _computeFinalScrollX(x) {
104836
104839
  var _a;
104840
+ x = Math.max(this._scrollLimit.x.min, Math.min(x, this._scrollLimit.x.max));
104837
104841
  if (this._lastScrollX === x) {
104838
104842
  return null;
104839
104843
  }
@@ -104841,10 +104845,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104841
104845
  if (((_a = this._spec.x) === null || _a === void 0 ? void 0 : _a.enable) === false) {
104842
104846
  return null;
104843
104847
  }
104844
- const finalX = Math.max(this._scrollLimit.x.min, Math.min(x, this._scrollLimit.x.max));
104845
- const percent = Math.abs(finalX / this._scrollLimit.x.size);
104848
+ const percent = Math.abs(x / this._scrollLimit.x.size);
104846
104849
  return {
104847
- x: finalX,
104850
+ x,
104848
104851
  percent
104849
104852
  };
104850
104853
  }