Using Gesture to Select Layer on Android and touch enabled devices

I understood that, maybe i didn’t worded it correctly. With the tabs screen real estate, a full fledged desktop interface is ok except for few keyboard dependant quirkiness. So waiting for mobile device interface is not a hard and fast requirement. Hope this explanation is better. Apologies if things were not so well explained earlier. Thanks @raghukamath

1 Like

@abhifx
I just have some questions about the layer selection and layer merge.
-Layer multi-selection would be: swiping from left to right on top of a layer in the layer list docker.
-Layer merge would be: pinch gesture (with two fingers) on top of the whole layer list docker. But this behaviour may needs to be defined more precisely. Would it flatten a layer group or merge individual layers?

@sh-zam
Actually was wrong when I mentioned QGestureRecognizer before. I used a simpler approach in my Qt based apps: QWidget::grabGesture and then the widget will automatically receive QGestureEvents with e.g. swipe or pinch gestures in it’s viewportEvent method.

Hi @cedarfeather

As of now this is not completely defined, we have few options

If we go by procreate method, then two finger swipe to right on the specific layer would select the layer. Then we can group it through a menu action or long press to get the option.
Pinch on two or more layers would merge down the layer to the lowest layer

Another option is pinching two or more layers would give the option to create a group. This IMHO makes the best sense. merging layers down is already easy.

As of now, what has been suggested due to limitations as mentioned by @sh-zam is that since gesture implementation on canvas is easier rather than on widget (layers are based on widgets) so a simple checkbox beside the layer will select the layer and then we can go through a menu to group the selection.

I actually wanted to implement that feature myself but unfortunately, building for Android is just proved too difficult :frowning:

That’s a bummer! Bu5 doesn these gesture system work on both android and other platform build? But then testing on other platforms would be difficult with less touch based devices

Yes, testing on other platforms (Linux etc.) is a little bit difficult when you don’t have a real touchscreen, because Krita’s Framework Qt treats touches and mouse clicks as two different things.

I just implemented that “swipe multi selection” and got it working more or less.
But 2 issues remain:
When I run it on a Windows touchscreen, the drag, drop is still active. That means when I try to swipe an item, it starts a drag-drop operation with the current layer. For testing, I disabled drag-drop and then it works. But this is probably not something people want.
I installed the Android version of Krita from the store, because I still can’t build it for Android due to some CMake error. in Krita Android, in the layer docker, drag drop seems to be disabled by default. I guess here the “swipe multi selection” would work.

1 Like

Hi @cedarfeather

Thanks for working on this. I am surprised two finger swipe is used as drag and drop since i have not used krita on windows with touch devices. How have you achieved this?
Testing on android will a challenge altogether

I used single finger swipe after I patched Krita. Two finger swipe is not used as drag and drop.

As soon as you click or touch a layer (on Windows,Linux, macOS), it usually starts a drag-and-drop operation.

That means after I implemented swipe-to-select it started to attempt the drag-and-drop operation simultaneously because it cannot possibly know if you intend to drag or swipe the layer.

But since drag-drop is disabled on Android, this wouldn’t be an issue.

so a double finger swipe should actually solve it for both android and other platforms?

if you can share the build I can try Samsung second screen to try on a windows machine.

I’ll keep these changes in a branch and wait until there’s some update to the Android build

and then I can hopefully build it for Android.
I already tested it and it basically works (for Windows) so there’s no need for further testing.

2 Likes

@sh-zam has initiated a relevant merge request here to implement check boxes for selecting multiple layers which can improve multi layer selection for touch devices - Add checkbox to LayerBox for selecting layers (!1665) · Merge requests · Graphics / Krita · GitLab

4 Likes

That is fantastic news. This opens up the massive potential for Krita on Andoird Tablet with blending modes. Many Thanks to @sh-zam, @cedarfeather and @raghukamath

1 Like

this is not merged right? so I can’t test it on the nightly build? or am I missing something?

It is under review and only when it gets approval it will be merged.

1 Like

can some one share a dev build with this feature? would be great to test. and probably for my current project.

@sh-zam or @dkazakov can create a test appimage I do not know about test apk packlage. The merge request is still under review you can check the comments and other things in the link shared earlier. When it says merged at the top of the title it is merged and will be available in the nightly build

Here it is a test appimage
(backup your files and config or create a folder next to the appimage with the name “krita-5.2.0-prealpha-004a70800c-x86_64.appimage.home” so that it uses it as home directory for this appimage)

Hi! Thanks for the app image. I will try it on my arch linux install. No possibility of apk? I am already on nightly build on my galaxy tab. Could happily test the behavior.

The mr got merged. It contains some other improvements over the version from which I made the appimage. So anybody will be able to test the feature by using the krita next that will be uploaded today.

6 Likes

I just did and this is working excellent on galaxy tab.

One thing I have noticed is that if I select layers and long press to group, it only creates group of the layer which was long pressed. However, if I go to layers menu it groups correctly.

not sure if this is intentional or what. But this is a massive time saver, I neither have to go to the desktop to create a group or attach a keyboard to the tab. massive boost in workflow