Skip to content

Conversation

@duckcomfy
Copy link
Contributor

@duckcomfy duckcomfy commented Jun 3, 2025

closes #1265

Summary

This PR adds four new keyboard shortcuts (CTRL + Up/Down/Left/Right Arrow Key) (unbound by default) which allow moving selected nodes by a set number of pixels, configured by the Comfy.SnapToGrid.GridSize setting.

Video demonstration

comfy_ctrl_arrow-2025-06-03_21.35.51.webm

The shortcuts in the shortcut settings

1748979403

┆Issue is synchronized with this Notion page by Unito

closes Comfy-Org#1265

Unit tests included.

Please note that I had to add some `void` operators to unrelated code in order for Husky to accept my commit; this should not have any functional change.

Ensure `moveSelectedNodesVersionAdded` is correct before merging this commit's associated PR.
@duckcomfy duckcomfy requested review from a team as code owners June 3, 2025 20:55
import { useSearchBoxStore } from '@/stores/workspace/searchBoxStore'
import { useWorkspaceStore } from '@/stores/workspaceStore'

const moveSelectedNodesVersionAdded = '1.22.1'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure this value is not stale when merging this PR.

@christian-byrne
Copy link
Contributor

What about not setting them as keybinding and just registering the commands. Then people can set the keybinds themselves if they'd like? Otherwise the experience might be too jarring to start happening suddenly. WDYT?

Copy link
Contributor

@webfiltered webfiltered left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, looks good. I agree w/ @christian-byrne - we should not add default key bindings for this feature.

@duckcomfy
Copy link
Contributor Author

duckcomfy commented Jun 4, 2025

Thank you for the quick review, I've changed the PR so that the commands are registered without default keybinds in 77a447c 6792106

@duckcomfy duckcomfy requested a review from webfiltered June 4, 2025 06:25
@duckcomfy
Copy link
Contributor Author

Wait, apologies, I think I need to fix the tests after removing the default keybinds.

Let user set their own, otherwise the experience might be too jarring to start happening suddenly.

refactor: await the disregarded promise instead of voiding it (code unrelated to this PR, but the change was required by ESLint.)

ci: fix tests to use the commands rather than the keybinds, since I removed the default keybinds
@duckcomfy duckcomfy force-pushed the feat/move_selected_nodes_with_ctrl_arrowkey branch from 77a447c to 6792106 Compare June 4, 2025 06:44
@duckcomfy
Copy link
Contributor Author

I've fixed the test and this PR is now ready for final review.

@duckcomfy duckcomfy changed the title feat: add keyboard shortcut to move selected nodes with CTRL+ArrowKey feat: add keyboard shortcut to move selected nodes (unbound by default) Jun 4, 2025
Copy link
Contributor

@webfiltered webfiltered left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - will merge once the minor nits are in. ... and thank you!

duckcomfy and others added 2 commits June 9, 2025 19:27
remove ESLint-mandated use of `void` operator

Co-authored-by: filtered <[email protected]>
@duckcomfy duckcomfy requested a review from webfiltered June 9, 2025 17:28
@webfiltered webfiltered enabled auto-merge (squash) June 9, 2025 18:33
@duckcomfy
Copy link
Contributor Author

@webfiltered Thank you for the review. The "Socket Security: Pull Request Alerts" Github Action is queued, and I'm not sure if something is expected from either of us to get it to run.

@webfiltered
Copy link
Contributor

Yeah, weird. Nothing for it to do, though, so...

@webfiltered webfiltered disabled auto-merge June 11, 2025 13:35
@webfiltered webfiltered merged commit 995979a into Comfy-Org:main Jun 11, 2025
9 of 10 checks passed
@christian-byrne
Copy link
Contributor

In the future let's tag these types of PRs (UI/UX, product) with Design label

lordTyrion pushed a commit to playbook3d/ComfyUI_frontend that referenced this pull request Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Press CNTRL + Up/Down/Left/Right to Move Nodes

3 participants