Skip to content

Add a button to selection toolbox to open mask editor #3603

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Yiximail
Copy link
Contributor

@Yiximail Yiximail commented Apr 24, 2025

image

I really can't figure out how to open the context menu on iPad. If there is a way, please let me know.

I add a button for open the mask editor in toolbox. I use this feature frequently and it's really great !

Let more people see it and use it, not just hide it in the context menu below.

┆Issue is synchronized with this Notion page by Unito

@benceruleanlu
Copy link
Collaborator

Hi @Yiximail! 👋 Thanks so much for taking the time to contribute—it's always awesome to see folks who use ComfyUI also helping improve it!

I gave this a quick test on my phone and it works great—nice work!

Just one small concern: this button would be visible to all users, including desktop users. Since they already have access to the mask editor, this might add a bit of unnecessary clutter to their toolbox.

What do you think about exploring a long-press-to-open-context-menu interaction? That might be a more universal solution to this and similar issues down the line.

Also, unrelated question—have you noticed any parts of the UI being cut off (like the top menu bar or the bottom edge)? Just curious, since we're tracking a related issue here: #3447

Thanks again! Looking forward to your thoughts :)

@Yiximail
Copy link
Contributor Author

Yiximail commented Apr 25, 2025

Hi @Yiximail! 👋 Thanks so much for taking the time to contribute—it's always awesome to see folks who use ComfyUI also helping improve it!

I gave this a quick test on my phone and it works great—nice work!

Just one small concern: this button would be visible to all users, including desktop users. Since they already have access to the mask editor, this might add a bit of unnecessary clutter to their toolbox.

What do you think about exploring a long-press-to-open-context-menu interaction? That might be a more universal solution to this and similar issues down the line.

Also, unrelated question—have you noticed any parts of the UI being cut off (like the top menu bar or the bottom edge)? Just curious, since we're tracking a related issue here: #3447

Thanks again! Looking forward to your thoughts :)

Thank you for your feedback! I made this PR to try to avoid tackling open context menu issue — you caught me red-handed, haha.

Yesterday I tried several approaches: simulating mouse click events, directly dispatching events to the canvas, but neither MouseEvent nor PointerEvent worked, which left me puzzled.

However, you’re absolutely right, continuously adding buttons to the toolbox isn’t a sustainable solution.
Perhaps we could add a configuration option to let users decide which quick-access buttons to display (I rarely use the color picker feature). (but not now)

Thank you for the suggestion, I’ll try to address the context menu issue first (though it might take some time).

Regarding your other question:
Yes, I noticed that parts of the UI get cut off if the browser’s navigation bar isn’t hidden.
I believe using 100dvh is correct for mobile devices (I actually overwrote ComfyUI’s h-screen with 100dvh in my personal stylesheet, lol).
So, my thought is: we should differentiate between mobile and desktop, using 100dvh for mobile and 100vh for PC. This would optimize the mobile experience without affecting desktop users.

@antonpetrovmain
Copy link

Long pressing on the title of the current workflow shows a context menu there on my android phone (Samsung Galaxy Fold 6) if that can help or give some implementation ideas. I will also be very happy to have a way to use the context menu from my phone as well without a connected bluetooth mouse.

@webfiltered
Copy link
Contributor

To properly support touch interactions, they need to be added to Litegraph (via CanvasPointer), as nodes are all drawn using HTML canvas.

@antonpetrovmain
Copy link

For what it's worth, for other people desperately looking for a workaround - if you have a wearable device, e.g. pixel watch, you can use it as a mouse/trackpad for your phone/tablet and right click from there :)

@Yiximail
Copy link
Contributor Author

Yiximail commented Apr 26, 2025

Long pressing on the title of the current workflow shows a context menu there on my android phone (Samsung Galaxy Fold 6) if that can help or give some implementation ideas. I will also be very happy to have a way to use the context menu from my phone as well without a connected bluetooth mouse.

emm, I don't get you mean, can you provide some screenshots?

I fixed a bug that to support long-pressing to display the context menu again. Was there any conflict with any other functions?

@antonpetrovmain
Copy link

Screenshot_20250426_075549_Via.jpg

@Yiximail
Copy link
Contributor Author

Yiximail commented Apr 26, 2025

Screenshot_20250426_075549_Via.jpg

Emm... I'm sorry for causing you trouble.
However, it seems to be exactly as I expected because on PC, right-clicking on the tab bar also brings up this context menu too. And their behaviors are consistent.

you can click it for a shorter period of time?
Or could you tell me when you need to hold it down for a longer time?

@antonpetrovmain
Copy link

Let me clarify - the only issue I have is not being able to open the context menu anywhere else in ComfyUI from my phone. Thus I need to use either a Bluetooth mouse or my smart watch as a mouse/touchpad to right click.

I only mentioned right clicking on the tabs, because it's the only place I CAN open the context menu by long-touching. Since you mentioned you were trying to get this event to work I thought that showing you this use case can help so one can check the source code for the tabs and figure out why long pressing the tab opens the context menu whereas long pressing a node just vibrates the device and does NOT open any context menu.

Sorry for the initial confusion I might have introduced.

@Yiximail
Copy link
Contributor Author

Let me clarify - the only issue I have is not being able to open the context menu anywhere else in ComfyUI from my phone. Thus I need to use either a Bluetooth mouse or my smart watch as a mouse/touchpad to right click.

I only mentioned right clicking on the tabs, because it's the only place I CAN open the context menu by long-touching. Since you mentioned you were trying to get this event to work I thought that showing you this use case can help so one can check the source code for the tabs and figure out why long pressing the tab opens the context menu whereas long pressing a node just vibrates the device and does NOT open any context menu.

Sorry for the initial confusion I might have introduced.

oh! I got you now.
Thank you very much... English is not my native language, so I got a bit confused.

The 1.8.1 version updated last night. It should have fixed showing context menu when long-pressing elsewhere.
Please try to update Comfyui.

Thanks for the information, If you encounter any other problems, you can also give me feedback.

@antonpetrovmain
Copy link

It's working!! Thank you very, very much! <3

Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. The code works on my end 👍 :

Workspace 1_003

ComfyApp.clipspace_return_node = firstImageNode
// @ts-expect-error fixme ts strict error
ComfyApp.open_maskeditor()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it makes more sense to check if the selected item useCanvasStore().selectedItems[0] is an image node, and then use that. If an image node is not selected, we could display some warning using a toast.

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.

5 participants