fix(core): wait until node is initialized to clamp when extent is parent
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -147,9 +147,13 @@ watch([() => node.extent, () => nodeExtent], ([nodeExtent, globalExtent], [oldNo
|
|||||||
})
|
})
|
||||||
|
|
||||||
// clamp initial position to nodes' extent
|
// clamp initial position to nodes' extent
|
||||||
until(() => node.initialized)
|
if (node.extent === 'parent' || typeof node.extent === 'object') {
|
||||||
.toBe(true)
|
until(() => node.initialized)
|
||||||
.then(updatePosition)
|
.toBe(true)
|
||||||
|
.then(updatePosition)
|
||||||
|
} else {
|
||||||
|
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 */
|
||||||
function updatePosition() {
|
function updatePosition() {
|
||||||
@@ -203,7 +207,7 @@ function onSelectNode(event: MouseEvent) {
|
|||||||
emit.click({ event, node, connectedEdges })
|
emit.click({ event, node, connectedEdges })
|
||||||
}
|
}
|
||||||
|
|
||||||
const onKeyDown = (event: KeyboardEvent) => {
|
function onKeyDown(event: KeyboardEvent) {
|
||||||
if (isInputDOMNode(event)) return
|
if (isInputDOMNode(event)) return
|
||||||
|
|
||||||
if (elementSelectionKeys.includes(event.key) && selectable) {
|
if (elementSelectionKeys.includes(event.key) && selectable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user