-
Notifications
You must be signed in to change notification settings - Fork 383
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
Add multi-touch support for zoom and scroll #427
Comments
Hi werner - thanks for the interest! Sure, multi-touch gesture support is something that I'd really like (and can test!) MyPaint is in a beta development stage right now, with strings frozen for translation, but a simple implementation of this would be brilliant. Now follows the headdump! GTK itself is evolving support for gesture events, new since GTK 3.14 ( Input events from tablets are captured in The base classes for a lot of modes can be found in Beware the cooperative Scrolling at present is implemented as a mixin, Question: does every tool need to be zoomable or rotatable with gestures? Perhaps they all do, in which case you could probably get away with not delegating the touch events from the controlling gui.document.Document (warning: badly named class! it's an MVC controller for the document, and I want to go MVP with it at some stage...). Practically, for what you want, you'll probably need to add another capture method on the There are multiple documents and multiple canvas widgets: the scratchpad is distinct from the main document and its view, and there's another document+tdw pair for the brush preview editor. The main-doc preview dockable points its tdw and controller at the main document's model. Note that we have support for single-finger panning already introduced in #246's work, but if something like single-figure panning (GTK calls its gesture (Apologies for the braindump!) |
From programmer's point of view, how many dollars would be fair to ask to implement this issue? I want to assess with a potential interested, the possibility to hiring the implementation of this issue and others like it. Would deal in micro-payments platforms such as the Flattr or BountySource... Someone interested in win a beer? How many? With a estimated term? |
This will be a better suited question on our community forums over at |
Hello all! Any progress with this? Did detecting touch events got any easier? I'm also interested in supporting a bounty if one is created. |
I am also highly interested in this. I've had no luck getting Clip Studio to work with Wine, and MyPaint is the closest Linux-compatible alternative. But lack of proper gestures like pinch-to-zoom and rotation are kind of a deal breaker at the moment. @achadwick, is the above comment about MyPaint internals still accurate? I don't have much python experience, so I'm wondering how crazy I would need to be to try and implement something like this. I really hate booting into Windows whenever I have to draw something. |
I've been looking into this. I had originally thought it did make sense to just always have gestures enabled, but it feels weird for the pen/pencil/eraser tools, since single touch still gets interpreted as a stroke, even during multitouch. My implementation is going to focus specifically on touchscreens marked as navigation only. I'm not massively familiar with Python, so not sure how this is going to end up working, but I do have gestures detected, so I'll likely hack some kind of proof of concept... soon-ish? |
Gtk gestures work with MyPaint. The performance is really bad; I suspect that's the fault of my implementation because normal rotation/scaling within MyPaint is very smooth on my tablet. Hopefully it's not a Gtk problem and hopefully it's not something incredibly complicated that takes me forever to figure out. Proof of Concept: https://www.youtube.com/watch?v=f3Cfu5q7WEQ To expand on what I was talking about above, MyPaint has explicit tools for panning, zooming, and rotating. All of these take single touches and block multitouch events from being thrown. It's possible I could override that, but it feels inconsistent and weird. I don't want to mess with that paradigm, and I don't want to mess too much with MyPaint's internals. So if you select the rotate tool, you should only rotate. My plan then is to add another tool alongside pan/rotate/scale that is explicitly multitouch. That will allow you to pan/rotate/scale at the same time with gestures if you select it. If you're on a tablet and you want that on permanently, set your input device to be navigation only and then leave your gesture tool set to multitouch. This seems to be the strategy that's most consistent with MyPaint's current interface, and that gives users the most flexibility around how they want to use the interface. You'll still be able to draw with your finger on a tablet, you'll still be able to lock a gesture to only rotating or only panning. And maybe that even paves the way to multitouch painting or something in the far future. |
Very cool progress. Regarding performance, do you think the poor performance has anything to do with the number of events received per second? That is, during the gesture to rotate, is mypaint receiving a bazillion events to rotate the canvas 0.0000001 degrees? I had a problem with the color picker, for example-- when moving the mouse around the color picker was picking a color for every single movement event. So it was really spiking CPU for really no benefit. I tamed it a bit by keeping a timestamp of the previous event and ignoring closely spaced events. Probably a much better way to do this. . . :-) |
That's my first guess. I don't have a ton of experience with Python, but in my Javascript experience it's fairly common to have event performance go out of control for exactly this reason - I almost always get improvements by debouncing events. It wouldn't surprise me if that's the case here as well since I believe Gtk's event loop is also single threaded. |
Ah "debounce", I didn't know there was a name for it (I don't have a ton of experience in anything ;-). We should maybe look at using a debounce decorator like this |
A new tool seems like the wrong way to do this. Most multi-touch gestures should be handled independently of the mode stack, in my opinion. It's always useful to point the view somewhere else even if you're laying down some inker goodness and finesseing control points. (We are doing grabs wrong anyway for Wayland, as my somewhat depressing adventure into it has revealed recently. Ugh, so much is broken on Wayland right now.) Remember that gestures are implemented as There is no reason a regular input mode cannot add and remove gestures to the main canvas when they are I think the base MT two-finger zoom/pan/rotate core should always be available. In my head-design, they'd have interlocks so that, say, if you two-finger pan over a certain threshold, any rotate or zoom behaviour which has crept in would cancel and reset to zero. This kind of interlocking has to be implemented at the base level, if it's absent in the behaviour of the core GTK objects. |
If you're getting an unmanageable hosepipe of Another way of handling events coming in too fast is to record the angle update and queue up a single one-shot temporary idle handler (see |
Are there any updates on this? |
I'm looking at adding multi-touch zoom and scroll to mypaint similar to the design seen here: https://www.youtube.com/watch?v=iicnVez5U7M
I was looking at the mypaint code and could not find the location of pen input and zoom. Could someone point out the classes that should be modified to add this functionality?
The text was updated successfully, but these errors were encountered: