Skip to content

Add overview control, rework ImageDelegate

Noah Davis requested to merge work/ndavis/birdseyeview into master

Add OverviewControl

Functions much like the birds eye/overview control in Gwenview.

A few differences:

  • You can click outside of the handle to instantly jump to a location.
  • The handle has a dot on it for visibility at small sizes.
  • The mouse cursor changes to an open or closed hand when you hover over or grab the handle.

Rewrite ImageDelegate without using Flickable, plus tweaks

Flickable was making it difficult to maintain precise control over the size and position of the content area inside the viewport. Now ImageDelegate is a MouseArea that can drag an Item that contains the media. The MouseArea has all the functions of the old MouseArea too, with some minor tweaks.

Various other changes that can't really be separated from this change because they rely on the changed code:

  • Moved BusyIndicator to the parent ListView because we don't need an instance of it for every delegate.
  • Only load the type of media viewer that is needed (video, animated image, image).
  • Support using middle mouse button to pan. Still supporting left click to do the same, but some users might expect middle mouse because it's common in other programs that allow viewing, zooming and panning around images.
  • Automatically center content smaller than the viewport.
  • Don't allow blank areas around content larger than the viewport.
  • Double click always increases the content size when at the default content size or rebinds to the default content size when not at the default content size.
  • No velocity when dragging the content around.
  • Max zoom is now 10,000%. With fullscreen on a 1920x1080 screen, that's roughly 19x10 pixels fully visible when fully zoomed in.
  • Min zoom is now 8px, unless the source size is even smaller.
  • Use PinchArea::pinch for handling pinch gestures that move the content area.
  • Zooming out is now the exact opposite of zooming in. Before, the formula was always factor = 1 + delta / 600. If delta was 120, factor was 1.2. If delta was -120, factor was 0.8. Now the formula is factor = 1 / (1 + delta / 600) when delta is negative. If delta is -120, factor = 0.833....
  • Only hide controls on double click when on mobile.
  • Use a formula like QGraphicsView to determine the distance for each tick when scrolling.
  • Allow using Shift to scroll horizontally.
  • Round to default size if within ±1px of it after changing zoom. Should hopefully help deal with floating point number issues.
  • Removed zoom animation. Wish we could keep it and maybe we can add it later. It was too difficult for me to get it to work properly and a previous change committed to master made it nearly imperceptible anyway.
  • Add properties with info about the media to the root item.

Smaller commits

  • ImageViewer: Move BusyIndicator to ListView
  • ImageViewer: Add OverviewControl
    • It also hides when dragging the image around or when the currentItem is not interactive.
  • ImageViewer: Make all floating controls disappear when dragging or using overview
  • ImageViewer: Make ListView not interactive when currentItem is
  • ImageViewer: enable pixelAligned for ListView
  • ImageViewer: Don't show other images when resizing the ListView
  • ImageViewer: Use ListView's functions for incrementing/decrementing
  • ImageViewer: Add Mikel Johnson's fix for forward/back mouse buttons
    • Commit was originally made by Mikel Johnson mikel5764@gmail.com. I squashed a bunch of commits and had to recreate this as a separate commit.
  • VideoPlayer: set implicit size, expose Video status as a property

Screenshot_20210716_084721

Closes #3 (closed)

Closes #13 (closed)

@teams/vdg

Edited by Noah Davis

Merge request reports