Comfy-Org / ComfyUI_frontend

Official front-end implementation of ComfyUI
https://www.comfy.org/
GNU General Public License v3.0
605 stars 109 forks source link

[Feature Request]: Pan / Select mode switch with "Space" key #1011

Closed huchenlei closed 1 month ago

huchenlei commented 1 month ago

Is there an existing issue for this?

What would your feature do ?

In design softwares like Photoshop, there are 2 modes to interact with the canvas:

Currently panning is achieved by dragging on empty space of the canvas, but this can be hard if the nodes / objects on the canvas are too congested.

Proposed workflow

When "Space" is pressed and hold, enter Pan mode, otherwise enter select mode

Additional information

Related issues:

huchenlei commented 1 month ago

Litegraph supports this feature already but it is not visually explicit to users.

ronan36880 commented 1 month ago

Would this be implemented as a setting? At the moment holding "Space" grabs the canvas and immediately moves it, which I do make use of.

huchenlei commented 1 month ago

After some experiment, the current litegraph impl is not very ideal, as if you hold space and move mouse without mouse down, it still drags the canvas.

I think the first step is to change cursor shape to give visual indicator that we are in dragging mode.

ronan36880 commented 1 month ago

After some experiment, the current litegraph impl is not very ideal, as if you hold space and move mouse without mouse down, it still drags the canvas.

I think the first step is to change cursor shape to give visual indicator that we are in dragging mode.

Fair, although I will say the current litegraph implementation has its uses. An example that comes to mind is when using drawing tablets. You can, for example, configure the pen button to press the spacebar key and it'd let the user move through the canvas.

I do make use of the current pan implementation using a mouse and keyboard, and after getting used to it, I would say that it helps not having to also click with the mouse.

huchenlei commented 1 month ago

After some experiment, the current litegraph impl is not very ideal, as if you hold space and move mouse without mouse down, it still drags the canvas. I think the first step is to change cursor shape to give visual indicator that we are in dragging mode.

Fair, although I will say the current litegraph implementation has its uses. An example that comes to mind is when using drawing tablets. You can, for example, configure the pen button to press the spacebar key and it'd let the user move through the canvas.

I do make use of the current pan implementation using a mouse and keyboard, and after getting used to it, I would say that it helps not having to also click with the mouse.

Current pan impl has major issue if your cursor hovers on any DOM widget, i.e. mostly textarea on CLIPTextEncode nodes. The drag event is not properly handled by litegraph in this situation and can cause jank.