From df72b38f60163de7af205b049705ae38937e44b6 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Fri, 8 Mar 2024 19:59:15 +0400 Subject: [PATCH] Visualizations fixes follow-up (#9252) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addressing review suggestions from #9130 - Removing `N` binding - Removing duplicated `Toggle fullscreen vis` binding A few important differences from the suggested implementation: 1. There is no easy way to implement `nextType` on GraphEditor – we simply don’t have the required API 2. The keydown handler in `GraphVisualization` must be defined on window level still, otherwise it won’t get keydown events unless visualization is focused, and thus `nextType` won’t work because of (1) No visual changes to the IDE. --- app/gui2/src/bindings.ts | 2 -- app/gui2/src/components/GraphEditor.vue | 14 -------------- .../components/GraphEditor/GraphVisualization.vue | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/app/gui2/src/bindings.ts b/app/gui2/src/bindings.ts index c7a21460aa..a9a6aa93d6 100644 --- a/app/gui2/src/bindings.ts +++ b/app/gui2/src/bindings.ts @@ -22,9 +22,7 @@ export const graphBindings = defineKeybinds('graph-editor', { redo: ['Mod+Y', 'Mod+Shift+Z'], dragScene: ['PointerAux', 'Mod+PointerMain'], openComponentBrowser: ['Enter'], - newNode: ['N'], toggleVisualization: ['Space'], - toggleVisualizationFullscreen: ['Shift+Space'], deleteSelected: ['OsDelete'], zoomToSelected: ['Mod+Shift+A'], selectAll: ['Mod+A'], diff --git a/app/gui2/src/components/GraphEditor.vue b/app/gui2/src/components/GraphEditor.vue index f8c6d1f7d0..f4372ca0ce 100644 --- a/app/gui2/src/components/GraphEditor.vue +++ b/app/gui2/src/components/GraphEditor.vue @@ -230,12 +230,6 @@ const graphBindingsHandler = graphBindings.handler({ showComponentBrowser() } }, - newNode() { - if (keyboardBusy()) return false - if (graphNavigator.sceneMousePos != null) { - graphStore.createNode(graphNavigator.sceneMousePos, 'hello "world"! 123 + x') - } - }, deleteSelected() { graphStore.transact(() => { graphStore.deleteNodes([...nodeSelection.selected]) @@ -267,14 +261,6 @@ const graphBindingsHandler = graphBindings.handler({ } }) }, - toggleVisualizationFullscreen() { - if (nodeSelection.selected.size !== 1) return - graphStore.transact(() => { - const selected = set.first(nodeSelection.selected) - const isFullscreen = graphStore.db.nodeIdToNode.get(selected)?.vis?.fullscreen - graphStore.setNodeVisualization(selected, { visible: true, fullscreen: !isFullscreen }) - }) - }, copyNode() { if (keyboardBusy()) return false copyNodeContent() diff --git a/app/gui2/src/components/GraphEditor/GraphVisualization.vue b/app/gui2/src/components/GraphEditor/GraphVisualization.vue index 8f737fdbec..06c7bce5ba 100644 --- a/app/gui2/src/components/GraphEditor/GraphVisualization.vue +++ b/app/gui2/src/components/GraphEditor/GraphVisualization.vue @@ -338,7 +338,7 @@ const keydownHandler = visualizationBindings.handler({ }, }) -useEvent(window, 'keydown', (event) => keydownHandler(event)) +useEvent(window, 'keydown', keydownHandler) watch( () => props.isFullscreen,