@oliasoft-open-source/charts-library 4.7.7-beta-13 → 4.7.7-beta-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.
package/dist/index.js CHANGED
@@ -26620,9 +26620,23 @@ const handleAnnotationMouseUp = (isDragging2, activeAnnotation, chart2, canvas2,
26620
26620
  if (activeAnnotation) {
26621
26621
  const annotationId = activeAnnotation == null ? void 0 : activeAnnotation.id;
26622
26622
  setAnnotationBorderWidth(chart2, annotationId, BORDER_WIDTH.ZERO);
26623
- calculateAnnotationMetricsInValues(activeAnnotation) ?? {};
26624
- if (activeAnnotation == null ? void 0 : activeAnnotation.onDragEnd) {
26625
- console.log(activeAnnotation == null ? void 0 : activeAnnotation.onDragEnd);
26623
+ const { centerX = -1, centerY = -1 } = calculateAnnotationMetricsInValues(activeAnnotation) ?? {};
26624
+ if (!isNil(activeAnnotation == null ? void 0 : activeAnnotation.onDragEnd)) {
26625
+ try {
26626
+ console.log("Invoking onDragEnd:", {
26627
+ centerX,
26628
+ centerY,
26629
+ activeAnnotation
26630
+ });
26631
+ activeAnnotation.onDragEnd(
26632
+ { x: centerX, y: centerY },
26633
+ activeAnnotation
26634
+ );
26635
+ } catch (error) {
26636
+ console.error("Error in onDragEnd:", error, activeAnnotation);
26637
+ }
26638
+ } else {
26639
+ console.warn("onDragEnd is undefined or null:", activeAnnotation);
26626
26640
  }
26627
26641
  if (!isNil(canvas2) && !isNil(canvas2.style)) {
26628
26642
  canvas2.style.cursor = CursorStyle.Pointer;
@@ -26702,7 +26716,7 @@ const annotationDraggerPlugin = {
26702
26716
  },
26703
26717
  afterUpdate(chart2) {
26704
26718
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
26705
- const { canvas: canvas2, scales, hoveredAnnotationId } = chart2;
26719
+ const { canvas: canvas2, scales, hoveredAnnotationId } = chart2 ?? {};
26706
26720
  const pluginOptions = ((_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.plugins) == null ? void 0 : _b2.annotationDraggerPlugin) || {
26707
26721
  enabled: false
26708
26722
  };