Skip to content
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

Pen pressure support & mobile zoom and pan #105

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

Conversation

richrobber2
Copy link
Owner

added pen pressure support for pressure based devices.

Current state of pressure support:

  • untested
  • it should work the same way scrolling would work but based on pressure it will probably need to be fine tuned.
  • will probably need a setting to change the pressure needed to get a larger brush size (i dont know how to do that built in settings)

added touch support for mobile devices.

Mobile touch usage:

  • 2 fingers to zoom in
  • 3 fingers to pan
  • when lifting up from 3 fingers it often triggers the action for 2 fingers (zoom) this will need to be adressed so that user experience is better (possibly though a timeout or something else)

i also left some TODO messages for the future

@richrobber2 richrobber2 added the enhancement New feature or request label Feb 18, 2024
@daswer123
Copy link
Collaborator

Hi, sorry I didn't reply earlier, I'm working and will be free by the end of the week.

@richrobber2
Copy link
Owner Author

thank you. just leaving merging to you its okay. finish whatever you need. its not all that important just new features but still want you to look at it since i dont know everything you are working on with the actual repos (the main ones)

also might be misunderstanding things in the code base and could potentially have used other functions (you can see in the new function i added that it looks like there is a function i could have modified to work with it seamlessly but i just made a new function to handle it, in turn i might be missing something)

thanks again

@daswer123
Copy link
Collaborator

I took the time to test everything. Overall, the idea is a good one, and I too tried earlier to make using the extension more phone-friendly. I remembered why I postponed this issue until a better version of gradio.

Unfortunately, to test all this properly you need at least a tablet, which I don't have, just a regular phone. It's difficult to use SD on a normal phone, and even more difficult with the img2img feature.

In the extension settings there is an option "Add a button to switch to full screen mode. May be useful for devices without keyboard" which adds a button for full screen mode.

On the changes themselves, everything works, but the SD-forge still fires the push event despite stopPropagation. I assume this can be fixed by modifying the gradio sources.

The function for changing the brush size depending on the pressure force should be adjusted at the moment of creating the canvas and the function for processing the pressure, which is implemented in the gradio. Accordingly, in order to do such a thing you need to modify the gradio sources.

Also with the move function there is a problem: on my phone on 3 fingers triggers a screenshot, this can be a definite problem as it is called from under the phone system and there is no way to fix it via js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants