orcasvn-react-diagrams 0.1.41 → 0.1.43
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
|
@@ -7525,6 +7525,8 @@ var getIntersectionPositions = function (pointStart, pointEnd, ele) {
|
|
|
7525
7525
|
};
|
|
7526
7526
|
//Find the first intersection point of the line starting from startPosition to endPosition on the elements
|
|
7527
7527
|
var getFirstIntersection = function (startPosition, endPosition, elements) {
|
|
7528
|
+
if (!endPosition)
|
|
7529
|
+
return undefined;
|
|
7528
7530
|
var result;
|
|
7529
7531
|
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
|
|
7530
7532
|
var element = elements_1[_i];
|
|
@@ -7737,28 +7739,6 @@ var getAbsolutePosition = function (element) {
|
|
|
7737
7739
|
};
|
|
7738
7740
|
};
|
|
7739
7741
|
//get absolute position of element
|
|
7740
|
-
var getAnchorAdjustedAbsolutePosition = function (element) {
|
|
7741
|
-
var parentElement = element.parentElement;
|
|
7742
|
-
var elemenetPositionWithTopLeftAnchor = {
|
|
7743
|
-
x: element.position.x,
|
|
7744
|
-
y: element.position.y,
|
|
7745
|
-
};
|
|
7746
|
-
if (element.positionAnchor === exports.PositioningAnchor.Center) {
|
|
7747
|
-
elemenetPositionWithTopLeftAnchor.x -= element.size.width / 2;
|
|
7748
|
-
elemenetPositionWithTopLeftAnchor.y -= element.size.height / 2;
|
|
7749
|
-
}
|
|
7750
|
-
if (!parentElement) {
|
|
7751
|
-
return __assign({}, elemenetPositionWithTopLeftAnchor);
|
|
7752
|
-
}
|
|
7753
|
-
var absoluteParentElement = getAbsolutePosition(parentElement);
|
|
7754
|
-
var x = elemenetPositionWithTopLeftAnchor.x + absoluteParentElement.x;
|
|
7755
|
-
var y = elemenetPositionWithTopLeftAnchor.y + absoluteParentElement.y;
|
|
7756
|
-
return {
|
|
7757
|
-
x: x,
|
|
7758
|
-
y: y,
|
|
7759
|
-
};
|
|
7760
|
-
};
|
|
7761
|
-
//get absolute position of element
|
|
7762
7742
|
var getPortAbsolutePosition = function (port, element) {
|
|
7763
7743
|
var elementAbsolutePosition = getAbsolutePosition(element);
|
|
7764
7744
|
return {
|
|
@@ -7772,10 +7752,15 @@ var transformAbsPositionToElementRelativePosition = function (position, element)
|
|
|
7772
7752
|
return position;
|
|
7773
7753
|
}
|
|
7774
7754
|
var absoluteParentElement = getAbsolutePosition(parentElement);
|
|
7775
|
-
|
|
7755
|
+
var result = {
|
|
7776
7756
|
x: position.x - absoluteParentElement.x,
|
|
7777
7757
|
y: position.y - absoluteParentElement.y,
|
|
7778
7758
|
};
|
|
7759
|
+
if (element.positionAnchor === exports.PositioningAnchor.Center) {
|
|
7760
|
+
result.x += element.size.width / 2;
|
|
7761
|
+
result.y += element.size.height / 2;
|
|
7762
|
+
}
|
|
7763
|
+
return result;
|
|
7779
7764
|
};
|
|
7780
7765
|
var transformAbsPositionToRelativePositionInsideElement = function (absolutePosition, parentAbsolutePosition) {
|
|
7781
7766
|
var _a, _b;
|
|
@@ -9059,6 +9044,12 @@ var automationAddPointsToLink = function (eleLink, elements, limitPoint) {
|
|
|
9059
9044
|
var nearestIntersection = firstIntersection.nearestIntersection; firstIntersection.intersectionPointsList; var intersectedElement = firstIntersection.element;
|
|
9060
9045
|
//Calculate to create a replacement point
|
|
9061
9046
|
var replacementPosition = generateSubstitutePosition(nearestIntersection, targetPosition, intersectedElement);
|
|
9047
|
+
if (!replacementPosition) {
|
|
9048
|
+
replacementPosition = {
|
|
9049
|
+
x: nearestIntersection.x,
|
|
9050
|
+
y: nearestIntersection.y
|
|
9051
|
+
};
|
|
9052
|
+
}
|
|
9062
9053
|
//Increases the number of points found by 1
|
|
9063
9054
|
numberOfPoints += 1;
|
|
9064
9055
|
//Create points with the starting point being the sourcePosition and the ending point being the newly created point
|
|
@@ -9836,16 +9827,16 @@ var Paper = function (props) {
|
|
|
9836
9827
|
if (!link.targetElement || !link.targetPort)
|
|
9837
9828
|
return null;
|
|
9838
9829
|
return (React.createElement(ElementLink, { key: link.id, id: link.id, path: link.path, sourcePosition: {
|
|
9839
|
-
x:
|
|
9840
|
-
y:
|
|
9830
|
+
x: getAbsolutePosition(link.sourceElement).x + link.sourcePort.position.x,
|
|
9831
|
+
y: getAbsolutePosition(link.sourceElement).y + link.sourcePort.position.y
|
|
9841
9832
|
}, targetPosition: {
|
|
9842
|
-
x:
|
|
9843
|
-
y:
|
|
9833
|
+
x: getAbsolutePosition(link.targetElement).x + link.targetPort.position.x,
|
|
9834
|
+
y: getAbsolutePosition(link.targetElement).y + link.targetPort.position.y
|
|
9844
9835
|
}, 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) }));
|
|
9845
9836
|
}),
|
|
9846
9837
|
(tempLink === null || tempLink === void 0 ? void 0 : tempLink.tempTargetPosition) && React.createElement(ElementLink, { id: tempLink.id, points: tempLink.points, sourcePosition: {
|
|
9847
|
-
x:
|
|
9848
|
-
y:
|
|
9838
|
+
x: getAbsolutePosition(tempLink.sourceElement).x + tempLink.sourcePort.position.x,
|
|
9839
|
+
y: getAbsolutePosition(tempLink.sourceElement).y + tempLink.sourcePort.position.y
|
|
9849
9840
|
}, targetPosition: tempLink.tempTargetPosition, container: paperContainerRef.current, markerStart: tempLink.markerStart, markerEnd: tempLink.markerEnd, markerDistanceFromPort: tempLink.markerDistanceFromPort, markerSize: tempLink.markerSize }),
|
|
9850
9841
|
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 () {
|
|
9851
9842
|
setSelectedText(text);
|
|
@@ -9995,7 +9986,6 @@ exports.findNearestProjectedPoint = findNearestProjectedPoint;
|
|
|
9995
9986
|
exports.generateSubstitutePosition = generateSubstitutePosition;
|
|
9996
9987
|
exports.generateUniqueId = generateUniqueId;
|
|
9997
9988
|
exports.getAbsolutePosition = getAbsolutePosition;
|
|
9998
|
-
exports.getAnchorAdjustedAbsolutePosition = getAnchorAdjustedAbsolutePosition;
|
|
9999
9989
|
exports.getCurvePathData = getCurvePathData;
|
|
10000
9990
|
exports.getElementRotationInfo = getElementRotationInfo;
|
|
10001
9991
|
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
|
@@ -7521,6 +7521,8 @@ var getIntersectionPositions = function (pointStart, pointEnd, ele) {
|
|
|
7521
7521
|
};
|
|
7522
7522
|
//Find the first intersection point of the line starting from startPosition to endPosition on the elements
|
|
7523
7523
|
var getFirstIntersection = function (startPosition, endPosition, elements) {
|
|
7524
|
+
if (!endPosition)
|
|
7525
|
+
return undefined;
|
|
7524
7526
|
var result;
|
|
7525
7527
|
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
|
|
7526
7528
|
var element = elements_1[_i];
|
|
@@ -7733,28 +7735,6 @@ var getAbsolutePosition = function (element) {
|
|
|
7733
7735
|
};
|
|
7734
7736
|
};
|
|
7735
7737
|
//get absolute position of element
|
|
7736
|
-
var getAnchorAdjustedAbsolutePosition = function (element) {
|
|
7737
|
-
var parentElement = element.parentElement;
|
|
7738
|
-
var elemenetPositionWithTopLeftAnchor = {
|
|
7739
|
-
x: element.position.x,
|
|
7740
|
-
y: element.position.y,
|
|
7741
|
-
};
|
|
7742
|
-
if (element.positionAnchor === PositioningAnchor.Center) {
|
|
7743
|
-
elemenetPositionWithTopLeftAnchor.x -= element.size.width / 2;
|
|
7744
|
-
elemenetPositionWithTopLeftAnchor.y -= element.size.height / 2;
|
|
7745
|
-
}
|
|
7746
|
-
if (!parentElement) {
|
|
7747
|
-
return __assign({}, elemenetPositionWithTopLeftAnchor);
|
|
7748
|
-
}
|
|
7749
|
-
var absoluteParentElement = getAbsolutePosition(parentElement);
|
|
7750
|
-
var x = elemenetPositionWithTopLeftAnchor.x + absoluteParentElement.x;
|
|
7751
|
-
var y = elemenetPositionWithTopLeftAnchor.y + absoluteParentElement.y;
|
|
7752
|
-
return {
|
|
7753
|
-
x: x,
|
|
7754
|
-
y: y,
|
|
7755
|
-
};
|
|
7756
|
-
};
|
|
7757
|
-
//get absolute position of element
|
|
7758
7738
|
var getPortAbsolutePosition = function (port, element) {
|
|
7759
7739
|
var elementAbsolutePosition = getAbsolutePosition(element);
|
|
7760
7740
|
return {
|
|
@@ -7768,10 +7748,15 @@ var transformAbsPositionToElementRelativePosition = function (position, element)
|
|
|
7768
7748
|
return position;
|
|
7769
7749
|
}
|
|
7770
7750
|
var absoluteParentElement = getAbsolutePosition(parentElement);
|
|
7771
|
-
|
|
7751
|
+
var result = {
|
|
7772
7752
|
x: position.x - absoluteParentElement.x,
|
|
7773
7753
|
y: position.y - absoluteParentElement.y,
|
|
7774
7754
|
};
|
|
7755
|
+
if (element.positionAnchor === PositioningAnchor.Center) {
|
|
7756
|
+
result.x += element.size.width / 2;
|
|
7757
|
+
result.y += element.size.height / 2;
|
|
7758
|
+
}
|
|
7759
|
+
return result;
|
|
7775
7760
|
};
|
|
7776
7761
|
var transformAbsPositionToRelativePositionInsideElement = function (absolutePosition, parentAbsolutePosition) {
|
|
7777
7762
|
var _a, _b;
|
|
@@ -9055,6 +9040,12 @@ var automationAddPointsToLink = function (eleLink, elements, limitPoint) {
|
|
|
9055
9040
|
var nearestIntersection = firstIntersection.nearestIntersection; firstIntersection.intersectionPointsList; var intersectedElement = firstIntersection.element;
|
|
9056
9041
|
//Calculate to create a replacement point
|
|
9057
9042
|
var replacementPosition = generateSubstitutePosition(nearestIntersection, targetPosition, intersectedElement);
|
|
9043
|
+
if (!replacementPosition) {
|
|
9044
|
+
replacementPosition = {
|
|
9045
|
+
x: nearestIntersection.x,
|
|
9046
|
+
y: nearestIntersection.y
|
|
9047
|
+
};
|
|
9048
|
+
}
|
|
9058
9049
|
//Increases the number of points found by 1
|
|
9059
9050
|
numberOfPoints += 1;
|
|
9060
9051
|
//Create points with the starting point being the sourcePosition and the ending point being the newly created point
|
|
@@ -9832,16 +9823,16 @@ var Paper = function (props) {
|
|
|
9832
9823
|
if (!link.targetElement || !link.targetPort)
|
|
9833
9824
|
return null;
|
|
9834
9825
|
return (React.createElement(ElementLink, { key: link.id, id: link.id, path: link.path, sourcePosition: {
|
|
9835
|
-
x:
|
|
9836
|
-
y:
|
|
9826
|
+
x: getAbsolutePosition(link.sourceElement).x + link.sourcePort.position.x,
|
|
9827
|
+
y: getAbsolutePosition(link.sourceElement).y + link.sourcePort.position.y
|
|
9837
9828
|
}, targetPosition: {
|
|
9838
|
-
x:
|
|
9839
|
-
y:
|
|
9829
|
+
x: getAbsolutePosition(link.targetElement).x + link.targetPort.position.x,
|
|
9830
|
+
y: getAbsolutePosition(link.targetElement).y + link.targetPort.position.y
|
|
9840
9831
|
}, 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) }));
|
|
9841
9832
|
}),
|
|
9842
9833
|
(tempLink === null || tempLink === void 0 ? void 0 : tempLink.tempTargetPosition) && React.createElement(ElementLink, { id: tempLink.id, points: tempLink.points, sourcePosition: {
|
|
9843
|
-
x:
|
|
9844
|
-
y:
|
|
9834
|
+
x: getAbsolutePosition(tempLink.sourceElement).x + tempLink.sourcePort.position.x,
|
|
9835
|
+
y: getAbsolutePosition(tempLink.sourceElement).y + tempLink.sourcePort.position.y
|
|
9845
9836
|
}, targetPosition: tempLink.tempTargetPosition, container: paperContainerRef.current, markerStart: tempLink.markerStart, markerEnd: tempLink.markerEnd, markerDistanceFromPort: tempLink.markerDistanceFromPort, markerSize: tempLink.markerSize }),
|
|
9846
9837
|
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 () {
|
|
9847
9838
|
setSelectedText(text);
|
|
@@ -9959,5 +9950,5 @@ var Editor = function (_a) {
|
|
|
9959
9950
|
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) }));
|
|
9960
9951
|
};
|
|
9961
9952
|
|
|
9962
|
-
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,
|
|
9953
|
+
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 };
|
|
9963
9954
|
//# sourceMappingURL=index.js.map
|