cx 24.8.2 → 24.8.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/dist/charts.js CHANGED
@@ -5245,7 +5245,6 @@ var PointReducer = /*#__PURE__*/ (function (_PureContainer) {
5245
5245
  var _this = this;
5246
5246
  var parentPointReducer = context.pointReducer;
5247
5247
  instance.parentPointTracker = parentPointReducer;
5248
- instance.accumulatorReset = false;
5249
5248
  if (!instance.pointReducer) {
5250
5249
  var onMap = this.onMap && instance.getCallback("onMap");
5251
5250
  var accumulator = {};
@@ -5254,10 +5253,6 @@ var PointReducer = /*#__PURE__*/ (function (_PureContainer) {
5254
5253
  if (_this.onInitAccumulator) instance.invoke("onInitAccumulator", accumulator, instance);
5255
5254
  };
5256
5255
  instance.pointReducer = function (x, y, name, data, array, index) {
5257
- if (!instance.accumulatorReset) {
5258
- instance.resetAccumulator();
5259
- instance.accumulatorReset = true;
5260
- }
5261
5256
  onMap(accumulator, x, y, name, data, array, index);
5262
5257
  if (parentPointReducer) parentPointReducer(x, y, name, data, array, index);
5263
5258
  };
@@ -5265,6 +5260,7 @@ var PointReducer = /*#__PURE__*/ (function (_PureContainer) {
5265
5260
  if (_this.onReduce) instance.invoke("onReduce", accumulator, instance);
5266
5261
  };
5267
5262
  }
5263
+ instance.resetAccumulator();
5268
5264
  context.push("pointReducer", instance.pointReducer);
5269
5265
  _PureContainer.prototype.explore.call(this, context, instance);
5270
5266
  };
@@ -5372,8 +5368,11 @@ var SnapPointFinder = /*#__PURE__*/ (function (_PointReducer) {
5372
5368
  var data = _ref.data,
5373
5369
  xAxis = _ref.xAxis,
5374
5370
  yAxis = _ref.yAxis;
5375
- acc.cursorX = data.cursorX != null ? (xAxis == null ? void 0 : xAxis.map(this.convertX(data.cursorX))) : null;
5376
- acc.cursorY = data.cursorY != null ? (yAxis == null ? void 0 : yAxis.map(this.convertY(data.cursorY))) : null;
5371
+ acc.cursor = {
5372
+ x: data.cursorX,
5373
+ y: data.cursorY,
5374
+ mapped: false,
5375
+ };
5377
5376
  acc.dist = data.maxDistance > 0 ? Math.pow(data.maxDistance, 2) : Number.POSITIVE_INFINITY;
5378
5377
  acc.snapX = null;
5379
5378
  acc.snapY = null;
@@ -5382,12 +5381,18 @@ var SnapPointFinder = /*#__PURE__*/ (function (_PointReducer) {
5382
5381
  };
5383
5382
  _proto.onMap = function onMap(acc, x, y, name, p) {
5384
5383
  var xAxis = acc.xAxis,
5385
- yAxis = acc.yAxis;
5384
+ yAxis = acc.yAxis,
5385
+ cursor = acc.cursor;
5386
+ if (!cursor.mapped) {
5387
+ cursor.mappedX = cursor.x != null ? (xAxis == null ? void 0 : xAxis.map(this.convertX(cursor.x))) : null;
5388
+ cursor.mappedY = cursor.y != null ? (yAxis == null ? void 0 : yAxis.map(this.convertY(cursor.y))) : null;
5389
+ cursor.mapped = true;
5390
+ }
5386
5391
  var d = null;
5387
5392
  var cx = x != null ? (xAxis == null ? void 0 : xAxis.map(this.convertX(x))) : null;
5388
5393
  var cy = y != null ? (yAxis == null ? void 0 : yAxis.map(this.convertY(y))) : null;
5389
- if (acc.cursorX != null && cx != null) d = (d || 0) + Math.pow(Math.abs(cx - acc.cursorX), 2);
5390
- if (acc.cursorY != null && cy != null) d = (d || 0) + Math.pow(Math.abs(cy - acc.cursorY), 2);
5394
+ if (cursor.mappedX != null && cx != null) d = (d || 0) + Math.pow(Math.abs(cx - cursor.mappedX), 2);
5395
+ if (cursor.mappedY != null && cy != null) d = (d || 0) + Math.pow(Math.abs(cy - cursor.mappedY), 2);
5391
5396
  if (d != null && d < acc.dist) {
5392
5397
  acc.dist = d;
5393
5398
  acc.snapX = x;