Separate Events on the same widget

I am currently working on the widget that will allow users to display media from a Tweet in fullscreen, which is build around a Adw.Carousel with some UI layered on top.

One thing I want to implement would be that you can hide the UI when clicking on the Image, so I implemented a Gtk.GestureClick which does exactly that.
However, as I assign this event to the carousel it interferes with the swipe gesture of the carousel, which means if you only want to swipe to the next image you will toggle the visibility of the UI as well.

Now, is there a recommended way to separate a simple click from a drag, so that dragging does not activate a click?

On a related note: I also want to implement the possibility to zoom into images, which should be possible to implement with an Gtk.ScrolledWindow. Since I have seen @alicem implementing a zoom gesture in Epiphany my question to you would be if you could give me suggestion on how to replicate this for my widget.

You’re probably handling it on press instead of release - it should be done on release, and you need to claim the sequence when that happens. That’s it.

(This has nothing to do with the wbkit zoom gesture btw)

That does the trick. Thanks!

I know it’s not entirely related, but since it’s also Input and something my widget should support I thought I just mentioned it as well.
When you say “Webkit Zoom gesture”, does this means it is not related to GTK events? Do it need to create a custom zoom gesture anyway? (Was hoping I could just copy it from somewhere)

It does use GtkGestureZoom to gather events, but I mean the hard part is everything else, and that’s not reusable.

You can copy it, but Obfuscate would be a better option.

Well, I will look into it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.