Skip to content

Commit

Permalink
[#547] Fix connection point for edges in State Diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
jkcoding7 authored and prmr committed May 21, 2024
1 parent 3e50e83 commit 7d4792c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/org/jetuml/geom/Direction.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public Direction mirrored()
*
* @param pStart The start direction (exclusive)
* @param pEnd The end direction (exclusive)
* @return True if this direction represents an angle between pStart (inclusive) and pEnd (exclusive).
* @return True if this direction represents an angle between pStart (exclusive) and pEnd (exclusive).
* @pre pStart != null && pEnd != null && pStart != pEnd.
*/
public boolean isBetween( Direction pStart, Direction pEnd)
Expand Down
6 changes: 3 additions & 3 deletions src/org/jetuml/geom/GeomUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ public static Point intersectRectangle(Rectangle pRectangle, Direction pDirectio
Direction diagonalSW = diagonalNE.mirrored();
Direction diagonalNW = diagonalSE.mirrored();

if( pDirection.isBetween(diagonalNE, diagonalSE))
if( pDirection.isBetween(diagonalNE, diagonalSE.rotatedBy(1)))
{
int offset = lengthOfOpposingSide(pDirection.asAngle() - Direction.EAST.asAngle(), pRectangle.width()/2);
return new Point(pRectangle.maxX(), pRectangle.center().y() + offset);
}
else if( pDirection.isBetween(diagonalSE, diagonalSW))
else if( pDirection.isBetween(diagonalSE, diagonalSW.rotatedBy(1)))
{
int offset = lengthOfOpposingSide(pDirection.asAngle() - Direction.SOUTH.asAngle(), pRectangle.height()/2);
return new Point(pRectangle.center().x() - offset, pRectangle.maxY());
}
else if( pDirection.isBetween(diagonalSW, diagonalNW))
else if( pDirection.isBetween(diagonalSW, diagonalNW.rotatedBy(1)))
{
int offset = lengthOfOpposingSide(pDirection.asAngle() - Direction.WEST.asAngle(), pRectangle.width()/2);
return new Point(pRectangle.x(), pRectangle.center().y() - offset);
Expand Down

0 comments on commit 7d4792c

Please sign in to comment.