orcasvn-react-diagrams 0.1.42 → 0.1.44
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
|
@@ -1248,7 +1248,6 @@ var SelectionFrame = function (props) {
|
|
|
1248
1248
|
var newX = mousePosition.x + xFromMouse;
|
|
1249
1249
|
var newY = mousePosition.y + yFromMouse;
|
|
1250
1250
|
if (propOnMove) {
|
|
1251
|
-
console.log('newX', newX, 'newY', newY);
|
|
1252
1251
|
setX(newX);
|
|
1253
1252
|
setY(newY);
|
|
1254
1253
|
propOnMove(newX, newY);
|
|
@@ -7739,28 +7738,6 @@ var getAbsolutePosition = function (element) {
|
|
|
7739
7738
|
};
|
|
7740
7739
|
};
|
|
7741
7740
|
//get absolute position of element
|
|
7742
|
-
var getAnchorAdjustedAbsolutePosition = function (element) {
|
|
7743
|
-
var parentElement = element.parentElement;
|
|
7744
|
-
var elemenetPositionWithTopLeftAnchor = {
|
|
7745
|
-
x: element.position.x,
|
|
7746
|
-
y: element.position.y,
|
|
7747
|
-
};
|
|
7748
|
-
if (element.positionAnchor === exports.PositioningAnchor.Center) {
|
|
7749
|
-
elemenetPositionWithTopLeftAnchor.x -= element.size.width / 2;
|
|
7750
|
-
elemenetPositionWithTopLeftAnchor.y -= element.size.height / 2;
|
|
7751
|
-
}
|
|
7752
|
-
if (!parentElement) {
|
|
7753
|
-
return __assign({}, elemenetPositionWithTopLeftAnchor);
|
|
7754
|
-
}
|
|
7755
|
-
var absoluteParentElement = getAbsolutePosition(parentElement);
|
|
7756
|
-
var x = elemenetPositionWithTopLeftAnchor.x + absoluteParentElement.x;
|
|
7757
|
-
var y = elemenetPositionWithTopLeftAnchor.y + absoluteParentElement.y;
|
|
7758
|
-
return {
|
|
7759
|
-
x: x,
|
|
7760
|
-
y: y,
|
|
7761
|
-
};
|
|
7762
|
-
};
|
|
7763
|
-
//get absolute position of element
|
|
7764
7741
|
var getPortAbsolutePosition = function (port, element) {
|
|
7765
7742
|
var elementAbsolutePosition = getAbsolutePosition(element);
|
|
7766
7743
|
return {
|
|
@@ -7774,10 +7751,15 @@ var transformAbsPositionToElementRelativePosition = function (position, element)
|
|
|
7774
7751
|
return position;
|
|
7775
7752
|
}
|
|
7776
7753
|
var absoluteParentElement = getAbsolutePosition(parentElement);
|
|
7777
|
-
|
|
7754
|
+
var result = {
|
|
7778
7755
|
x: position.x - absoluteParentElement.x,
|
|
7779
7756
|
y: position.y - absoluteParentElement.y,
|
|
7780
7757
|
};
|
|
7758
|
+
if (element.positionAnchor === exports.PositioningAnchor.Center) {
|
|
7759
|
+
result.x += element.size.width / 2;
|
|
7760
|
+
result.y += element.size.height / 2;
|
|
7761
|
+
}
|
|
7762
|
+
return result;
|
|
7781
7763
|
};
|
|
7782
7764
|
var transformAbsPositionToRelativePositionInsideElement = function (absolutePosition, parentAbsolutePosition) {
|
|
7783
7765
|
var _a, _b;
|
|
@@ -9844,16 +9826,16 @@ var Paper = function (props) {
|
|
|
9844
9826
|
if (!link.targetElement || !link.targetPort)
|
|
9845
9827
|
return null;
|
|
9846
9828
|
return (React.createElement(ElementLink, { key: link.id, id: link.id, path: link.path, sourcePosition: {
|
|
9847
|
-
x:
|
|
9848
|
-
y:
|
|
9829
|
+
x: getAbsolutePosition(link.sourceElement).x + link.sourcePort.position.x,
|
|
9830
|
+
y: getAbsolutePosition(link.sourceElement).y + link.sourcePort.position.y
|
|
9849
9831
|
}, targetPosition: {
|
|
9850
|
-
x:
|
|
9851
|
-
y:
|
|
9832
|
+
x: getAbsolutePosition(link.targetElement).x + link.targetPort.position.x,
|
|
9833
|
+
y: getAbsolutePosition(link.targetElement).y + link.targetPort.position.y
|
|
9852
9834
|
}, points: link.points, onPathChanged: handlePathChange, onClickDelete: handleClickLinkDelete(link, index), onSelected: function () { return handleSelectLink(link); }, onDeselected: function () { return handleDeselectLink(); }, container: paperContainerRef.current, markerStart: link.markerStart, markerEnd: link.markerEnd, markerDistanceFromPort: link.markerDistanceFromPort, markerSize: link.markerSize, label: link.label, sourceLabel: link.sourceLabel, targetLabel: link.targetLabel, onLabelMoved: onLabelMoved(index), onLabelResized: onLabelResized(index), onLabelContentChanged: onLabelContentChanged(index) }));
|
|
9853
9835
|
}),
|
|
9854
9836
|
(tempLink === null || tempLink === void 0 ? void 0 : tempLink.tempTargetPosition) && React.createElement(ElementLink, { id: tempLink.id, points: tempLink.points, sourcePosition: {
|
|
9855
|
-
x:
|
|
9856
|
-
y:
|
|
9837
|
+
x: getAbsolutePosition(tempLink.sourceElement).x + tempLink.sourcePort.position.x,
|
|
9838
|
+
y: getAbsolutePosition(tempLink.sourceElement).y + tempLink.sourcePort.position.y
|
|
9857
9839
|
}, targetPosition: tempLink.tempTargetPosition, container: paperContainerRef.current, markerStart: tempLink.markerStart, markerEnd: tempLink.markerEnd, markerDistanceFromPort: tempLink.markerDistanceFromPort, markerSize: tempLink.markerSize }),
|
|
9858
9840
|
texts.map(function (text, index) { return (React.createElement(Text$1, { key: text.id, id: text.id, x: text.position.x, y: text.position.y, width: text.size.width, height: text.size.height, editable: text.editable, fontSize: text.fontSize, border: text.border, container: paperContainerRef.current, content: text.content, align: text.align, onSelected: function () {
|
|
9859
9841
|
setSelectedText(text);
|
|
@@ -10003,7 +9985,6 @@ exports.findNearestProjectedPoint = findNearestProjectedPoint;
|
|
|
10003
9985
|
exports.generateSubstitutePosition = generateSubstitutePosition;
|
|
10004
9986
|
exports.generateUniqueId = generateUniqueId;
|
|
10005
9987
|
exports.getAbsolutePosition = getAbsolutePosition;
|
|
10006
|
-
exports.getAnchorAdjustedAbsolutePosition = getAnchorAdjustedAbsolutePosition;
|
|
10007
9988
|
exports.getCurvePathData = getCurvePathData;
|
|
10008
9989
|
exports.getElementRotationInfo = getElementRotationInfo;
|
|
10009
9990
|
exports.getFirstIntersection = getFirstIntersection;
|
|
@@ -48,7 +48,6 @@ export declare const generateSubstitutePosition: (intersectedPosition: IPosition
|
|
|
48
48
|
export declare const getRelativePosition: (clientPosition: IPosition, relativeElement: Element) => IPosition;
|
|
49
49
|
export declare const getFourVertexesOfBBoxFromElement: (element: IElement) => IPosition[];
|
|
50
50
|
export declare const getAbsolutePosition: (element: IElement) => IPosition;
|
|
51
|
-
export declare const getAnchorAdjustedAbsolutePosition: (element: IElement) => IPosition;
|
|
52
51
|
export declare const getPortAbsolutePosition: (port: IPort, element: IElement) => IPosition;
|
|
53
52
|
export declare const transformAbsPositionToElementRelativePosition: (position: IPosition, element: IElement) => IPosition;
|
|
54
53
|
export declare const transformAbsPositionToRelativePositionInsideElement: (absolutePosition: IPosition, parentAbsolutePosition?: IPosition) => IPosition;
|
package/dist/esm/index.js
CHANGED
|
@@ -1244,7 +1244,6 @@ var SelectionFrame = function (props) {
|
|
|
1244
1244
|
var newX = mousePosition.x + xFromMouse;
|
|
1245
1245
|
var newY = mousePosition.y + yFromMouse;
|
|
1246
1246
|
if (propOnMove) {
|
|
1247
|
-
console.log('newX', newX, 'newY', newY);
|
|
1248
1247
|
setX(newX);
|
|
1249
1248
|
setY(newY);
|
|
1250
1249
|
propOnMove(newX, newY);
|
|
@@ -7735,28 +7734,6 @@ var getAbsolutePosition = function (element) {
|
|
|
7735
7734
|
};
|
|
7736
7735
|
};
|
|
7737
7736
|
//get absolute position of element
|
|
7738
|
-
var getAnchorAdjustedAbsolutePosition = function (element) {
|
|
7739
|
-
var parentElement = element.parentElement;
|
|
7740
|
-
var elemenetPositionWithTopLeftAnchor = {
|
|
7741
|
-
x: element.position.x,
|
|
7742
|
-
y: element.position.y,
|
|
7743
|
-
};
|
|
7744
|
-
if (element.positionAnchor === PositioningAnchor.Center) {
|
|
7745
|
-
elemenetPositionWithTopLeftAnchor.x -= element.size.width / 2;
|
|
7746
|
-
elemenetPositionWithTopLeftAnchor.y -= element.size.height / 2;
|
|
7747
|
-
}
|
|
7748
|
-
if (!parentElement) {
|
|
7749
|
-
return __assign({}, elemenetPositionWithTopLeftAnchor);
|
|
7750
|
-
}
|
|
7751
|
-
var absoluteParentElement = getAbsolutePosition(parentElement);
|
|
7752
|
-
var x = elemenetPositionWithTopLeftAnchor.x + absoluteParentElement.x;
|
|
7753
|
-
var y = elemenetPositionWithTopLeftAnchor.y + absoluteParentElement.y;
|
|
7754
|
-
return {
|
|
7755
|
-
x: x,
|
|
7756
|
-
y: y,
|
|
7757
|
-
};
|
|
7758
|
-
};
|
|
7759
|
-
//get absolute position of element
|
|
7760
7737
|
var getPortAbsolutePosition = function (port, element) {
|
|
7761
7738
|
var elementAbsolutePosition = getAbsolutePosition(element);
|
|
7762
7739
|
return {
|
|
@@ -7770,10 +7747,15 @@ var transformAbsPositionToElementRelativePosition = function (position, element)
|
|
|
7770
7747
|
return position;
|
|
7771
7748
|
}
|
|
7772
7749
|
var absoluteParentElement = getAbsolutePosition(parentElement);
|
|
7773
|
-
|
|
7750
|
+
var result = {
|
|
7774
7751
|
x: position.x - absoluteParentElement.x,
|
|
7775
7752
|
y: position.y - absoluteParentElement.y,
|
|
7776
7753
|
};
|
|
7754
|
+
if (element.positionAnchor === PositioningAnchor.Center) {
|
|
7755
|
+
result.x += element.size.width / 2;
|
|
7756
|
+
result.y += element.size.height / 2;
|
|
7757
|
+
}
|
|
7758
|
+
return result;
|
|
7777
7759
|
};
|
|
7778
7760
|
var transformAbsPositionToRelativePositionInsideElement = function (absolutePosition, parentAbsolutePosition) {
|
|
7779
7761
|
var _a, _b;
|
|
@@ -9840,16 +9822,16 @@ var Paper = function (props) {
|
|
|
9840
9822
|
if (!link.targetElement || !link.targetPort)
|
|
9841
9823
|
return null;
|
|
9842
9824
|
return (React.createElement(ElementLink, { key: link.id, id: link.id, path: link.path, sourcePosition: {
|
|
9843
|
-
x:
|
|
9844
|
-
y:
|
|
9825
|
+
x: getAbsolutePosition(link.sourceElement).x + link.sourcePort.position.x,
|
|
9826
|
+
y: getAbsolutePosition(link.sourceElement).y + link.sourcePort.position.y
|
|
9845
9827
|
}, targetPosition: {
|
|
9846
|
-
x:
|
|
9847
|
-
y:
|
|
9828
|
+
x: getAbsolutePosition(link.targetElement).x + link.targetPort.position.x,
|
|
9829
|
+
y: getAbsolutePosition(link.targetElement).y + link.targetPort.position.y
|
|
9848
9830
|
}, points: link.points, onPathChanged: handlePathChange, onClickDelete: handleClickLinkDelete(link, index), onSelected: function () { return handleSelectLink(link); }, onDeselected: function () { return handleDeselectLink(); }, container: paperContainerRef.current, markerStart: link.markerStart, markerEnd: link.markerEnd, markerDistanceFromPort: link.markerDistanceFromPort, markerSize: link.markerSize, label: link.label, sourceLabel: link.sourceLabel, targetLabel: link.targetLabel, onLabelMoved: onLabelMoved(index), onLabelResized: onLabelResized(index), onLabelContentChanged: onLabelContentChanged(index) }));
|
|
9849
9831
|
}),
|
|
9850
9832
|
(tempLink === null || tempLink === void 0 ? void 0 : tempLink.tempTargetPosition) && React.createElement(ElementLink, { id: tempLink.id, points: tempLink.points, sourcePosition: {
|
|
9851
|
-
x:
|
|
9852
|
-
y:
|
|
9833
|
+
x: getAbsolutePosition(tempLink.sourceElement).x + tempLink.sourcePort.position.x,
|
|
9834
|
+
y: getAbsolutePosition(tempLink.sourceElement).y + tempLink.sourcePort.position.y
|
|
9853
9835
|
}, targetPosition: tempLink.tempTargetPosition, container: paperContainerRef.current, markerStart: tempLink.markerStart, markerEnd: tempLink.markerEnd, markerDistanceFromPort: tempLink.markerDistanceFromPort, markerSize: tempLink.markerSize }),
|
|
9854
9836
|
texts.map(function (text, index) { return (React.createElement(Text$1, { key: text.id, id: text.id, x: text.position.x, y: text.position.y, width: text.size.width, height: text.size.height, editable: text.editable, fontSize: text.fontSize, border: text.border, container: paperContainerRef.current, content: text.content, align: text.align, onSelected: function () {
|
|
9855
9837
|
setSelectedText(text);
|
|
@@ -9967,5 +9949,5 @@ var Editor = function (_a) {
|
|
|
9967
9949
|
return (React.createElement(Paper$1, { key: "paper", size: { width: width, height: height }, elements: elements, links: links, texts: texts, onPaperClicked: handlePaperClicked, onPortMouseDown: handlePortMouseDown, onPortMouseUp: handlePortMouseUp, onPortMoved: handlePortMoved, onPortSelected: handlePortSelected, onElementContextMenu: handleElementContextMenu, onElementMoved: handleElementMoved, onElementResized: handleElementResized, onElementSelected: handleElementSelected, onElementMouseLeave: handleElementMouseLeave, onElementMouseMove: handleElementMouseMove, onElementMouseUp: handleElementMouseUp, onElementsChanged: handleElementsChanged, onCreatingLink: handleOnCreatingLink, onCreatingPortByLinking: handleOnCreatingPortByLinking, onLinkSelected: handleLinkSelected, onLinksChanged: handleLinksChanged, onTextSelected: handleTextSelected, onTextsChanged: handleTextsChanged, onPaperMouseMoved: handlePaperMouseMoved, onPaperMouseUp: handlePaperMouseUp, onPaperMouseDown: handlePaperMouseDown, onManuallyTriggerRenderElement: editorContext.onManuallyTriggerRenderElement.bind(editorContext), onManuallyTriggerRenderPort: editorContext.onManuallyTriggerRenderPort.bind(editorContext) }));
|
|
9968
9950
|
};
|
|
9969
9951
|
|
|
9970
|
-
export { Circle as CircleRC, Crescent as CrescentRC, CustomShape as CustomShapeRC, EditorContext, Element$2 as Element, ElementLink$1 as ElementLink, ElementLink as ElementLinkRC, Port$1 as Port, Port as PortRC, PositioningAnchor, Rectangle as RectangleRC, RectangularFrame as RectangularFrameRC, ResizingDirection, ShapeWrapper as ShapeWrapperRC, SubObjectDirection, Text$2 as Text, TextAlign, Text$1 as TextRC, addPointToList, calculateAngleWithOx, checkPointContainsPolygon, checkPositionOnLine, checkSamePosition, configureLogger, correctPortPositionInElement, createSmoothPathString, Editor as default, degreeToRadian, diamondEdgeInsideSquare, dist, findNearestPointOnSegment, findNearestPosition, findNearestProjectedPoint, generateSubstitutePosition, generateUniqueId, getAbsolutePosition,
|
|
9952
|
+
export { Circle as CircleRC, Crescent as CrescentRC, CustomShape as CustomShapeRC, EditorContext, Element$2 as Element, ElementLink$1 as ElementLink, ElementLink as ElementLinkRC, Port$1 as Port, Port as PortRC, PositioningAnchor, Rectangle as RectangleRC, RectangularFrame as RectangularFrameRC, ResizingDirection, ShapeWrapper as ShapeWrapperRC, SubObjectDirection, Text$2 as Text, TextAlign, Text$1 as TextRC, addPointToList, calculateAngleWithOx, checkPointContainsPolygon, checkPositionOnLine, checkSamePosition, configureLogger, correctPortPositionInElement, createSmoothPathString, Editor as default, degreeToRadian, diamondEdgeInsideSquare, dist, findNearestPointOnSegment, findNearestPosition, findNearestProjectedPoint, generateSubstitutePosition, generateUniqueId, getAbsolutePosition, getCurvePathData, getElementRotationInfo, getFirstIntersection, getFourVertexesOfBBoxFromElement, getIntersectionPositions, getPortAbsolutePosition, getRectangleCorners, getRelativePosition, getRotatedRectangleCoordinates, getRotatedSVGBBox, getSVGBBoxOutsideTransformedParent, makePolygonOfElement, pathDataToD, removeDuplicatePosition, transformAbsPositionToElementRelativePosition, transformAbsPositionToRelativePositionInsideElement };
|
|
9971
9953
|
//# sourceMappingURL=index.js.map
|