Skip to content

Commit 8c45dca

Browse files
committed
chore(core): cleanup node wrapper
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
1 parent 616e795 commit 8c45dca

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

packages/core/src/components/Nodes/NodeWrapper.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ onUpdateNodeInternals((updateIds) => {
9090
}
9191
})
9292
93+
// clamp initial position to nodes' extent
94+
// if extent is parent, we need dimensions to properly clamp the position
95+
if (node.extent === 'parent' || (typeof node.extent === 'object' && 'range' in node.extent && node.extent.range === 'parent')) {
96+
until(() => node.initialized)
97+
.toBe(true)
98+
.then(clampPosition)
99+
}
100+
// if extent is not parent, we can clamp it immediately
101+
else {
102+
clampPosition()
103+
}
104+
93105
watchEffect(
94106
(onCleanup) => {
95107
if (!node.hidden) {
@@ -150,18 +162,6 @@ watch([() => node.extent, () => nodeExtent], ([nodeExtent, globalExtent], [oldNo
150162
}
151163
})
152164
153-
// clamp initial position to nodes' extent
154-
// if extent is parent, we need dimensions to properly clamp the position
155-
if (node.extent === 'parent' || (typeof node.extent === 'object' && 'range' in node.extent && node.extent.range === 'parent')) {
156-
until(() => node.initialized)
157-
.toBe(true)
158-
.then(clampPosition)
159-
}
160-
// if extent is not parent, we can clamp it immediately
161-
else {
162-
clampPosition()
163-
}
164-
165165
/** this re-calculates the current position, necessary for clamping by a node's extent */
166166
function clampPosition() {
167167
const nextPos = node.computedPosition

0 commit comments

Comments
 (0)