@visactor/vchart 1.9.6-alpha.1 → 1.9.6-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.js CHANGED
@@ -37514,14 +37514,14 @@
37514
37514
  }));
37515
37515
  }
37516
37516
  eventPosToStagePos(e) {
37517
- var _a, _b;
37517
+ var _a, _b, _c, _d, _e, _f;
37518
37518
  const {
37519
37519
  x: x,
37520
37520
  y: y
37521
- } = vglobal.mapToCanvasPoint(e, this.stage.window.getContext().canvas.nativeCanvas);
37521
+ } = vglobal.mapToCanvasPoint(e, null === (_d = null === (_c = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.window) || void 0 === _b ? void 0 : _b.getContext()) || void 0 === _c ? void 0 : _c.canvas) || void 0 === _d ? void 0 : _d.nativeCanvas);
37522
37522
  return {
37523
- x: x - ((null === (_a = this.stage) || void 0 === _a ? void 0 : _a.x) || 0),
37524
- y: y - ((null === (_b = this.stage) || void 0 === _b ? void 0 : _b.y) || 0)
37523
+ x: x - ((null === (_e = this.stage) || void 0 === _e ? void 0 : _e.x) || 0),
37524
+ y: y - ((null === (_f = this.stage) || void 0 === _f ? void 0 : _f.y) || 0)
37525
37525
  };
37526
37526
  }
37527
37527
  _onHandlerPointerEnter(e) {
@@ -37919,15 +37919,21 @@
37919
37919
  basePointEnd: basePointEnd
37920
37920
  };
37921
37921
  }
37922
- getPreviewLinePoints() {
37922
+ simplifyPoints(points) {
37923
37923
  var _a;
37924
+ if (points.length > 1e4) {
37925
+ const tolerance = null !== (_a = this.attribute.tolerance) && void 0 !== _a ? _a : this._previewData.length / 1e4;
37926
+ return flatten_simplify(points, tolerance, !1);
37927
+ }
37928
+ return points;
37929
+ }
37930
+ getPreviewLinePoints() {
37924
37931
  let previewPoints = this._previewData.map(d => ({
37925
37932
  x: this._previewPointsX && this._previewPointsX(d),
37926
37933
  y: this._previewPointsY && this._previewPointsY(d)
37927
37934
  }));
37928
37935
  if (0 === previewPoints.length) return previewPoints;
37929
- const tolerance = null !== (_a = this.attribute.tolerance) && void 0 !== _a ? _a : this._previewData.length > 1e4 ? this._previewData.length / 1e4 : this._previewData.length;
37930
- previewPoints = flatten_simplify(previewPoints, tolerance, !1);
37936
+ previewPoints = this.simplifyPoints(previewPoints);
37931
37937
  const {
37932
37938
  basePointStart: basePointStart,
37933
37939
  basePointEnd: basePointEnd
@@ -37935,7 +37941,6 @@
37935
37941
  return basePointStart.concat(previewPoints).concat(basePointEnd);
37936
37942
  }
37937
37943
  getPreviewAreaPoints() {
37938
- var _a;
37939
37944
  let previewPoints = this._previewData.map(d => ({
37940
37945
  x: this._previewPointsX && this._previewPointsX(d),
37941
37946
  y: this._previewPointsY && this._previewPointsY(d),
@@ -37943,8 +37948,7 @@
37943
37948
  y1: this._previewPointsY1 && this._previewPointsY1(d)
37944
37949
  }));
37945
37950
  if (0 === previewPoints.length) return previewPoints;
37946
- const tolerance = null !== (_a = this.attribute.tolerance) && void 0 !== _a ? _a : this._previewData.length > 1e4 ? this._previewData.length / 1e4 : this._previewData.length;
37947
- previewPoints = flatten_simplify(previewPoints, tolerance, !1);
37951
+ previewPoints = this.simplifyPoints(previewPoints);
37948
37952
  const {
37949
37953
  basePointStart: basePointStart,
37950
37954
  basePointEnd: basePointEnd
@@ -59952,7 +59956,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
59952
59956
  registerChartPlugin(MediaQuery);
59953
59957
  };
59954
59958
 
59955
- const version = "1.9.6-alpha.1";
59959
+ const version = "1.9.6-alpha.4";
59956
59960
 
59957
59961
  const addVChartProperty = (data, op) => {
59958
59962
  const context = op.beforeCall();
@@ -85945,14 +85949,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
85945
85949
  });
85946
85950
  };
85947
85951
  this._getMouseOutHandler = (needPointerDetection) => (params) => {
85948
- var _a, _b;
85952
+ var _a, _b, _c;
85949
85953
  if (this._alwaysShow) {
85950
85954
  return;
85951
85955
  }
85952
85956
  if (!this._isTooltipShown && !((_b = (_a = this.tooltipHandler) === null || _a === void 0 ? void 0 : _a.isTooltipShown) === null || _b === void 0 ? void 0 : _b.call(_a))) {
85953
85957
  return;
85954
85958
  }
85955
- const browserEnv = isTrueBrowser(this._option.mode);
85959
+ const browserEnv = isTrueBrowser((_c = this._option) === null || _c === void 0 ? void 0 : _c.mode);
85956
85960
  const { clientX, clientY } = params.event;
85957
85961
  if (browserEnv && this._isPointerOnTooltip(params)) {
85958
85962
  return;
@@ -86009,6 +86013,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
86009
86013
  }
86010
86014
  };
86011
86015
  this._showTooltipByMouseEvent = (activeType, mouseEventData, params, useCache) => {
86016
+ var _a;
86012
86017
  const processor = this._processor[activeType];
86013
86018
  if (!processor.shouldHandleTooltip(params, {
86014
86019
  tooltipInfo: mouseEventData.tooltipInfo[activeType],
@@ -86032,8 +86037,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
86032
86037
  if (success) {
86033
86038
  this._isTooltipShown = true;
86034
86039
  }
86035
- const vchart = this._option.globalInstance;
86036
- if (success && VChart.globalConfig.uniqueTooltip) {
86040
+ const vchart = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance;
86041
+ if (success && VChart.globalConfig.uniqueTooltip && vchart) {
86037
86042
  VChart.hideTooltip(vchart.id);
86038
86043
  }
86039
86044
  return success;
@@ -86287,7 +86292,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
86287
86292
  prevParams.datum === nextParams.datum);
86288
86293
  }
86289
86294
  _isPointerInChart(point) {
86290
- const globalInstance = this._option.globalInstance;
86295
+ var _a;
86296
+ const globalInstance = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance;
86297
+ if (!globalInstance) {
86298
+ return false;
86299
+ }
86291
86300
  const chart = globalInstance.getChart();
86292
86301
  if (!chart) {
86293
86302
  return false;