@oliasoft-open-source/charts-library 4.3.3-beta-9 → 4.3.3-beta-10

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/index.js CHANGED
@@ -26212,11 +26212,10 @@ const handleAnnotationMouseUp = (isDragging2, activeAnnotation, chart2, setDragg
26212
26212
  chart2.canvas.style.cursor = CursorStyle.Pointer;
26213
26213
  }
26214
26214
  }
26215
+ console.log("chart?.canvas MOUSE UP", chart2 == null ? void 0 : chart2.canvas);
26215
26216
  if (chart2 == null ? void 0 : chart2.canvas) {
26216
26217
  setDraggingState(false, null);
26217
26218
  chart2 == null ? void 0 : chart2.update();
26218
- } else {
26219
- console.error("Canvas is not available during mouse up");
26220
26219
  }
26221
26220
  }
26222
26221
  };
@@ -26284,13 +26283,12 @@ const annotationDraggerPlugin = {
26284
26283
  }
26285
26284
  },
26286
26285
  afterRender(chart2) {
26287
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
26288
- const { canvas: canvas2, scales, hoveredAnnotationId } = chart2;
26286
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2;
26289
26287
  const pluginOptions = ((_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.plugins) == null ? void 0 : _b2.annotationDraggerPlugin) || {
26290
26288
  enabled: false
26291
26289
  };
26292
- const typedScales = { x: scales.x, y: scales.y };
26293
- let annotations = ((_e2 = (_d2 = (_c2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _c2.plugins) == null ? void 0 : _d2.annotation) == null ? void 0 : _e2.annotations) ?? {};
26290
+ const typedScales = { x: (_c2 = chart2 == null ? void 0 : chart2.scales) == null ? void 0 : _c2.x, y: (_d2 = chart2 == null ? void 0 : chart2.scales) == null ? void 0 : _d2.y };
26291
+ let annotations = ((_g2 = (_f2 = (_e2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _e2.plugins) == null ? void 0 : _f2.annotation) == null ? void 0 : _g2.annotations) ?? {};
26294
26292
  if (!annotations)
26295
26293
  return;
26296
26294
  let isDragging2 = false;
@@ -26304,39 +26302,45 @@ const annotationDraggerPlugin = {
26304
26302
  dragStartY = startY;
26305
26303
  }
26306
26304
  };
26307
- if (!((_f2 = canvas2 == null ? void 0 : canvas2.dataset) == null ? void 0 : _f2.annotationDraggerInitialized) && (pluginOptions == null ? void 0 : pluginOptions.enabled) && hoveredAnnotationId) {
26305
+ if (!((_i2 = (_h2 = chart2 == null ? void 0 : chart2.canvas) == null ? void 0 : _h2.dataset) == null ? void 0 : _i2.annotationDraggerInitialized) && (pluginOptions == null ? void 0 : pluginOptions.enabled) && (chart2 == null ? void 0 : chart2.hoveredAnnotationId)) {
26308
26306
  console.group("Condition");
26309
- console.log("addEventListener", (_g2 = chart2 == null ? void 0 : chart2.canvas) == null ? void 0 : _g2.addEventListener);
26310
- console.log("nil", !isNil(canvas2));
26311
- console.log("isEmpty", !isEmpty(canvas2));
26312
- console.log("isFunction", isFunction$2(canvas2.addEventListener));
26307
+ console.log("addEventListener", (_j2 = chart2 == null ? void 0 : chart2.canvas) == null ? void 0 : _j2.addEventListener);
26308
+ console.log("nil", !isNil(chart2 == null ? void 0 : chart2.canvas));
26309
+ console.log("isEmpty", !isEmpty(chart2 == null ? void 0 : chart2.canvas));
26310
+ console.log("isFunction", isFunction$2(chart2 == null ? void 0 : chart2.canvas.addEventListener));
26313
26311
  console.groupEnd();
26314
- if (!isNil(canvas2) && !isEmpty(canvas2) && isFunction$2(canvas2.addEventListener)) {
26315
- console.log("Canvas exists and has addEventListener:", canvas2);
26316
- canvas2.addEventListener(MouseEvents.MOUSEDOWN, (event) => {
26317
- var _a3, _b3, _c3;
26318
- handleAnnotationMouseDown(
26319
- event,
26320
- canvas2,
26321
- typedScales,
26322
- (_c3 = (_b3 = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.plugins) == null ? void 0 : _b3.annotation) == null ? void 0 : _c3.annotations,
26323
- setDraggingState,
26324
- chart2.hoveredAnnotationId
26325
- );
26326
- });
26327
- canvas2.addEventListener(MouseEvents.MOUSEMOVE, (event) => {
26328
- handleAnnotationMouseMove(
26329
- event,
26330
- canvas2,
26331
- typedScales,
26332
- isDragging2,
26333
- activeAnnotation,
26334
- dragStartX,
26335
- dragStartY,
26336
- chart2
26337
- );
26338
- });
26339
- canvas2.addEventListener(MouseEvents.MOUSEUP, () => {
26312
+ if (!isNil(chart2 == null ? void 0 : chart2.canvas) && !isEmpty(chart2 == null ? void 0 : chart2.canvas) && isFunction$2(chart2 == null ? void 0 : chart2.canvas.addEventListener)) {
26313
+ console.log("Canvas exists and has addEventListener:", chart2 == null ? void 0 : chart2.canvas);
26314
+ (_k2 = chart2 == null ? void 0 : chart2.canvas) == null ? void 0 : _k2.addEventListener(
26315
+ MouseEvents.MOUSEDOWN,
26316
+ (event) => {
26317
+ var _a3, _b3, _c3;
26318
+ handleAnnotationMouseDown(
26319
+ event,
26320
+ chart2 == null ? void 0 : chart2.canvas,
26321
+ typedScales,
26322
+ (_c3 = (_b3 = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.plugins) == null ? void 0 : _b3.annotation) == null ? void 0 : _c3.annotations,
26323
+ setDraggingState,
26324
+ chart2.hoveredAnnotationId
26325
+ );
26326
+ }
26327
+ );
26328
+ (_l2 = chart2 == null ? void 0 : chart2.canvas) == null ? void 0 : _l2.addEventListener(
26329
+ MouseEvents.MOUSEMOVE,
26330
+ (event) => {
26331
+ handleAnnotationMouseMove(
26332
+ event,
26333
+ chart2 == null ? void 0 : chart2.canvas,
26334
+ typedScales,
26335
+ isDragging2,
26336
+ activeAnnotation,
26337
+ dragStartX,
26338
+ dragStartY,
26339
+ chart2
26340
+ );
26341
+ }
26342
+ );
26343
+ chart2 == null ? void 0 : chart2.canvas.addEventListener(MouseEvents.MOUSEUP, () => {
26340
26344
  handleAnnotationMouseUp(
26341
26345
  isDragging2,
26342
26346
  activeAnnotation,
@@ -26344,24 +26348,24 @@ const annotationDraggerPlugin = {
26344
26348
  setDraggingState
26345
26349
  );
26346
26350
  });
26347
- canvas2.dataset.annotationDraggerInitialized = "true";
26351
+ chart2.canvas.dataset.annotationDraggerInitialized = "true";
26348
26352
  } else {
26349
26353
  console.error(
26350
26354
  "Canvas is null, empty, or does not support addEventListener:",
26351
- canvas2
26355
+ chart2 == null ? void 0 : chart2.canvas
26352
26356
  );
26353
26357
  }
26354
26358
  }
26355
26359
  if (!pluginOptions.enabled) {
26356
- if (canvas2 && isFunction$2(canvas2.removeEventListener)) {
26357
- console.log("Removing event listeners from canvas:", canvas2);
26358
- canvas2.removeEventListener(MouseEvents.MOUSEDOWN, () => {
26360
+ if ((chart2 == null ? void 0 : chart2.canvas) && isFunction$2(chart2 == null ? void 0 : chart2.canvas.removeEventListener)) {
26361
+ console.log("Removing event listeners from canvas:", chart2 == null ? void 0 : chart2.canvas);
26362
+ chart2 == null ? void 0 : chart2.canvas.removeEventListener(MouseEvents.MOUSEDOWN, () => {
26359
26363
  });
26360
- canvas2.removeEventListener(MouseEvents.MOUSEMOVE, () => {
26364
+ chart2 == null ? void 0 : chart2.canvas.removeEventListener(MouseEvents.MOUSEMOVE, () => {
26361
26365
  });
26362
- canvas2.removeEventListener(MouseEvents.MOUSEUP, () => {
26366
+ chart2 == null ? void 0 : chart2.canvas.removeEventListener(MouseEvents.MOUSEUP, () => {
26363
26367
  });
26364
- canvas2.dataset.annotationDraggerInitialized = "";
26368
+ chart2.canvas.dataset.annotationDraggerInitialized = "";
26365
26369
  }
26366
26370
  }
26367
26371
  }