fix(core): check if position is a number and not if it's truthy

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-01-16 18:27:57 +01:00
committed by Braks
parent 23ea3d9866
commit 9e1ba45839
2 changed files with 4 additions and 5 deletions

View File

@@ -127,10 +127,10 @@ watch(
const xyzPos = {
x: newX,
y: newY,
z: zIndex + (elevateNodesOnSelect ? (node.selected ? 1000 : 0) : 0),
z: (zIndex || 0) + (elevateNodesOnSelect ? (node.selected ? 1000 : 0) : 0),
}
if (parentX && parentY) {
if (isNumber(parentX) && isNumber(parentY)) {
node.computedPosition = getXYZPos({ x: parentX, y: parentY, z: parentZ! }, xyzPos)
} else {
node.computedPosition = xyzPos
@@ -152,7 +152,7 @@ watch(
// todo: do we need to wait for initialized? Or can we clamp the position immediately?
until(() => node.initialized)
.toBe(true, { flush: 'pre' })
.toBe(true)
.then(updatePosition)
/** this re-calculates the current position, necessary for clamping by a node's extent */

View File

@@ -53,9 +53,8 @@ const connectionLineVisible = $(
let groups = $ref<ReturnType<typeof groupEdgesByZLevel>>([])
let stop: WatchStopHandle
onPaneReady(() => {
watch(
stop = watch(
[
$$(getSelectedNodes),
$$(getEdges),