From 0b2764028f91533a630cbb9b5fbbf5693f5668c6 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Thu, 25 Nov 2021 18:56:12 +0100 Subject: [PATCH] update(nodes): watch nodes width for dimension update * add force param to setElements, if set we clear the elements arr (default true) * wait for store watcher until store is ready (i.e. a state has been set) * move renderer css class to Renderer.vue Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> --- examples/Stress/StressExample.vue | 3 +++ src/components/Nodes/NodeWrapper.vue | 17 +++++++++----- src/container/Renderer/Renderer.vue | 10 ++++----- src/container/VueFlow/VueFlow.vue | 33 +++++++++++++++------------- src/container/ZoomPane/ZoomPane.vue | 2 +- src/store/stateStore.ts | 3 ++- src/style.css | 5 +++++ src/types/store.ts | 2 +- src/utils/graph.ts | 3 +-- 9 files changed, 46 insertions(+), 32 deletions(-) diff --git a/examples/Stress/StressExample.vue b/examples/Stress/StressExample.vue index 66675ebf..c6396d6e 100644 --- a/examples/Stress/StressExample.vue +++ b/examples/Stress/StressExample.vue @@ -17,8 +17,10 @@ import { const buttonWrapperStyles: CSSProperties = { position: 'absolute', right: 10, top: 10, zIndex: 4 } +const instance = ref() const onLoad = (flowInstance: FlowInstance) => { flowInstance.fitView() + instance.value = flowInstance console.log(flowInstance.getElements()) } @@ -46,6 +48,7 @@ const updatePos = () => { const updateElements = () => { const grid = Math.ceil(Math.random() * 10) elements.value = getElements(grid, grid) + setTimeout(() => instance.value.fitView({ padding: 0.5 })) }