orcasvn-react-diagrams 0.1.46 → 0.1.47
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/cjs/index.js
CHANGED
|
@@ -1211,7 +1211,7 @@ var SelectionFrame = function (props) {
|
|
|
1211
1211
|
var _a, _b;
|
|
1212
1212
|
var propTargetSVGElement = props.targetSVGElement, propWidth = props.width, propHeight = props.height, propFramePadding = props.framePadding,
|
|
1213
1213
|
// movingOffsetThreshold: propMovingOffsetThreshold,
|
|
1214
|
-
propMovingRate = props.movingRate, propOnMove = props.onMove, propContainer = props.container, propResizability = props.resizability, propOnResize = props.onResize, PropDragDropHandlerElement = props.dragDropHandlerElement, propStrokeWidth = props.strokeWidth, propAnchor = props.anchor;
|
|
1214
|
+
propMovingRate = props.movingRate, propOnMouseDown = props.onMouseDown, propOnMouseUp = props.onMouseUp, propOnMove = props.onMove, propContainer = props.container, propResizability = props.resizability, propOnResize = props.onResize, PropDragDropHandlerElement = props.dragDropHandlerElement, propStrokeWidth = props.strokeWidth, propAnchor = props.anchor;
|
|
1215
1215
|
var bbox = propTargetSVGElement === null || propTargetSVGElement === void 0 ? void 0 : propTargetSVGElement.getBBox();
|
|
1216
1216
|
var _c = React.useState(propWidth || (bbox === null || bbox === void 0 ? void 0 : bbox.width) || MIN_ELEMENT_SIZE), width = _c[0], setWidth = _c[1];
|
|
1217
1217
|
var _d = React.useState(propHeight || (bbox === null || bbox === void 0 ? void 0 : bbox.height) || MIN_ELEMENT_SIZE), height = _d[0], setHeight = _d[1];
|
|
@@ -1247,6 +1247,9 @@ var SelectionFrame = function (props) {
|
|
|
1247
1247
|
setXFromMouse(xFromMouse_1);
|
|
1248
1248
|
setYFromMouse(yFromMouse_1);
|
|
1249
1249
|
}
|
|
1250
|
+
if (propOnMouseDown) {
|
|
1251
|
+
propOnMouseDown(event);
|
|
1252
|
+
}
|
|
1250
1253
|
};
|
|
1251
1254
|
var rectHandleMouseMove = React.useCallback(function (event) {
|
|
1252
1255
|
var mouseEvent = event;
|
|
@@ -1341,7 +1344,7 @@ var SelectionFrame = function (props) {
|
|
|
1341
1344
|
}
|
|
1342
1345
|
return (React.createElement(React.Fragment, null,
|
|
1343
1346
|
PropDragDropHandlerElement && React.createElement(PropDragDropHandlerElement, { dragging: draggingRect, onMouseDown: addRectHandleMouseDown }),
|
|
1344
|
-
React.createElement("rect", { vectorEffect: "non-scaling-stroke", x: leftX, y: topY, width: width, height: height, fill: 'none', stroke: 'blue', strokeWidth: propStrokeWidth || 5, cursor: draggingRect ? 'grabbing' : 'grab', onMouseDown: addRectHandleMouseDown }),
|
|
1347
|
+
React.createElement("rect", { vectorEffect: "non-scaling-stroke", x: leftX, y: topY, width: width, height: height, fill: 'none', stroke: 'blue', strokeWidth: propStrokeWidth || 5, cursor: draggingRect ? 'grabbing' : 'grab', onMouseDown: addRectHandleMouseDown, onMouseUp: propOnMouseUp }),
|
|
1345
1348
|
propResizability.enabled ?
|
|
1346
1349
|
(React.createElement("circle", { cursor: 'se-resize', cx: leftX + width, cy: topY + height, r: r, fill: 'blue', stroke: 'blue', onMouseDown: circleHandleMouseDown })) : null));
|
|
1347
1350
|
};
|
|
@@ -9635,6 +9638,18 @@ var Paper = function (props) {
|
|
|
9635
9638
|
width: selectedElement === null || selectedElement === void 0 ? void 0 : selectedElement.size.width,
|
|
9636
9639
|
height: selectedElement === null || selectedElement === void 0 ? void 0 : selectedElement.size.height,
|
|
9637
9640
|
//movingOffsetThreshold: ELEMENT_MOVING_OFFSET_THRESHOLD,
|
|
9641
|
+
onMouseDown: function (ev) {
|
|
9642
|
+
var _a;
|
|
9643
|
+
if (selectedElement) {
|
|
9644
|
+
(_a = props.onElementMouseDown) === null || _a === void 0 ? void 0 : _a.call(props, ev, selectedElement);
|
|
9645
|
+
}
|
|
9646
|
+
},
|
|
9647
|
+
onMouseUp: function (ev) {
|
|
9648
|
+
var _a;
|
|
9649
|
+
if (selectedElement) {
|
|
9650
|
+
(_a = props.onElementMouseUp) === null || _a === void 0 ? void 0 : _a.call(props, ev, selectedElement);
|
|
9651
|
+
}
|
|
9652
|
+
},
|
|
9638
9653
|
onMove: function (newX, newY) {
|
|
9639
9654
|
if (!selectedElement)
|
|
9640
9655
|
return;
|
|
@@ -8,6 +8,8 @@ interface ISelectionFrameProps {
|
|
|
8
8
|
width?: number;
|
|
9
9
|
height?: number;
|
|
10
10
|
targetSVGElement?: SVGSVGElement;
|
|
11
|
+
onMouseDown?: (event: React.MouseEvent<SVGRectElement>) => void;
|
|
12
|
+
onMouseUp?: (event: React.MouseEvent<SVGRectElement>) => void;
|
|
11
13
|
onMove?: (x: number, y: number) => void;
|
|
12
14
|
onResize?: (width: number, height: number) => void;
|
|
13
15
|
resizability: IResizability;
|
package/dist/esm/index.js
CHANGED
|
@@ -1207,7 +1207,7 @@ var SelectionFrame = function (props) {
|
|
|
1207
1207
|
var _a, _b;
|
|
1208
1208
|
var propTargetSVGElement = props.targetSVGElement, propWidth = props.width, propHeight = props.height, propFramePadding = props.framePadding,
|
|
1209
1209
|
// movingOffsetThreshold: propMovingOffsetThreshold,
|
|
1210
|
-
propMovingRate = props.movingRate, propOnMove = props.onMove, propContainer = props.container, propResizability = props.resizability, propOnResize = props.onResize, PropDragDropHandlerElement = props.dragDropHandlerElement, propStrokeWidth = props.strokeWidth, propAnchor = props.anchor;
|
|
1210
|
+
propMovingRate = props.movingRate, propOnMouseDown = props.onMouseDown, propOnMouseUp = props.onMouseUp, propOnMove = props.onMove, propContainer = props.container, propResizability = props.resizability, propOnResize = props.onResize, PropDragDropHandlerElement = props.dragDropHandlerElement, propStrokeWidth = props.strokeWidth, propAnchor = props.anchor;
|
|
1211
1211
|
var bbox = propTargetSVGElement === null || propTargetSVGElement === void 0 ? void 0 : propTargetSVGElement.getBBox();
|
|
1212
1212
|
var _c = React.useState(propWidth || (bbox === null || bbox === void 0 ? void 0 : bbox.width) || MIN_ELEMENT_SIZE), width = _c[0], setWidth = _c[1];
|
|
1213
1213
|
var _d = React.useState(propHeight || (bbox === null || bbox === void 0 ? void 0 : bbox.height) || MIN_ELEMENT_SIZE), height = _d[0], setHeight = _d[1];
|
|
@@ -1243,6 +1243,9 @@ var SelectionFrame = function (props) {
|
|
|
1243
1243
|
setXFromMouse(xFromMouse_1);
|
|
1244
1244
|
setYFromMouse(yFromMouse_1);
|
|
1245
1245
|
}
|
|
1246
|
+
if (propOnMouseDown) {
|
|
1247
|
+
propOnMouseDown(event);
|
|
1248
|
+
}
|
|
1246
1249
|
};
|
|
1247
1250
|
var rectHandleMouseMove = useCallback(function (event) {
|
|
1248
1251
|
var mouseEvent = event;
|
|
@@ -1337,7 +1340,7 @@ var SelectionFrame = function (props) {
|
|
|
1337
1340
|
}
|
|
1338
1341
|
return (React.createElement(React.Fragment, null,
|
|
1339
1342
|
PropDragDropHandlerElement && React.createElement(PropDragDropHandlerElement, { dragging: draggingRect, onMouseDown: addRectHandleMouseDown }),
|
|
1340
|
-
React.createElement("rect", { vectorEffect: "non-scaling-stroke", x: leftX, y: topY, width: width, height: height, fill: 'none', stroke: 'blue', strokeWidth: propStrokeWidth || 5, cursor: draggingRect ? 'grabbing' : 'grab', onMouseDown: addRectHandleMouseDown }),
|
|
1343
|
+
React.createElement("rect", { vectorEffect: "non-scaling-stroke", x: leftX, y: topY, width: width, height: height, fill: 'none', stroke: 'blue', strokeWidth: propStrokeWidth || 5, cursor: draggingRect ? 'grabbing' : 'grab', onMouseDown: addRectHandleMouseDown, onMouseUp: propOnMouseUp }),
|
|
1341
1344
|
propResizability.enabled ?
|
|
1342
1345
|
(React.createElement("circle", { cursor: 'se-resize', cx: leftX + width, cy: topY + height, r: r, fill: 'blue', stroke: 'blue', onMouseDown: circleHandleMouseDown })) : null));
|
|
1343
1346
|
};
|
|
@@ -9631,6 +9634,18 @@ var Paper = function (props) {
|
|
|
9631
9634
|
width: selectedElement === null || selectedElement === void 0 ? void 0 : selectedElement.size.width,
|
|
9632
9635
|
height: selectedElement === null || selectedElement === void 0 ? void 0 : selectedElement.size.height,
|
|
9633
9636
|
//movingOffsetThreshold: ELEMENT_MOVING_OFFSET_THRESHOLD,
|
|
9637
|
+
onMouseDown: function (ev) {
|
|
9638
|
+
var _a;
|
|
9639
|
+
if (selectedElement) {
|
|
9640
|
+
(_a = props.onElementMouseDown) === null || _a === void 0 ? void 0 : _a.call(props, ev, selectedElement);
|
|
9641
|
+
}
|
|
9642
|
+
},
|
|
9643
|
+
onMouseUp: function (ev) {
|
|
9644
|
+
var _a;
|
|
9645
|
+
if (selectedElement) {
|
|
9646
|
+
(_a = props.onElementMouseUp) === null || _a === void 0 ? void 0 : _a.call(props, ev, selectedElement);
|
|
9647
|
+
}
|
|
9648
|
+
},
|
|
9634
9649
|
onMove: function (newX, newY) {
|
|
9635
9650
|
if (!selectedElement)
|
|
9636
9651
|
return;
|