@axdspub/axiom-charts 0.0.14 → 0.0.15

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.
@@ -268,6 +268,7 @@ var ChartRoot = /** @class */ (function () {
268
268
  this.settings = props.settings;
269
269
  this.element = props.element;
270
270
  this.onScrub = props.onScrub;
271
+ this.onScrubEnd = props.onScrubEnd;
271
272
  this.runtime = {
272
273
  prevWidth: 0,
273
274
  prevHeight: 0
@@ -1235,7 +1236,9 @@ var AxiomChart = /** @class */ (function (_super) {
1235
1236
  var touchOffset = 20; // TODO: figure out why touch.clientX is always off to the right
1236
1237
  _this.onScrubTriggered(touch.clientX - touchOffset);
1237
1238
  });
1239
+ ctx.canvas.addEventListener('touchend', function (event) { _this.onScrubEndTriggered(); });
1238
1240
  ctx.canvas.addEventListener('mousemove', function (event) { _this.onScrubTriggered(event.offsetX); });
1241
+ ctx.canvas.addEventListener('mouseleave', function (event) { _this.onScrubEndTriggered(); });
1239
1242
  };
1240
1243
  AxiomChart.prototype.onScrubTriggered = function (cursorX) {
1241
1244
  var _this = this;
@@ -1245,7 +1248,6 @@ var AxiomChart = /** @class */ (function (_super) {
1245
1248
  return plot.scrubbing !== undefined && plot.scrubbing && plot.type === EPlotTypes.line;
1246
1249
  });
1247
1250
  var plotScrubPositions = this.getScrubPositions(cursorX, plotsWithScrubbingEnabled);
1248
- // console.log(plotScrubPositions)
1249
1251
  if (this.onScrub !== undefined) {
1250
1252
  this.onScrub(plotScrubPositions);
1251
1253
  }
@@ -1269,6 +1271,28 @@ var AxiomChart = /** @class */ (function (_super) {
1269
1271
  console.error(error);
1270
1272
  });
1271
1273
  };
1274
+ AxiomChart.prototype.onScrubEndTriggered = function () {
1275
+ this.removeScrubbers();
1276
+ if (this.onScrubEnd !== undefined) {
1277
+ this.onScrubEnd();
1278
+ }
1279
+ };
1280
+ AxiomChart.prototype.removeScrubbers = function () {
1281
+ var _this = this;
1282
+ if (this.plotImplementations === undefined)
1283
+ return;
1284
+ this.runtime.busy = true;
1285
+ this.clearCanvas();
1286
+ var drawPromises = this.plotImplementations.map(function (plot) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1287
+ switch (_a.label) {
1288
+ case 0: return [4 /*yield*/, plot.draw()];
1289
+ case 1:
1290
+ _a.sent();
1291
+ return [2 /*return*/];
1292
+ }
1293
+ }); }); });
1294
+ void Promise.all(drawPromises);
1295
+ };
1272
1296
  AxiomChart.prototype.getScrubPositions = function (mouseX, plots) {
1273
1297
  var plotScrubPositions = {};
1274
1298
  plots.forEach(function (plot) {