Fix graph scrolling bug from #1021

And replicate those changes to the Svelte version.
This commit is contained in:
Keavon Chambers
2023-03-03 02:28:52 -08:00
parent a2046a51b1
commit 6139e807d0
4 changed files with 86 additions and 62 deletions
@@ -9,6 +9,7 @@ import {
UpdateNodeGraph,
UpdateNodeTypes,
UpdateNodeGraphBarLayout,
UpdateZoomWithScroll,
defaultWidgetLayout,
patchWidgetLayout,
} from "@/wasm-communication/messages";
@@ -20,6 +21,7 @@ export function createNodeGraphState(editor: Editor) {
links: [] as FrontendNodeLink[],
nodeTypes: [] as FrontendNodeType[],
nodeGraphBarLayout: defaultWidgetLayout(),
zoomWithScroll: false as boolean,
});
// Set up message subscriptions on creation
@@ -42,6 +44,12 @@ export function createNodeGraphState(editor: Editor) {
return state;
});
});
editor.subscriptions.subscribeJsMessage(UpdateZoomWithScroll, (updateZoomWithScroll) => {
update((state) => {
state.zoomWithScroll = updateZoomWithScroll.zoomWithScroll;
return state;
});
});
return {
subscribe,