[Digikam-devel] [Bug 139790] Viewer / editor: the center of the photo is moving when zooming in or out
Gilles Caulier
caulier.gilles at gmail.com
Mon Mar 19 14:59:04 GMT 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=139790
caulier.gilles gmail com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From caulier.gilles gmail com 2007-03-19 15:59 -------
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);
More information about the Digikam-devel
mailing list