@oliasoft-open-source/charts-library 4.7.7-beta-6 → 4.7.7-beta-7

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
@@ -26514,7 +26514,6 @@ const setAnnotationBorderWidth = (chart2, annotationId, borderWidth) => {
26514
26514
  }
26515
26515
  };
26516
26516
  const handleAnnotationMouseDown = (event, canvas2, scales, annotations, setDraggingState, hoveredAnnotationId) => {
26517
- console.log("canvas - handleAnnotationMouseDown", canvas2);
26518
26517
  const annotation2 = hoveredAnnotationId ? annotations == null ? void 0 : annotations[hoveredAnnotationId] : null;
26519
26518
  if (!annotation2) return;
26520
26519
  const { xScaleID = "x", yScaleID = "y" } = annotation2;
@@ -26540,7 +26539,6 @@ const handleAnnotationMouseDown = (event, canvas2, scales, annotations, setDragg
26540
26539
  };
26541
26540
  const handleAnnotationMouseMove = (event, canvas2, scales, isDragging2, activeAnnotation, dragStartX, dragStartY, chart2) => {
26542
26541
  if (isDragging2 && activeAnnotation) {
26543
- console.log("canvas - handleAnnotationMouseMove", canvas2);
26544
26542
  if (!isNil(canvas2) && !isNil(canvas2.style)) {
26545
26543
  canvas2.style.cursor = CursorStyle.Move;
26546
26544
  }
@@ -26629,11 +26627,12 @@ const handleAnnotationMouseUp = (isDragging2, activeAnnotation, chart2, canvas2,
26629
26627
  activeAnnotation
26630
26628
  );
26631
26629
  }
26632
- console.log("Chart", chart2);
26633
- console.log("canvas", canvas2);
26634
- console.log("canvas.ownerDocument", canvas2.ownerDocument);
26630
+ if (!isNil(canvas2) && !isNil(canvas2.style)) {
26631
+ canvas2.style.cursor = CursorStyle.Pointer;
26632
+ }
26635
26633
  setDraggingState(false, null);
26636
- chart2.update();
26634
+ console.log(" chart?.update", chart2 == null ? void 0 : chart2.update);
26635
+ chart2 == null ? void 0 : chart2.update();
26637
26636
  }
26638
26637
  }
26639
26638
  };
@@ -26676,7 +26675,7 @@ const annotationLabel = (ctx, annotations, scales) => {
26676
26675
  const annotationDraggerPlugin = {
26677
26676
  id: "annotationDraggerPlugin",
26678
26677
  beforeDraw(chart2) {
26679
- var _a2, _b2;
26678
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
26680
26679
  let annotations = ((_b2 = (_a2 = chart2.options.plugins) == null ? void 0 : _a2.annotation) == null ? void 0 : _b2.annotations) ?? {};
26681
26680
  if (!annotations) return;
26682
26681
  annotationLabel(
@@ -26684,9 +26683,29 @@ const annotationDraggerPlugin = {
26684
26683
  annotations,
26685
26684
  chart2.scales
26686
26685
  );
26686
+ const pluginOptions = ((_d2 = (_c2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _c2.plugins) == null ? void 0 : _d2.annotationDraggerPlugin) || {
26687
+ enabled: false
26688
+ };
26689
+ if (pluginOptions.enabled) {
26690
+ if ((_f2 = (_e2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _e2.plugins) == null ? void 0 : _f2.tooltip) {
26691
+ chart2.options.plugins.tooltip.enabled = false;
26692
+ }
26693
+ chart2.options.hover = {
26694
+ mode: void 0,
26695
+ intersect: false
26696
+ };
26697
+ } else {
26698
+ if ((_h2 = (_g2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _g2.plugins) == null ? void 0 : _h2.tooltip) {
26699
+ chart2.options.plugins.tooltip.enabled = true;
26700
+ }
26701
+ chart2.options.hover = {
26702
+ mode: ChartHoverMode.Nearest,
26703
+ intersect: true
26704
+ };
26705
+ }
26687
26706
  },
26688
26707
  afterUpdate(chart2) {
26689
- var _a2, _b2, _c2, _d2;
26708
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
26690
26709
  const { canvas: canvas2, scales, hoveredAnnotationId } = chart2;
26691
26710
  const pluginOptions = ((_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.plugins) == null ? void 0 : _b2.annotationDraggerPlugin) || {
26692
26711
  enabled: false
@@ -26694,6 +26713,23 @@ const annotationDraggerPlugin = {
26694
26713
  const typedScales = { ...scales, x: scales.x, y: scales.y };
26695
26714
  let annotations = ((_d2 = (_c2 = chart2.options.plugins) == null ? void 0 : _c2.annotation) == null ? void 0 : _d2.annotations) ?? {};
26696
26715
  if (!chart2 && !annotations) return;
26716
+ if (pluginOptions.enabled) {
26717
+ if ((_f2 = (_e2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _e2.plugins) == null ? void 0 : _f2.tooltip) {
26718
+ chart2.options.plugins.tooltip.enabled = false;
26719
+ }
26720
+ chart2.options.hover = {
26721
+ mode: void 0,
26722
+ intersect: false
26723
+ };
26724
+ } else {
26725
+ if ((_h2 = (_g2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _g2.plugins) == null ? void 0 : _h2.tooltip) {
26726
+ chart2.options.plugins.tooltip.enabled = true;
26727
+ }
26728
+ chart2.options.hover = {
26729
+ mode: ChartHoverMode.Nearest,
26730
+ intersect: true
26731
+ };
26732
+ }
26697
26733
  let isDragging2 = false;
26698
26734
  let dragStartX, dragStartY;
26699
26735
  let activeAnnotation = null;