orcasvn-react-diagrams 0.1.40 → 0.1.42

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];
@@ -9059,6 +9061,12 @@ var automationAddPointsToLink = function (eleLink, elements, limitPoint) {
9059
9061
  var nearestIntersection = firstIntersection.nearestIntersection; firstIntersection.intersectionPointsList; var intersectedElement = firstIntersection.element;
9060
9062
  //Calculate to create a replacement point
9061
9063
  var replacementPosition = generateSubstitutePosition(nearestIntersection, targetPosition, intersectedElement);
9064
+ if (!replacementPosition) {
9065
+ replacementPosition = {
9066
+ x: nearestIntersection.x,
9067
+ y: nearestIntersection.y
9068
+ };
9069
+ }
9062
9070
  //Increases the number of points found by 1
9063
9071
  numberOfPoints += 1;
9064
9072
  //Create points with the starting point being the sourcePosition and the ending point being the newly created point
@@ -9343,9 +9351,10 @@ var Paper = function (props) {
9343
9351
  var rect = currentTarget.getBoundingClientRect();
9344
9352
  var offsetX = ev.clientX - rect.left;
9345
9353
  var offsetY = ev.clientY - rect.top;
9354
+ var sourceElementAbsPosition = getAbsolutePosition(tempLink.sourceElement);
9346
9355
  var sourcePosition = {
9347
- x: tempLink.sourceElement.position.x + tempLink.sourcePort.position.x,
9348
- y: tempLink.sourceElement.position.y + tempLink.sourcePort.position.y
9356
+ x: sourceElementAbsPosition.x + tempLink.sourcePort.position.x,
9357
+ y: sourceElementAbsPosition.y + tempLink.sourcePort.position.y
9349
9358
  };
9350
9359
  //reduce the position of offset to the direction of the source point 1 unit to avoid the link to reach the current mouse position
9351
9360
  var tempTargetPosition_1 = {
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];
@@ -9055,6 +9057,12 @@ var automationAddPointsToLink = function (eleLink, elements, limitPoint) {
9055
9057
  var nearestIntersection = firstIntersection.nearestIntersection; firstIntersection.intersectionPointsList; var intersectedElement = firstIntersection.element;
9056
9058
  //Calculate to create a replacement point
9057
9059
  var replacementPosition = generateSubstitutePosition(nearestIntersection, targetPosition, intersectedElement);
9060
+ if (!replacementPosition) {
9061
+ replacementPosition = {
9062
+ x: nearestIntersection.x,
9063
+ y: nearestIntersection.y
9064
+ };
9065
+ }
9058
9066
  //Increases the number of points found by 1
9059
9067
  numberOfPoints += 1;
9060
9068
  //Create points with the starting point being the sourcePosition and the ending point being the newly created point
@@ -9339,9 +9347,10 @@ var Paper = function (props) {
9339
9347
  var rect = currentTarget.getBoundingClientRect();
9340
9348
  var offsetX = ev.clientX - rect.left;
9341
9349
  var offsetY = ev.clientY - rect.top;
9350
+ var sourceElementAbsPosition = getAbsolutePosition(tempLink.sourceElement);
9342
9351
  var sourcePosition = {
9343
- x: tempLink.sourceElement.position.x + tempLink.sourcePort.position.x,
9344
- y: tempLink.sourceElement.position.y + tempLink.sourcePort.position.y
9352
+ x: sourceElementAbsPosition.x + tempLink.sourcePort.position.x,
9353
+ y: sourceElementAbsPosition.y + tempLink.sourcePort.position.y
9345
9354
  };
9346
9355
  //reduce the position of offset to the direction of the source point 1 unit to avoid the link to reach the current mouse position
9347
9356
  var tempTargetPosition_1 = {