@oliasoft-open-source/charts-library 4.7.0-beta-8 → 4.7.0
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
|
@@ -22677,6 +22677,7 @@ const chartMinorGridlinesPlugin = {
|
|
|
22677
22677
|
}
|
|
22678
22678
|
};
|
|
22679
22679
|
const BORDER_WIDTH = {
|
|
22680
|
+
ZERO: 0,
|
|
22680
22681
|
INITIAL: 2,
|
|
22681
22682
|
HOVERED: 6,
|
|
22682
22683
|
POINT_HOVERED: 8
|
|
@@ -26490,6 +26491,14 @@ const updateAnnotationPositionWithinBounds = (axis, newPosition, activeAnnotatio
|
|
|
26490
26491
|
}
|
|
26491
26492
|
}
|
|
26492
26493
|
};
|
|
26494
|
+
const setAnnotationBorderWidth = (chart2, annotationId, borderWidth) => {
|
|
26495
|
+
var _a2, _b2, _c2;
|
|
26496
|
+
if (!annotationId) return;
|
|
26497
|
+
const annotations = (_c2 = (_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.plugins) == null ? void 0 : _b2.annotation) == null ? void 0 : _c2.annotations;
|
|
26498
|
+
if (annotations && annotationId && annotations[annotationId]) {
|
|
26499
|
+
annotations[annotationId].borderWidth = borderWidth;
|
|
26500
|
+
}
|
|
26501
|
+
};
|
|
26493
26502
|
const handleAnnotationMouseDown = (event, canvas2, scales, annotations, setDraggingState, hoveredAnnotationId) => {
|
|
26494
26503
|
const { x: x2, y: y2 } = getMousePositionInCoordinates(event, canvas2, scales);
|
|
26495
26504
|
const annotation2 = hoveredAnnotationId ? annotations == null ? void 0 : annotations[hoveredAnnotationId] : null;
|
|
@@ -26508,6 +26517,8 @@ const handleAnnotationMouseDown = (event, canvas2, scales, annotations, setDragg
|
|
|
26508
26517
|
const handleAnnotationMouseMove = (event, canvas2, scales, isDragging2, activeAnnotation, dragStartX, dragStartY, chart2) => {
|
|
26509
26518
|
if (isDragging2 && activeAnnotation) {
|
|
26510
26519
|
canvas2.style.cursor = CursorStyle.Move;
|
|
26520
|
+
const annotationId = activeAnnotation == null ? void 0 : activeAnnotation.id;
|
|
26521
|
+
setAnnotationBorderWidth(chart2, annotationId, BORDER_WIDTH.HOVERED);
|
|
26511
26522
|
const dragAxis = (activeAnnotation == null ? void 0 : activeAnnotation.dragAxis) ?? DragAxis.Both;
|
|
26512
26523
|
const { x: x2, y: y2 } = getMousePositionInCoordinates(event, canvas2, scales);
|
|
26513
26524
|
const metrics = calculateAnnotationMetricsInValues(activeAnnotation);
|
|
@@ -26566,6 +26577,8 @@ const handleAnnotationMouseMove = (event, canvas2, scales, isDragging2, activeAn
|
|
|
26566
26577
|
const handleAnnotationMouseUp = (isDragging2, activeAnnotation, chart2, setDraggingState) => {
|
|
26567
26578
|
if (isDragging2) {
|
|
26568
26579
|
if (activeAnnotation) {
|
|
26580
|
+
const annotationId = activeAnnotation == null ? void 0 : activeAnnotation.id;
|
|
26581
|
+
setAnnotationBorderWidth(chart2, annotationId, BORDER_WIDTH.ZERO);
|
|
26569
26582
|
const { centerX = -1, centerY = -1 } = calculateAnnotationMetricsInValues(activeAnnotation) ?? {};
|
|
26570
26583
|
if (activeAnnotation == null ? void 0 : activeAnnotation.onDragEnd) {
|
|
26571
26584
|
activeAnnotation.onDragEnd(
|