qView icon indicating copy to clipboard operation
qView copied to clipboard

Scrolling restraints

Open porg opened this issue 3 years ago • 7 comments

Foreword

  • I disabled "Scrolling zooms".
  • With this setup you get an almost native Mac user experience with pinch-to-zoom and two-finger scrolling.
  • The only remaining downsides are:
    • #170 which seems to make it into 5.0 🙂
    • #266 seems to be the technical foundation for #170 or at least closely related
    • #420

Proposal

  • With the setup as described above in qView 4.0 on macOS 12 Big Sur one can scroll absolutely unrestricted
    • You can scroll vertically, horizontally or combined
    • You can scroll the image out of the viewport (image canvas) at free will
  • This can be seen as a feature, i.e. for presentation purposes slowly revealing an image.
  • But it can also be seen as an obstacle.
  • Hence it would be great to add this additional preference section with two settings:

Scrolling restraints

Image bounces off these sides of the viewport:

           [√] top
  [√] left            [√] right
           [√] bottom

Tooltip: If you enable this the image bounces off with a rubberband effect for the activated viewport borders. Else you can scroll the image out of the viewport at will.

  • [√] Normalize scrolling orientation Tooltip: Scrolling as you are used to from your touch devices or web browsing on Desktop devices. Your trackpad/mousewheel provides raw scrolling data to qView. If your tracking is mainly up/down (on the Y-axis) with some slight left/right jiggles, the jiggles get ignored, and it's interpreted as a pure up/down movement. The same is true for the other direction (X-axis). Only if the initial move is more diagonal you get free combined X/Y scrolling.

porg avatar May 05 '21 21:05 porg

For v1 of this feature simply a boolean "[√] Rubberband scrolling" with the tooltip "Image cannot scroll beyond viewport. If it attempts it bounces back with a rubber band effect."

But the more distinctive "Image bounces off these sides of the viewport" setting group could very much help with simulating different scroll behavior of content, if you use qView as a quick'n'dirty prototyping tool for UX design, as laid out in #416 .

porg avatar May 05 '21 21:05 porg

This would be great! Rubberband effect would require a little work because it would have to be custom. Actual restriction should be a piece of cake once the qvgraphicsview rewrite is done in 6.0.

jurplel avatar May 05 '21 23:05 jurplel

FWIW I was playing around with this in my commit here. I actually did a custom implementation instead of just setRange on the scrollbars, to allow a partial rubber band effect (only while dragging; it snaps back instantly when released because I didn't want to mess with a timer).

It was mostly just for fun and to satisfy my curiosity, but if @jurplel really likes this approach I would consider submitting it as a pull request.

jdpurcell avatar Nov 26 '22 21:11 jdpurcell

Could I get a build of that for trying it out myself?

porg avatar Nov 28 '22 11:11 porg

Sure, demo builds here. It's just a proof of concept. It's missing a setting to turn it off, and it only constrains when dragging (i.e. it's unconstrained in certain cases while zooming out).

EDIT: I realized you mentioned disabling "scrolling zooms" which this doesn't do anything for unfortunately. I only implemented the dragging part for now.

jdpurcell avatar Nov 28 '22 14:11 jdpurcell

This commit implements it for mouse/touchpad scrolling as well. Demo builds here. [EDIT: I think mouse/touchpad rubber banding in this build only works on Mac?]

As much as I'm normally a fan of keeping things simple, I do kind of enjoy this limited rubber band effect. I know the inertia portion of inertial scrolling is hard limited instead of rubber banding, by the way; I couldn't think of a good way to handle that.

jdpurcell avatar Nov 29 '22 00:11 jdpurcell

Thanks for providing! I tried demo-constrainscrolling2 built from 82198f00d557fe7229b0be57d91bb69247ac3c39 and this is my feedback:

  1. The rubber band effect could be stronger. Or if an abrupt end, then a totally abrupt end.

    • Currently it is a bad compromise inbetween, still a short overshoot of white bg-color noticeable before jumping back very sudden. It's not a bounce, but really just feels like a very sudden linear jump.
  2. Part of the original user need is:

    You can scroll the image out of the viewport (image canvas) at free will

    • And this particular feature here constrains that freedom only on certain sides (by preferences).
    • a) Could you produce one build with the user preference on which of the 4 sides to restrain?
      • No preference UI integration needed for now, config file or launch arguments also ok, if you instruct me how to.
      • Would love to test whether the concept of "control/restraint on one axis/side" and freedom "on the other axis and sides" works out in practise.
    • b) That freedom of movement is currently partially broken: When the image is not filling the canvas, qView always positions the image mid-center of the canvas. That takes away the freedom of movement that is so great about qView, which let's you scroll at will in any direction, without any correction at all.
      • Please disable this automatic centering in the next experimental build.
  3. Could you give [√] Normalize scrolling orientation a try too?

    • Again as an option by config-file or launch argument, if integrating that into the preferences UI is too hard.

porg avatar Nov 29 '22 15:11 porg