feat(canvas): add 90 deg quick-rotate button for step-rotation objects#53
Merged
Conversation
Shows a small floating rotate icon at the top-right of the selected node when exactly one step-rotation object (text, serial, all barcodes) is selected. Cycles the ZPL rotation prop N to R to I to B to N on click, so users no longer have to bounce to the properties panel for that common operation. - registry/rotation.ts: pure helpers nextZplRotation + getStepRotation - components/Canvas/RotationButton.tsx: Konva-only presentation, lucide rotate-cw glyph as inline SVG path - LabelCanvas wires the affordance via getClientRect so the button tracks the visual top-right through both object-rotation and viewRotation
There was a problem hiding this comment.
Code Review
This pull request introduces a quick-rotate button for canvas objects using step-based ZPL rotations, including the new RotationButton component and associated registry helpers. Feedback identifies a critical bug where updating the rotation might overwrite other object properties, potentially causing data loss. Additionally, the rotation button does not currently follow objects during active drag or transform interactions, and the cursor management logic lacks a cleanup mechanism to prevent the pointer from persisting after the button unmounts.
…r on unmount Addresses gemini review on PR #53: - Hide the quick-rotate button while a drag or transform is in progress. The button's position is React-state-driven and would otherwise lag behind the live Konva node until the interaction ends. - Reset the stage cursor when the button unmounts. Without this, deleting or deselecting the object while the cursor is over the button would leave the pointer stuck in 'pointer' style because onMouseLeave never fires.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shows a small floating rotate icon at the top-right of the selected node when exactly one step-rotation object (text, serial, all barcodes) is selected. Cycles the ZPL rotation prop N to R to I to B to N on click, so users no longer have to bounce to the properties panel for that common operation.