@oliasoft-open-source/charts-library 4.4.6 → 4.5.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 +25 -11
- package/dist/index.js.map +1 -1
- package/dist/src/components/common/common.interface.d.ts +2 -0
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +1 -0
- package/dist/src/components/common/plugins/annotation-dragger-plugin/enums.d.ts +5 -0
- package/dist/src/components/line-chart/line-chart.stories.d.ts +42 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25340,6 +25340,12 @@ var AnnotationType = /* @__PURE__ */ ((AnnotationType2) => {
|
|
|
25340
25340
|
AnnotationType2["ELLIPSE"] = "ellipse";
|
|
25341
25341
|
return AnnotationType2;
|
|
25342
25342
|
})(AnnotationType || {});
|
|
25343
|
+
var DragAxis = /* @__PURE__ */ ((DragAxis2) => {
|
|
25344
|
+
DragAxis2["X"] = "x";
|
|
25345
|
+
DragAxis2["Y"] = "y";
|
|
25346
|
+
DragAxis2["Both"] = "both";
|
|
25347
|
+
return DragAxis2;
|
|
25348
|
+
})(DragAxis || {});
|
|
25343
25349
|
const handleLineEnter = (element, chart2, annotation2) => {
|
|
25344
25350
|
var _a2;
|
|
25345
25351
|
chart2.canvas.style.cursor = CursorStyle.Pointer;
|
|
@@ -26143,21 +26149,29 @@ const handleAnnotationMouseDown = (event, canvas2, scales, annotations, setDragg
|
|
|
26143
26149
|
const handleAnnotationMouseMove = (event, canvas2, scales, isDragging2, activeAnnotation, dragStartX, dragStartY, chart2) => {
|
|
26144
26150
|
if (isDragging2 && activeAnnotation) {
|
|
26145
26151
|
canvas2.style.cursor = CursorStyle.Move;
|
|
26152
|
+
const dragAxis = (activeAnnotation == null ? void 0 : activeAnnotation.dragAxis) ?? DragAxis.Both;
|
|
26146
26153
|
const { x: x2, y: y2 } = getMousePositionInCoordinates(event, canvas2, scales);
|
|
26147
26154
|
const metrics = calculateAnnotationMetricsInValues(activeAnnotation);
|
|
26148
26155
|
let newCenterX = x2 - dragStartX;
|
|
26149
26156
|
let newCenterY = y2 - dragStartY;
|
|
26150
|
-
if (
|
|
26151
|
-
|
|
26152
|
-
|
|
26153
|
-
activeAnnotation.
|
|
26154
|
-
|
|
26155
|
-
|
|
26156
|
-
|
|
26157
|
-
|
|
26158
|
-
|
|
26159
|
-
|
|
26160
|
-
|
|
26157
|
+
if (dragAxis !== DragAxis.Y) {
|
|
26158
|
+
if ((activeAnnotation == null ? void 0 : activeAnnotation.type) === AnnotationType.POINT) {
|
|
26159
|
+
activeAnnotation.xValue = newCenterX;
|
|
26160
|
+
} else if ((activeAnnotation == null ? void 0 : activeAnnotation.type) === AnnotationType.BOX) {
|
|
26161
|
+
if (!isNil(metrics == null ? void 0 : metrics.width)) {
|
|
26162
|
+
activeAnnotation.xMin = newCenterX - metrics.width / 2;
|
|
26163
|
+
activeAnnotation.xMax = newCenterX + metrics.width / 2;
|
|
26164
|
+
}
|
|
26165
|
+
}
|
|
26166
|
+
}
|
|
26167
|
+
if (dragAxis !== DragAxis.X) {
|
|
26168
|
+
if ((activeAnnotation == null ? void 0 : activeAnnotation.type) === AnnotationType.POINT) {
|
|
26169
|
+
activeAnnotation.yValue = newCenterY;
|
|
26170
|
+
} else if ((activeAnnotation == null ? void 0 : activeAnnotation.type) === AnnotationType.BOX) {
|
|
26171
|
+
if (!isNil(metrics == null ? void 0 : metrics.height)) {
|
|
26172
|
+
activeAnnotation.yMin = newCenterY - metrics.height / 2;
|
|
26173
|
+
activeAnnotation.yMax = newCenterY + metrics.height / 2;
|
|
26174
|
+
}
|
|
26161
26175
|
}
|
|
26162
26176
|
}
|
|
26163
26177
|
chart2.update();
|