-
Notifications
You must be signed in to change notification settings - Fork 41
#754 Rotate and flip for selected #1297
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
Conversation
…ext menu Co-authored-by: thekingofcity <[email protected]>
|
@copilot There is no need to update any attributes in the node's type, only updating x and y of a node should suffice. I also see a conflict in shortcuts |
Co-authored-by: thekingofcity <[email protected]>
Updated to keep |
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.
Pull request overview
This PR implements rotate and flip transformations for selected nodes with keyboard shortcuts and context menu controls. The feature allows users to rotate nodes clockwise (default 45°, or 5° with Alt key) using the 'r' shortcut, or rotate/flip via the context menu with various options (±45° rotation, vertical/horizontal/diagonal flips).
Changes:
- Added transform utilities (
rotateSelectedNodes,flipSelectedNodes) that modify node coordinates through geometric transformations - Implemented 'r' keyboard shortcut for clockwise rotation with Alt modifier for fine control
- Extended context menu with rotate (±45°) and flip (vertical, horizontal, 45°, 135°) options
- Updated settings documentation and i18n strings across all supported languages (en, zh-Hans, zh-Hant, ko, ja)
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/transform.ts | New utility file implementing rotation and flip transformations using geometric formulas |
| src/util/transform.test.ts | Test suite covering rotation and flip operations with basic scenarios |
| src/components/svg-wrapper.tsx | Added 'r' keyboard shortcut handler for rotation with Alt modifier support |
| src/components/context-menu.tsx | Added rotate/flip menu items with proper enable/disable logic, refactored handlePlaceDown for readability |
| src/components/page-header/settings-modal.tsx | Added 'r' shortcut documentation in settings UI |
| src/i18n/translations/en.json | Added English strings for rotate/flip actions and shortcut description |
| src/i18n/translations/zh-Hans.json | Added Simplified Chinese translations |
| src/i18n/translations/zh-Hant.json | Added Traditional Chinese translations |
| src/i18n/translations/ko.json | Added Korean translations |
| src/i18n/translations/ja.json | Added Japanese translations |
| package-lock.json | Peer dependency reorganization from npm install |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: thekingofcity <[email protected]>
Adds keyboard and context-menu controls to rotate selected nodes and flip them across common axes/diagonals, keeping rotations strictly to x/y coordinate changes.
rotateSelectedNodesandflipSelectedNodesnow only adjust node coordinates (no type-specific rotate metadata).rfor clockwise rotation (Alt for 5° steps);eremains for line start toggling andqis unused.rshortcut.Screenshot: https://github.com/user-attachments/assets/45b8a6ee-2104-445c-b522-8aa607f4f76e
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.