mirukana / mirage

A fancy, customizable, keyboard-operable Qt/QML & Python Matrix chat client for encrypted and decentralized communication.
GNU Lesser General Public License v3.0
412 stars 40 forks source link

Maximize image on click #11

Closed rinigus closed 4 years ago

rinigus commented 4 years ago

When clicking on image, maximize it instead of opening in the external application (browser).

That would require some way of navigatation back. As an example, drawer can be used (from bottom or some other side) allowing users to swipe it out. In addition, X in the corner could be used as well.

mirukana commented 4 years ago

The image viewer has been added to the dev branch.

For navigating back, we can't use a swipable drawer since that would conflict with flicking the image, but there's a X button at the bottom. Other than that, these controls are available:

I'd like to add pinching gestures to rotate and zoom using PinchHandler, but I have no way to test this without a touch screen, would you be willing to contribute?

rinigus commented 4 years ago

Sure, I will be glad to help. Just let me know when it is ready for testing and which branch I should pull in.

mirukana commented 4 years ago

It should be ready so you can pull dev, thanks.

rinigus commented 4 years ago

I'll be able to test tonight.

rinigus commented 4 years ago

From testing:

 20:32:19 | Done: file:///home/nemo/.var/app/io.github.mirukana.mirage/cache/mirage/downloads/jameshjacksonjr.modular.im/Screenshot_20200721_010_6a4be624a682611b8a14c05014847e253d7fa678.png

No idea why it is refusing to do so on mobile. The both were tested using flatpak versions.

rinigus commented 4 years ago

PS: used version 87ad3ccab1e9e5ba31e3258c25ec4b7e84ecbdf6

mirukana commented 4 years ago

Maybe the middle click handler is getting triggered accidentally? Try adding print("left", window.settings.media.openExternallyOnClick) here and print("middle", window.settings.media.openExternallyOnClick) here.

rinigus commented 4 years ago

Yes, you get ~ 10:13:33 | middle false on click

mirukana commented 4 years ago

What happens if you add acceptedPointerTypes: PointerDevice.GenericPointer | PointerDevice.Pen to the middle click TapHandler?

rinigus commented 4 years ago

yes, was just testing the similar one: acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus. the one I tested, filtered it out. and shows picture zoomed in.

cannot pan though, as pointer events are processed by panel under and while I try to pan, messages move up-down there

mirukana commented 4 years ago

When you said "tap opens file in a separate application", did you mean tap on the timeline thumbnail, or tap on the image in the viewer itself?

rinigus commented 4 years ago

in the timeline thumbnail. The fix with acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus worked, as I expect your proposed fix would work as well.

Issue now is in inability to pan&zoom of the image when in image viewer. This is due to the mouse/tap events being handled by timeline (that's probably the term which you looked for)

mirukana commented 4 years ago

As a possible workaround, can you try adding enabled: ! window.anyPopup to the UI component?

rinigus commented 4 years ago

I will test it tonight

rinigus commented 4 years ago

It did help in terms of not moving the main pane, but not for panning and zooming. Occasionally, after some panning gestures were tried, an image was opened externally again, as before from timeline.

mirukana commented 4 years ago

Might be fixed as a side-effect of https://github.com/mirukana/mirage/commit/8fbe59f6eb55b7a20e85beea95a47d1e4652a180, but probably not.

I'll close this since the feature is now out in 0.6.1 and I have no way of debugging or fixing the touch screen problem myself, please open a new issue for that.

rinigus commented 4 years ago

Thank you very much, I understand the difficulty very well