@oliasoft-open-source/charts-library 4.7.7-beta-15 → 4.7.7-beta-17

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
@@ -26203,6 +26203,15 @@ const useChartState = ({
26203
26203
  persistenceId,
26204
26204
  generatedDatasets
26205
26205
  }) => {
26206
+ useEffect(() => {
26207
+ return () => {
26208
+ if (chartRef == null ? void 0 : chartRef.current) {
26209
+ const chart2 = chartRef == null ? void 0 : chartRef.current;
26210
+ console.log("DESTROY");
26211
+ chart2 == null ? void 0 : chart2.destroy();
26212
+ }
26213
+ };
26214
+ }, []);
26206
26215
  const memoState = useMemo(() => state, [state]);
26207
26216
  const memoOptions = useMemo(() => options, [options]);
26208
26217
  const {
@@ -26622,21 +26631,11 @@ const handleAnnotationMouseUp = (isDragging2, activeAnnotation, chart2, canvas2,
26622
26631
  setAnnotationBorderWidth(chart2, annotationId, BORDER_WIDTH.ZERO);
26623
26632
  const { centerX = -1, centerY = -1 } = calculateAnnotationMetricsInValues(activeAnnotation) ?? {};
26624
26633
  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);
26634
+ console.log("onDragEnd");
26635
+ activeAnnotation == null ? void 0 : activeAnnotation.onDragEnd(
26636
+ { x: centerX, y: centerY },
26637
+ activeAnnotation
26638
+ );
26640
26639
  }
26641
26640
  if (!isNil(canvas2) && !isNil(canvas2.style)) {
26642
26641
  canvas2.style.cursor = CursorStyle.Pointer;
@@ -26781,13 +26780,17 @@ const annotationDraggerPlugin = {
26781
26780
  });
26782
26781
  canvas2.addEventListener(MouseEvents.MOUSEUP, (event) => {
26783
26782
  const canvasEvent = event.currentTarget;
26784
- handleAnnotationMouseUp(
26785
- isDragging2,
26786
- activeAnnotation,
26787
- chart2,
26788
- canvasEvent,
26789
- setDraggingState
26783
+ const handleAnnotationMouseUpDebounce = debounce$3(
26784
+ () => handleAnnotationMouseUp(
26785
+ isDragging2,
26786
+ activeAnnotation,
26787
+ chart2,
26788
+ canvasEvent,
26789
+ setDraggingState
26790
+ ),
26791
+ 5
26790
26792
  );
26793
+ handleAnnotationMouseUpDebounce();
26791
26794
  });
26792
26795
  canvas2.dataset.annotationDraggerInitialized = "true";
26793
26796
  }