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:
co-authored by
Claude Sonnet 4.6
parent
7ff343c5a1
commit
8514ffdc1a
@@ -165,6 +165,7 @@ export function Artboard({ id, label, x, y, width, height, renderUrl }: Artboard
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{ position: 'absolute', top: effectiveY, left: effectiveX }}
|
style={{ position: 'absolute', top: effectiveY, left: effectiveX }}
|
||||||
|
onMouseDown={(e) => e.stopPropagation()}
|
||||||
onClick={(e) => { e.stopPropagation(); selectArtboard(id); }}
|
onClick={(e) => { e.stopPropagation(); selectArtboard(id); }}
|
||||||
>
|
>
|
||||||
{/* Label / drag handle */}
|
{/* Label / drag handle */}
|
||||||
|
|||||||
@@ -76,8 +76,10 @@ export function Canvas() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Artboard creation tool: click on canvas to place a new artboard
|
// Artboard creation tool: click on canvas to place a new artboard.
|
||||||
if (activeTool === 'artboard' && e.target === e.currentTarget && workspaceId) {
|
// 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()}`;
|
const label = `Artboard ${Date.now().toString(36).slice(-4).toUpperCase()}`;
|
||||||
createArtboardMutation({
|
createArtboardMutation({
|
||||||
workspace_id: workspaceId,
|
workspace_id: workspaceId,
|
||||||
|
|||||||
Reference in New Issue
Block a user