fix: restore artboard creation and drag on canvas

Canvas.tsx: removed the `e.target === e.currentTarget` guard on the
artboard-creation click handler. The canvas has a full-size
position:absolute transform layer that intercepts all events, making
`e.target` never equal to `e.currentTarget`. Artboard creation was
silently broken for every click.

Artboard.tsx: added `onMouseDown` stopPropagation to the artboard root
div so clicks on an existing artboard don't bubble up and trigger the
creation path now that the guard is gone.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
SinachPat
2026-04-30 21:33:32 +01:00
co-authored by Claude Sonnet 4.6
parent 7ff343c5a1
commit 8514ffdc1a
2 changed files with 5 additions and 2 deletions
@@ -165,6 +165,7 @@ export function Artboard({ id, label, x, y, width, height, renderUrl }: Artboard
return (
<div
style={{ position: 'absolute', top: effectiveY, left: effectiveX }}
onMouseDown={(e) => e.stopPropagation()}
onClick={(e) => { e.stopPropagation(); selectArtboard(id); }}
>
{/* Label / drag handle */}
@@ -76,8 +76,10 @@ export function Canvas() {
return;
}
// Artboard creation tool: click on canvas to place a new artboard
if (activeTool === 'artboard' && e.target === e.currentTarget && workspaceId) {
// Artboard creation tool: click on canvas to place a new artboard.
// Note: existing artboards stop propagation on mousedown so this path
// only fires on empty canvas space.
if (activeTool === 'artboard' && workspaceId) {
const label = `Artboard ${Date.now().toString(36).slice(-4).toUpperCase()}`;
createArtboardMutation({
workspace_id: workspaceId,