refactor(core): skip updating position if extent has not changed

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-01-07 18:04:19 +01:00
committed by Braks
parent 72f9f1a069
commit 67687348f0
@@ -136,7 +136,16 @@ watch(
{ flush: 'pre', immediate: true },
)
watch([() => node.extent, () => nodeExtent], updatePosition, { flush: 'pre' })
watch(
[() => node.extent, () => nodeExtent],
([nodeExtent, globalExtent], [oldNodeExtent, oldGlobalExtent]) => {
// update position if extent has actually changed
if (nodeExtent !== oldNodeExtent || globalExtent !== oldGlobalExtent) {
updatePosition()
}
},
{ flush: 'pre' },
)
// todo: do we need to wait for initialized? Or can we clamp the position immediately?
until(() => node.initialized)