Update view offset in higher zoom levels after image size changed

Authored by muhlenpfordt on Apr 13 2018, 10:09 AM.



After cropping a zoomed image and undoing this operation the view
offset is wrong in some cases.
This patch updates image offset and scroll position after a raster
image rect was changed.

FIXED-IN: 18.04.1

Test Plan
  • Open image in View Mode with a zoom level to enable scroll
  • Edit one time to show save bar (e.g. resize, rotate)
  • Crop to a rectangle with distance from left and top edge
  • Undo
  • Image should display in whole window again

Diff Detail

R260 Gwenview
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
muhlenpfordt requested review of this revision.Apr 13 2018, 10:09 AM
muhlenpfordt created this revision.
muhlenpfordt added inline comments.

This is needed to update the minimum zoom level, otherwise it stays at 100% after undoing the crop operation.

rkflx accepted this revision.Apr 14 2018, 11:17 PM
rkflx added a subscriber: rkflx.

First I wondered why now the zoom slider was jumping when rotating, but then it made sense: The minimum zoom changes for non-square images upon rotating due to it corresponding to Fit.


This actually fixes another problem (or perhaps it's just another way of triggering): Open huge image, zoom all the way out (but do not use Fit), then Rotate two times and observe the image being offset.

Found somewhat related problems when testing your patch, though:

  • Rotating a huge image first displays a stretched version in the viewport before updating to the final rotated image.
  • Moving the zoom slider all the way to the left and then pressing Fit, the image still changes slightly.
This revision is now accepted and ready to land.Apr 14 2018, 11:17 PM
This revision was automatically updated to reflect the committed changes.