@axdspub/axiom-charts 0.0.14 → 0.0.16

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