-
Notifications
You must be signed in to change notification settings - Fork 393
feat: add keyboard shortcut to move selected nodes (unbound by default) #4066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
webfiltered
merged 4 commits into
Comfy-Org:main
from
duckcomfy:feat/move_selected_nodes_with_ctrl_arrowkey
Jun 11, 2025
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
08f6457
feat: add keyboard shortcut to move selected nodes with CTRL+ArrowKey
6792106
fix: do not register default keybinds for moving selected nodes
fa8c35d
Update browser_tests/fixtures/ComfyPage.ts
duckcomfy ed5b899
bump new command's version number
duckcomfy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import { | |
| LGraphNode, | ||
| LiteGraph | ||
| } from '@comfyorg/litegraph' | ||
| import { Point } from '@comfyorg/litegraph' | ||
|
|
||
| import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions' | ||
| import { | ||
|
|
@@ -27,6 +28,8 @@ import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore' | |
| import { useSearchBoxStore } from '@/stores/workspace/searchBoxStore' | ||
| import { useWorkspaceStore } from '@/stores/workspaceStore' | ||
|
|
||
| const moveSelectedNodesVersionAdded = '1.22.1' | ||
|
||
|
|
||
| export function useCoreCommands(): ComfyCommand[] { | ||
| const workflowService = useWorkflowService() | ||
| const workflowStore = useWorkflowStore() | ||
|
|
@@ -58,6 +61,20 @@ export function useCoreCommands(): ComfyCommand[] { | |
| }) | ||
| } | ||
|
|
||
| const moveSelectedNodes = ( | ||
| positionUpdater: (pos: Point, gridSize: number) => Point | ||
| ) => { | ||
| const selectedNodes = getSelectedNodes() | ||
| if (selectedNodes.length === 0) return | ||
|
|
||
| const gridSize = useSettingStore().get('Comfy.SnapToGrid.GridSize') | ||
| selectedNodes.forEach((node) => { | ||
| node.pos = positionUpdater(node.pos, gridSize) | ||
| }) | ||
| app.canvas.state.selectionChanged = true | ||
| app.canvas.setDirty(true, true) | ||
| } | ||
|
|
||
| const commands = [ | ||
| { | ||
| id: 'Comfy.NewBlankWorkflow', | ||
|
|
@@ -673,6 +690,34 @@ export function useCoreCommands(): ComfyCommand[] { | |
| function: async () => { | ||
| await firebaseAuthActions.logout() | ||
| } | ||
| }, | ||
| { | ||
| id: 'Comfy.Canvas.MoveSelectedNodes.Up', | ||
| icon: 'pi pi-arrow-up', | ||
| label: 'Move Selected Nodes Up', | ||
| versionAdded: moveSelectedNodesVersionAdded, | ||
| function: () => moveSelectedNodes(([x, y], gridSize) => [x, y - gridSize]) | ||
| }, | ||
| { | ||
| id: 'Comfy.Canvas.MoveSelectedNodes.Down', | ||
| icon: 'pi pi-arrow-down', | ||
| label: 'Move Selected Nodes Down', | ||
| versionAdded: moveSelectedNodesVersionAdded, | ||
| function: () => moveSelectedNodes(([x, y], gridSize) => [x, y + gridSize]) | ||
| }, | ||
| { | ||
| id: 'Comfy.Canvas.MoveSelectedNodes.Left', | ||
| icon: 'pi pi-arrow-left', | ||
| label: 'Move Selected Nodes Left', | ||
| versionAdded: moveSelectedNodesVersionAdded, | ||
| function: () => moveSelectedNodes(([x, y], gridSize) => [x - gridSize, y]) | ||
| }, | ||
| { | ||
| id: 'Comfy.Canvas.MoveSelectedNodes.Right', | ||
| icon: 'pi pi-arrow-right', | ||
| label: 'Move Selected Nodes Right', | ||
| versionAdded: moveSelectedNodesVersionAdded, | ||
| function: () => moveSelectedNodes(([x, y], gridSize) => [x + gridSize, y]) | ||
| } | ||
| ] | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.