Feat(canvas): Replace Rectangle tool with new Shapes tool#9082
Open
DustyShoe wants to merge 17 commits intoinvoke-ai:mainfrom
Open
Feat(canvas): Replace Rectangle tool with new Shapes tool#9082DustyShoe wants to merge 17 commits intoinvoke-ai:mainfrom
DustyShoe wants to merge 17 commits intoinvoke-ai:mainfrom
Conversation
…l-with-Shapes-tool
…l-with-Shapes-tool
…l-with-Shapes-tool
…l-with-Shapes-tool
…l-with-Shapes-tool
…l-with-Shapes-tool
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.
Summary
This PR replaces the existing Rectangle tool with a new Shapes tool in the canvas toolbar.
It introduces a single Shapes tool with multiple modes in the top toolbar:
The tool supports live preview while drawing, uses the active fill color including alpha, and supports subtractive drawing with
Ctrl/Cmd, including a dedicated subtract cursor. Rect and oval support modifier-based drawing behavior, polygon supports start-point close/highlight behavior and snapping, and drawing continues correctly even when the pointer leaves the canvas.There is some intentional overlap with Lasso, because Shapes can also be used on an active Inpaint Mask layer. That said, Lasso still provides broader mask-oriented behavior: it can create a new mask layer automatically when none exists, and it remains a distinct tool with its own hotkey and dedicated masking workflow. In that sense, the overlap is acceptable: Shapes adds general-purpose filled-shape drawing across raster targets, while Lasso remains the more specialized mask-construction tool.
canvasSettingsSliceandcanvasSliceare both covered by existing schema-based persistence migrations. The newshapeTypefield has a default value, and the canvas object schema change is additive/backward-compatible, so no separate manual migration was needed.QA Instructions
Rect,Oval,Polygon, andFreehand.Ctrl/Cmdwhile drawing each shape type. Confirm the operation becomes subtractive, fully clears pixels regardless of active color alpha, and shows the minus-badge crosshair cursor.Altto draw from center. Start the drag inside the canvas, move outside the canvas bounds, and confirm preview/commit still works. PressEscmid-draw and confirm cancel.Shiftto constrain to a circle. HoldAltto draw from center. Also verify outside-canvas drag continuation andEsccancel.Shiftand verify snapping to horizontal, vertical, and 45-degree directions. PressEscto cancel.Merge Plan
Simple merge.
Checklist
What's Newcopy (if doing a release after this PR)