Feat(canvas): Replace Rectangle tool with new Shapes tool#9082
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
|
I only did a quick test, but it works great and feels really nice to use. While I can't comment on the coding implementation since that's not really my area, from a user perspective it's intuitive and smooth. I'd really like to see these 2 improvements:
Really appreciate it. |
|
@ufuksarp Thank you for trying this PR and giving a feedback.
Seems reasonable. I'll add that.
Not sure how the hotkeys are implemented and if it is possible to cycle through modes with hotkey. |
|
I think if we’re going to implement tool hints from #9117, it would be best to merge it before this one. This way I can add the hints directly without creating an additional PR. |
dunkeroni
left a comment
There was a problem hiding this comment.
I fixed a minor weirdness around hitting Escape when also using a hotkey to pan/color-pick while drawing a shape.
Otherwise, looks good and has a lot of helpful capabilities. Good work on this.
lstein
left a comment
There was a problem hiding this comment.
Happy to see this get over the finish line!
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.(New) While drawing rects and ovals, holding Space now temporarily switches the interaction from resizing to moving the uncommitted shape, without canceling the draw.
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.Shiftto constrain to a square. HoldAltto 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
Would be best if we merge #9117 before this one.
Checklist
What's Newcopy (if doing a release after this PR)