Arrow termination#3899
Conversation
There was a problem hiding this comment.
Code Review
This pull request improves arrow routing logic in the CSE machine. Specifically, it updates ArrowFromArrayUnit to dynamically calculate the target X coordinate based on the source center, and updates ArrowFromText to handle cases where the arrow approaches from the right. A review comment points out an edge case in ArrowFromText where the arrow could pierce the target if frameExitX falls inside it, and provides a code suggestion to safely position preTerminalX to the right of the target.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughTwo arrow routing calculations in the CSE Machine visualization are refined to compute corrected terminal X coordinates. ChangesArrow Endpoint Selection Corrections
🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
f5f54d7 to
361053f
Compare
Description
Closes #3789.
Closes #3755
Closes #3795
Root cause in ArrowFromText.calculateSteps() (else branch):
The else branch handles arrows where the target (to.x() >= from.x()) is to the right of the text. It computes:
preTerminalX = max(frameExitX, to.x() - terminalSegmentLength)
When frameExitX (the frame's right edge + 20px) extends past the closure's left edge, which happens when the closure is positioned within or just past the frame boundary — preTerminalX > to.x(). The arrow then travels right past the closure, turns down, and comes back LEFT to land at to.x() (the left edge), visually piercing through the closure.
Fix: detect when preTerminalX > to.x() (approach is from the right) and land at to.x() + to.width() (the right edge) instead. The two previous fixes to ArrowFromArrayUnit remain correct for their own scenario.
Type of change
How to test
Look at the following code from #3789 and others!
Checklist