Skip to content

Add canvasNavigationMode for changing left click pan behaviour #1108

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
merged 4 commits into from
Jul 24, 2025

Conversation

jtydhr88
Copy link
Contributor

@jtydhr88 jtydhr88 commented Jul 8, 2025

Feature required in ComfyUI Project V3 https://www.notion.so/drip-art/Standardize-Canvas-Navigation-2166d73d365080c9b84ad3f7b3b265bc?d=21f6d73d3650805eb3d2001ca7e88ed6#2176d73d3650802a9457dc2affe798e0
And it will be used in ComfyUI Frontend PR here.

it will have two mode: standard and legacy.

On standard mode (this is new), we will disable dragging canvas by mouse left click pan, and move canvas will be allowed by mouse middle button or spacebar+left-click

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.

Unit test

When you receive a test error about the snapshots, it is usually because a public field has changed. In this case, it is the new property on LiteGraph global object. This guards against unintended API changes.

Please run the vitest update command:

npm run test -- -u --run

Once done, you need to manually verify that the snapshot change is exactly what you expected, then commit it.

Playwright test

This failure may be unrelated. It's complaining about a missing PyPI package for templates. Re-running.

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.

Looking great overall!

Apologies in advance - you will probably find the nits in litegraph PRs a bit stricter. Litegraph is an external library that is already written in many styles. I try to ensure code changes match a single new style as much as possible, so it's easier for everyone to work with moving forward.

p.s. I often use GH suggestions for the nits, so you can just click the commit button if it's easier.

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.

Question on recent mac change & nits.

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.

Code looks good - let's get it tested. I -think- I see some small things which might impact UX - but requires testing on Mac.

(optional reading / notes: difference moving from e.wheelDelta* / e.detail to e.deltaY - something we should definitely do, but I did not impl. because it required too much workaround code last year - this could just be solved already)

@christian-byrne
Copy link
Contributor

LGTM

@webfiltered can we merge this?

@webfiltered
Copy link
Contributor

Waiting on Comfy-Org/ComfyUI_frontend#4377 to be finalised. No point merging if it hasn't had final sign off.

@webfiltered
Copy link
Contributor

Discussed offline: This is fine to merge, but on its own does nothing for frontend. To reduce unnecessary overheads / chasing unrelated bugs, it will be merged immediately prior to the frontend PR (after subgraph + async are finalised).

@christian-byrne
Copy link
Contributor

Merging now so frontend PR can use updated types.

@christian-byrne christian-byrne merged commit 8ff5f07 into master Jul 24, 2025
4 checks passed
@christian-byrne christian-byrne deleted the canvas-nav-mode branch July 24, 2025 20:08
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.

3 participants