From a8b522fdd8d21a1ab37732f8c6e0809ffb31c455 Mon Sep 17 00:00:00 2001 From: Joeri Exelmans Date: Thu, 9 Oct 2025 13:36:57 +0200 Subject: [PATCH] fix regression: selecting rountangle ID should not select entire rountangle --- src/VisualEditor/VisualEditor.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/VisualEditor/VisualEditor.tsx b/src/VisualEditor/VisualEditor.tsx index 61d1e0d..09debf1 100644 --- a/src/VisualEditor/VisualEditor.tsx +++ b/src/VisualEditor/VisualEditor.tsx @@ -220,6 +220,7 @@ export function VisualEditor({ast, setAST, rt, setRT, errors, setErrors}: Visual if (uid) { checkPoint(); + // if the mouse button is pressed outside of the current selection, we reset the selection to whatever shape the mouse is on let allPartsInSelection = true; for (const part of parts) { if (!(selection.find(s => s.uid === uid)?.parts || []).includes(part)) { @@ -228,8 +229,10 @@ export function VisualEditor({ast, setAST, rt, setRT, errors, setErrors}: Visual } } if (!allPartsInSelection) { - setSelection([{uid, parts, kind: "dontcare"}]); + setSelection([{uid, parts}]); } + + // start dragging setDragging({ lastMousePos: currentPointer, }); @@ -321,6 +324,7 @@ export function VisualEditor({ast, setAST, rt, setRT, errors, setErrors}: Visual const bbox = getBBoxInSvgCoords(el, refSVG.current!); return isEntirelyWithin(bbox, normalizedSS); }).filter(el => !el.classList.contains("corner")); + const uidToParts = new Map(); for (const shape of shapesInSelection) { const uid = shape.dataset.uid; @@ -761,8 +765,7 @@ export function RountangleSVG(props: {rountangle: Rountangle, selected: string[] /> {uid} + data-uid={uid}>{uid} ; }