Visualizations fixes follow-up (#9252)

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.
This commit is contained in:
Ilya Bogdanov 2024-03-08 19:59:15 +04:00 committed by GitHub
parent ee2dc57d68
commit df72b38f60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 17 deletions

View File

@ -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'],

View File

@ -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()

View File

@ -338,7 +338,7 @@ const keydownHandler = visualizationBindings.handler({
},
})
useEvent(window, 'keydown', (event) => keydownHandler(event))
useEvent(window, 'keydown', keydownHandler)
watch(
() => props.isFullscreen,