fix(nodes): trigger computedPosition watcher when selected changes

* z-index will not change back if selected does not trigger a change
This commit is contained in:
Braks
2022-04-11 11:30:10 +02:00
parent 8e3fef504c
commit 3064e287e7
2 changed files with 12 additions and 6 deletions
+8 -2
View File
@@ -57,12 +57,18 @@ onMounted(() => {
})
watch(
[() => node.value.position, () => store.getNode(node.value.parentNode!)],
[
() => node.value.position,
() => store.getNode(node.value.parentNode!)?.computedPosition,
() => node.value.selected,
() => store.getNode(node.value.parentNode!)?.selected,
],
([pos, parent]) => {
const xyzPos = {
...pos,
z: node.value.dragging || node.value.selected ? 1000 : node.value.computedPosition.z,
z: node.value.dragging || node.value.selected ? 1000 : 0,
}
if (parent) {
node.value.computedPosition = getXYZPos(parent, xyzPos)
} else {