@visactor/vchart 1.13.22 → 1.13.23-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
@@ -104214,10 +104214,6 @@ class ScrollPlugin extends BasePlugin {
104214
104214
  };
104215
104215
  this.onWheel = (e) => {
104216
104216
  var _a, _b;
104217
- if (this._spec.preventDefault !== false) {
104218
- e.preventDefault();
104219
- e.stopPropagation();
104220
- }
104221
104217
  const scrollX = e.deltaX;
104222
104218
  const scrollY = e.deltaY;
104223
104219
  const rootMark = this.getRootMark();
@@ -104227,6 +104223,7 @@ class ScrollPlugin extends BasePlugin {
104227
104223
  const { percent: yPercent, y } = (_a = this._computeFinalScrollY(rootMark.attribute.y - scrollY)) !== null && _a !== void 0 ? _a : {};
104228
104224
  const { percent: xPercent, x } = (_b = this._computeFinalScrollX(rootMark.attribute.x - scrollX)) !== null && _b !== void 0 ? _b : {};
104229
104225
  const eventResult = {};
104226
+ const isScroll = isValidNumber$1(x) || isValidNumber$1(y);
104230
104227
  if (isValidNumber$1(x)) {
104231
104228
  this._updateScrollX(rootMark, x, xPercent);
104232
104229
  eventResult.x = x;
@@ -104235,6 +104232,12 @@ class ScrollPlugin extends BasePlugin {
104235
104232
  this._updateScrollY(rootMark, y, yPercent);
104236
104233
  eventResult.y = y;
104237
104234
  }
104235
+ if (isScroll) {
104236
+ if (this._spec.preventDefault !== false) {
104237
+ e.preventDefault();
104238
+ e.stopPropagation();
104239
+ }
104240
+ }
104238
104241
  this._event.emit('chartScroll', eventResult);
104239
104242
  };
104240
104243
  }
@@ -104291,6 +104294,7 @@ class ScrollPlugin extends BasePlugin {
104291
104294
  }
104292
104295
  _computeFinalScrollY(y) {
104293
104296
  var _a;
104297
+ y = Math.max(this._scrollLimit.y.min, Math.min(y, this._scrollLimit.y.max));
104294
104298
  if (this._lastScrollY === y) {
104295
104299
  return null;
104296
104300
  }
@@ -104298,15 +104302,15 @@ class ScrollPlugin extends BasePlugin {
104298
104302
  if (((_a = this._spec.y) === null || _a === void 0 ? void 0 : _a.enable) === false) {
104299
104303
  return null;
104300
104304
  }
104301
- const finalY = Math.max(this._scrollLimit.y.min, Math.min(y, this._scrollLimit.y.max));
104302
- const percent = Math.abs(finalY / this._scrollLimit.y.size);
104305
+ const percent = Math.abs(y / this._scrollLimit.y.size);
104303
104306
  return {
104304
- y: finalY,
104307
+ y,
104305
104308
  percent
104306
104309
  };
104307
104310
  }
104308
104311
  _computeFinalScrollX(x) {
104309
104312
  var _a;
104313
+ x = Math.max(this._scrollLimit.x.min, Math.min(x, this._scrollLimit.x.max));
104310
104314
  if (this._lastScrollX === x) {
104311
104315
  return null;
104312
104316
  }
@@ -104314,10 +104318,9 @@ class ScrollPlugin extends BasePlugin {
104314
104318
  if (((_a = this._spec.x) === null || _a === void 0 ? void 0 : _a.enable) === false) {
104315
104319
  return null;
104316
104320
  }
104317
- const finalX = Math.max(this._scrollLimit.x.min, Math.min(x, this._scrollLimit.x.max));
104318
- const percent = Math.abs(finalX / this._scrollLimit.x.size);
104321
+ const percent = Math.abs(x / this._scrollLimit.x.size);
104319
104322
  return {
104320
- x: finalX,
104323
+ x,
104321
104324
  percent
104322
104325
  };
104323
104326
  }
package/build/index.js CHANGED
@@ -104220,10 +104220,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104220
104220
  };
104221
104221
  this.onWheel = (e) => {
104222
104222
  var _a, _b;
104223
- if (this._spec.preventDefault !== false) {
104224
- e.preventDefault();
104225
- e.stopPropagation();
104226
- }
104227
104223
  const scrollX = e.deltaX;
104228
104224
  const scrollY = e.deltaY;
104229
104225
  const rootMark = this.getRootMark();
@@ -104233,6 +104229,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104233
104229
  const { percent: yPercent, y } = (_a = this._computeFinalScrollY(rootMark.attribute.y - scrollY)) !== null && _a !== void 0 ? _a : {};
104234
104230
  const { percent: xPercent, x } = (_b = this._computeFinalScrollX(rootMark.attribute.x - scrollX)) !== null && _b !== void 0 ? _b : {};
104235
104231
  const eventResult = {};
104232
+ const isScroll = isValidNumber$1(x) || isValidNumber$1(y);
104236
104233
  if (isValidNumber$1(x)) {
104237
104234
  this._updateScrollX(rootMark, x, xPercent);
104238
104235
  eventResult.x = x;
@@ -104241,6 +104238,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104241
104238
  this._updateScrollY(rootMark, y, yPercent);
104242
104239
  eventResult.y = y;
104243
104240
  }
104241
+ if (isScroll) {
104242
+ if (this._spec.preventDefault !== false) {
104243
+ e.preventDefault();
104244
+ e.stopPropagation();
104245
+ }
104246
+ }
104244
104247
  this._event.emit('chartScroll', eventResult);
104245
104248
  };
104246
104249
  }
@@ -104297,6 +104300,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104297
104300
  }
104298
104301
  _computeFinalScrollY(y) {
104299
104302
  var _a;
104303
+ y = Math.max(this._scrollLimit.y.min, Math.min(y, this._scrollLimit.y.max));
104300
104304
  if (this._lastScrollY === y) {
104301
104305
  return null;
104302
104306
  }
@@ -104304,15 +104308,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104304
104308
  if (((_a = this._spec.y) === null || _a === void 0 ? void 0 : _a.enable) === false) {
104305
104309
  return null;
104306
104310
  }
104307
- const finalY = Math.max(this._scrollLimit.y.min, Math.min(y, this._scrollLimit.y.max));
104308
- const percent = Math.abs(finalY / this._scrollLimit.y.size);
104311
+ const percent = Math.abs(y / this._scrollLimit.y.size);
104309
104312
  return {
104310
- y: finalY,
104313
+ y,
104311
104314
  percent
104312
104315
  };
104313
104316
  }
104314
104317
  _computeFinalScrollX(x) {
104315
104318
  var _a;
104319
+ x = Math.max(this._scrollLimit.x.min, Math.min(x, this._scrollLimit.x.max));
104316
104320
  if (this._lastScrollX === x) {
104317
104321
  return null;
104318
104322
  }
@@ -104320,10 +104324,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
104320
104324
  if (((_a = this._spec.x) === null || _a === void 0 ? void 0 : _a.enable) === false) {
104321
104325
  return null;
104322
104326
  }
104323
- const finalX = Math.max(this._scrollLimit.x.min, Math.min(x, this._scrollLimit.x.max));
104324
- const percent = Math.abs(finalX / this._scrollLimit.x.size);
104327
+ const percent = Math.abs(x / this._scrollLimit.x.size);
104325
104328
  return {
104326
- x: finalX,
104329
+ x,
104327
104330
  percent
104328
104331
  };
104329
104332
  }