Skip to content

Commit f9b09a6

Browse files
committed
fix(canvas): single hit-Rect at symbol Group level
The transparent click-target Rect lived inside the vector branch only — D/E logo placeholders had no listenable element, so they couldn't be selected by clicking on the canvas. Hoist the Rect to the Group level so both branches share it. Both visual branches (vector glyph + dashed-box placeholder) keep listening={false}; the single Rect is the unambiguous hit area for the whole field bbox.
1 parent b52031a commit f9b09a6

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎src/components/Canvas/KonvaObject.tsx‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,13 @@ function KonvaObjectInner({
408408
onDragMove={handleDragMove}
409409
onDragEnd={handleDragEnd}
410410
>
411+
{/* Single hit area for the whole field bbox — picks up clicks
412+
both for the vector-path branch and the placeholder branch
413+
below (both of which render with listening={false}). One
414+
source of truth for "where in this Group counts as a hit"
415+
instead of duplicating a transparent Rect inside each
416+
branch. */}
417+
<Rect width={w} height={h} fill="transparent" />
411418
{vectorPath ? (() => {
412419
// Konva.Path has no fillRule prop, so the holes in ® / ©
413420
// (inner ring carved out of the outer disc) can't be
@@ -428,13 +435,6 @@ function KonvaObjectInner({
428435
const renderX = w * rel.x;
429436
const renderY = h * rel.y;
430437
return (
431-
<>
432-
{/* Hit area: a plain Rect catches clicks for the whole
433-
bbox so the user can hit anywhere in the field, not
434-
only the glyph ink. Rendered first so the visible
435-
Shape draws on top. `fill="transparent"` keeps it
436-
invisible but Konva-listenable. */}
437-
<Rect width={w} height={h} fill="transparent" />
438438
<Shape
439439
listening={false}
440440
sceneFunc={(ctx) => {
@@ -470,7 +470,6 @@ function KonvaObjectInner({
470470
ctx.restore();
471471
}}
472472
/>
473-
</>
474473
);
475474
})() : (
476475
<>

0 commit comments

Comments
 (0)