Center image after edit operation changed size
ClosedPublic

Authored by muhlenpfordt on Apr 13 2018, 8:31 AM.

Details

Summary

After editing an image which changes its size (crop, resize) or
undoing this operation the image is not centered in the viewport
in some cases.
This patch adds a check if document size changed when calculating
zoom factor and view offset.

FIXED-IN: 18.04.1

Test Plan
  • Open image in View Mode with zoom option Fit and fit height
  • Edit one time to show save bar (e.g. rotate or resize)
  • Crop to a narrow upright bar (zoom should not change)
  • Undo
  • Previous image should display complete and centered

  • Open image in View Mode
  • Resize to a size smaller than viewport
  • Resize to an even smaller size
  • Image should display centered

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
muhlenpfordt requested review of this revision.Apr 13 2018, 8:31 AM
muhlenpfordt created this revision.
muhlenpfordt added inline comments.
lib/documentview/abstractimageview.cpp
173–174

Is there a preferred style for wrapping the conditions?

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

Elegant fix which works great ;)

undo-center (branched from Applications/18.04)

Yay, arc fe worked!

lib/documentview/abstractimageview.cpp
173–174

You could

  • keep this on a single line (in general some lines in the codebase are quite long already)
  • use a single line per condition, with && in front
  • group logical conditions together.

You chose the third option, which is fine with me…

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.