Bug 139790 - Viewer / editor: the center of the photo is moving when zooming in or out
Summary: Viewer / editor: the center of the photo is moving when zooming in or out
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: ImageEditor-Canvas (show other bugs)
Version: 0.9.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-08 22:04 UTC by Kevin Goeser
Modified: 2017-08-07 08:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 0.9.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Goeser 2007-01-08 22:04:37 UTC
Version:           0.9.0 (using KDE KDE 3.5.5)
Installed from:    Gentoo Packages
Compiler:          GCC 4.1.1 gcc (GCC) 4.1.1 (Gentoo 4.1.1-r1)
OS:                Linux

If zooming in or out using the keyboard or the tool bar buttons, the center of the photo moves. The center of the current projection should be kept as center instead (common usability).

Cheers
   Kevin
Comment 1 Frank Siegert 2007-01-16 23:56:24 UTC
I can confirm this bug. It happens with 0.9.0 Kubuntu packages as well as with trunk compiled from SVN (r624276). (Is there any way that I can mark this bug as confirmed?)
Comment 2 caulier.gilles 2007-03-19 15:59:03 UTC
SVN commit 644214 by cgilles:

digikam from trunk : do not move editor viewport content when zoom in/out.
BUG: 139790

 M  +16 -6     canvas.cpp  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #644213:644214
@@ -391,8 +391,8 @@
             emit signalSelected(false);
     }
 
-    int wZ = int(d->im->width());
-    int hZ = int(d->im->height());
+    int wZ = d->im->width();
+    int hZ = d->im->height();
     
     if (visibleWidth() > wZ || visibleHeight() > hZ)
     {
@@ -835,11 +835,16 @@
     if (d->autoZoom || maxZoom())
         return;
 
+    float cpx = (contentsX() + visibleWidth()  / 2.0) / d->zoom; 
+    float cpy = (contentsY() + visibleHeight() / 2.0) / d->zoom; 
+
     d->zoom = d->zoom + 1.0/16.0;
-
     d->im->zoom(d->zoom);
-    
     updateContentsSize();
+
+    viewport()->setUpdatesEnabled(false);
+    center((int)(cpx * d->zoom), (int)(cpy * d->zoom));
+    viewport()->setUpdatesEnabled(true);
     viewport()->update();
 
     emit signalZoomChanged(d->zoom);
@@ -850,11 +855,16 @@
     if (d->autoZoom || minZoom())
         return;
 
+    float cpx = (contentsX() + visibleWidth()  / 2.0) / d->zoom; 
+    float cpy = (contentsY() + visibleHeight() / 2.0) / d->zoom;
+ 
     d->zoom = d->zoom - 1.0/16.0;    
-
     d->im->zoom(d->zoom);
+    updateContentsSize();
 
-    updateContentsSize();
+    viewport()->setUpdatesEnabled(false);
+    center((int)(cpx * d->zoom), (int)(cpy * d->zoom));
+    viewport()->setUpdatesEnabled(true);
     viewport()->update();
 
     emit signalZoomChanged(d->zoom);
Comment 3 Frank Siegert 2007-04-04 23:22:15 UTC
I believe this problem has been reintroduced with commit 649987.