-
Notifications
You must be signed in to change notification settings - Fork 199
fix: correct rotation handle positioning during vertex rotation #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: correct rotation handle positioning during vertex rotation #592
Conversation
WalkthroughThe changes in this pull request modify the Changes
Assessment against linked issues
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
tbouffard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good job !
| const alpha = toRadians( | ||
| this.currentAlpha !== null ? this.currentAlpha : this.state.style.rotation || 0 | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: We could use the nullish coalescing operator (??) to provide a more concise and readable way to handle null and undefined values as suggested in #590
const alpha = toRadians(this.currentAlpha ?? (this.state.style.rotation ?? 0));| } | ||
|
|
||
| this.index = null; | ||
| this.currentAlpha = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Checklist
VertexHandler.currentAlphais not calculated correctly #590 and [BUG] In Handles and Stencils stories, the rotation handle is always located on the right of the vertex #482maxGraph, and you are assigned to the issue.packages/core/_tests_or a new or altered Storybook story inpackages/html/stories(an existing story may also demonstrate the change).I have added or edited necessary documentation,or no docs changes are needed.Overview
After initial PR and suggestion to try to get the behaviour like mxGraph did I figured out the problem. Issue was:
Notes
I will close previous PR since this code better resembles mxGraph initial functionality.
Videos were not provided since functionality is the same as previous PR, not point in recording again. If needed, I can provide videos.
Closes #482
Closes #590
Screenshots
Both stencils and handles stories now properly work while rotating:
handles.mov
stencils.mov
Summary by CodeRabbit
Summary by CodeRabbit
New Features
currentAlphaproperty, allowing it to represent an uninitialized state.Bug Fixes
currentAlphato ensure calculations accommodate potential null values, enhancing robustness.