Commit 27d43010 authored by Noah Davis's avatar Noah Davis 🌵
Browse files

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.
parent fec8764d
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment