Skip to content

Commit fed81a1

Browse files
committed
Zoom into selected node
1 parent 2bebee5 commit fed81a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Frontend/src/components/messages2/FlowDiagram/FlowDiagram.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ async function layoutGraph() {
207207
nodes.value = layout(nodes.value, edges.value, showAddress.value);
208208
209209
await nextTick(() => {
210-
fitView();
210+
if (store.state.data.id) {
211+
fitView({ nodes: [store.state.data.id], maxZoom: 0.9 });
212+
}
211213
});
212214
}
213215
@@ -227,7 +229,7 @@ const errorColor = hexToCSSFilter("#be514a").filter;
227229
<div v-if="store.conversationData.failed_to_load" class="alert alert-info">FlowDiagram data is unavailable.</div>
228230
<LoadingSpinner v-else-if="store.conversationData.loading" />
229231
<div v-else id="tree-container">
230-
<VueFlow :nodes="nodes" :edges="edges" :min-zoom="0.1" :fit-view-on-init="true" :only-render-visible-elements="true" @nodes-initialized="layoutGraph">
232+
<VueFlow :nodes="nodes" :edges="edges" :min-zoom="0.1" :max-zoom="1.2" :only-render-visible-elements="true" @nodes-initialized="layoutGraph">
231233
<Controls :show-interactive="false" position="top-left" class="controls">
232234
<ControlButton v-tippy="showAddress ? `Hide endpoints` : `Show endpoints`" @click="toggleAddress">
233235
<i class="fa pa-flow-endpoint" :style="{ filter: showAddress ? greenColor : blackColor }"></i>

0 commit comments

Comments
 (0)