Prevent dragging of selected locked nodes

This commit is contained in:
Mitchell McCaffrey 2021-08-05 14:10:15 +10:00
parent 728790f73c
commit de1faa00df
2 changed files with 5 additions and 1 deletions

View File

@ -191,6 +191,8 @@ function Note({
return null; return null;
} }
const noteName = `note${note.locked ? "-locked" : ""}`;
return ( return (
<animated.Group <animated.Group
{...props} {...props}
@ -212,6 +214,7 @@ function Note({
onMouseEnter={handlePointerEnter} onMouseEnter={handlePointerEnter}
onMouseLeave={handlePointerLeave} onMouseLeave={handlePointerLeave}
opacity={note.visible ? noteOpacity : 0.5} opacity={note.visible ? noteOpacity : 0.5}
name={noteName}
> >
{!note.textOnly && ( {!note.textOnly && (
<Rect <Rect

View File

@ -69,7 +69,8 @@ function Selection({
if (stage) { if (stage) {
for (let item of selection.items) { for (let item of selection.items) {
const node = stage.findOne(`#${item.id}`); const node = stage.findOne(`#${item.id}`);
if (node) { // Don't drag locked nodes
if (node && !node.name().endsWith("-locked")) {
intersectingNodesRef.current.push({ intersectingNodesRef.current.push({
...item, ...item,
node, node,