fix regression: selecting rountangle ID should not select entire rountangle
This commit is contained in:
parent
131f82c5db
commit
a8b522fdd8
1 changed files with 6 additions and 3 deletions
|
|
@ -220,6 +220,7 @@ export function VisualEditor({ast, setAST, rt, setRT, errors, setErrors}: Visual
|
||||||
if (uid) {
|
if (uid) {
|
||||||
checkPoint();
|
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;
|
let allPartsInSelection = true;
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
if (!(selection.find(s => s.uid === uid)?.parts || []).includes(part)) {
|
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) {
|
if (!allPartsInSelection) {
|
||||||
setSelection([{uid, parts, kind: "dontcare"}]);
|
setSelection([{uid, parts}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start dragging
|
||||||
setDragging({
|
setDragging({
|
||||||
lastMousePos: currentPointer,
|
lastMousePos: currentPointer,
|
||||||
});
|
});
|
||||||
|
|
@ -321,6 +324,7 @@ export function VisualEditor({ast, setAST, rt, setRT, errors, setErrors}: Visual
|
||||||
const bbox = getBBoxInSvgCoords(el, refSVG.current!);
|
const bbox = getBBoxInSvgCoords(el, refSVG.current!);
|
||||||
return isEntirelyWithin(bbox, normalizedSS);
|
return isEntirelyWithin(bbox, normalizedSS);
|
||||||
}).filter(el => !el.classList.contains("corner"));
|
}).filter(el => !el.classList.contains("corner"));
|
||||||
|
|
||||||
const uidToParts = new Map();
|
const uidToParts = new Map();
|
||||||
for (const shape of shapesInSelection) {
|
for (const shape of shapesInSelection) {
|
||||||
const uid = shape.dataset.uid;
|
const uid = shape.dataset.uid;
|
||||||
|
|
@ -761,8 +765,7 @@ export function RountangleSVG(props: {rountangle: Rountangle, selected: string[]
|
||||||
/>
|
/>
|
||||||
<text x={10} y={20}
|
<text x={10} y={20}
|
||||||
className="uid"
|
className="uid"
|
||||||
data-uid={uid}
|
data-uid={uid}>{uid}</text>
|
||||||
data-parts="left top right bottom">{uid}</text>
|
|
||||||
</g>;
|
</g>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue