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:
@@ -127,10 +127,10 @@ watch(
|
|||||||
const xyzPos = {
|
const xyzPos = {
|
||||||
x: newX,
|
x: newX,
|
||||||
y: newY,
|
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)
|
node.computedPosition = getXYZPos({ x: parentX, y: parentY, z: parentZ! }, xyzPos)
|
||||||
} else {
|
} else {
|
||||||
node.computedPosition = xyzPos
|
node.computedPosition = xyzPos
|
||||||
@@ -152,7 +152,7 @@ watch(
|
|||||||
|
|
||||||
// todo: do we need to wait for initialized? Or can we clamp the position immediately?
|
// todo: do we need to wait for initialized? Or can we clamp the position immediately?
|
||||||
until(() => node.initialized)
|
until(() => node.initialized)
|
||||||
.toBe(true, { flush: 'pre' })
|
.toBe(true)
|
||||||
.then(updatePosition)
|
.then(updatePosition)
|
||||||
|
|
||||||
/** this re-calculates the current position, necessary for clamping by a node's extent */
|
/** this re-calculates the current position, necessary for clamping by a node's extent */
|
||||||
|
|||||||
@@ -53,9 +53,8 @@ const connectionLineVisible = $(
|
|||||||
let groups = $ref<ReturnType<typeof groupEdgesByZLevel>>([])
|
let groups = $ref<ReturnType<typeof groupEdgesByZLevel>>([])
|
||||||
|
|
||||||
let stop: WatchStopHandle
|
let stop: WatchStopHandle
|
||||||
|
|
||||||
onPaneReady(() => {
|
onPaneReady(() => {
|
||||||
watch(
|
stop = watch(
|
||||||
[
|
[
|
||||||
$$(getSelectedNodes),
|
$$(getSelectedNodes),
|
||||||
$$(getEdges),
|
$$(getEdges),
|
||||||
|
|||||||
Reference in New Issue
Block a user