Bug 434049 - faulty logic in "updateZoomAndSize", zoom level changed after preview image changed [patch]
Summary: faulty logic in "updateZoomAndSize", zoom level changed after preview image c...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Preview-Image (show other bugs)
Version: 7.2.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-06 08:15 UTC by Qian
Modified: 2021-03-06 15:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 7.2.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Qian 2021-03-06 08:15:26 UTC
SUMMARY

I think the logic in "updateZoomAndSize" is faulty and suggest following change.

The check "(zoomFactor() <= fitZoom)" is unnecessary, it messes up zoom level when a small image is encountered.

With this patch, the zoom level is fixed when "isFitToWindow" flag is not set.

This patch should also fulfill the need of https://bugs.kde.org/show_bug.cgi?id=379553

--- a/core/libs/widgets/graphicsview/previewlayout.cpp
+++ b/core/libs/widgets/graphicsview/previewlayout.cpp
@@ -326,7 +326,7 @@ void SinglePhotoPreviewLayout::updateZoomAndSize()
 
     // Is currently the zoom factor set to fit to window? Then set it again to fit the new size.
 
-    if (!d->zoomSettings()->imageSize().isNull() && ((zoomFactor() <= fitZoom) || d->isFitToWindow))
+    if (!d->zoomSettings()->imageSize().isNull() && d->isFitToWindow)
     {
         fitToWindow();
     }


STEPS TO REPRODUCE
1. In preview mode, select a big picture, and "Zoom to 100%".
2. Now select a small picture.
3. Select back the big picture.

OBSERVED RESULT

1. Can see part of the big picture, which is expected.
2. Can see the small picture with original size.
3. The big picture is now "fit to window".

EXPECTED RESULT

1. Same, see the big picture with zoom level 100%.
2. Same, see the small picture with zoom level 100%.
3. We should still see the big picture with zoom level 100%.

SOFTWARE/OS VERSIONS
digikam 7.2.0-rc on Linux/Plasma

ADDITIONAL INFORMATION
Comment 1 Maik Qualmann 2021-03-06 11:48:12 UTC
Git commit 2fd97fb2dd67493557e49a2d8af721d3496b1129 by Maik Qualmann.
Committed on 06/03/2021 at 11:47.
Pushed by mqualmann into branch 'master'.

apply patch from Qian to not fall back from 100% to fit to window
FIXED-IN: 7.2.0

M  +2    -1    NEWS
M  +1    -1    core/libs/widgets/graphicsview/previewlayout.cpp

https://invent.kde.org/graphics/digikam/commit/2fd97fb2dd67493557e49a2d8af721d3496b1129
Comment 2 Qian 2021-03-06 15:10:23 UTC
https://bugs.kde.org/show_bug.cgi?id=379553 can be also closed then.