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

View File

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