Summary: | zoom in with rectangle tool selection | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Maxime Delorme <maximedelorme> |
Component: | ImageEditor-Canvas | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 0.7.2 | ||
Target Milestone: | --- | ||
Platform: | Mandrake RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.2 | |
Sentry Crash Report: | |||
Attachments: |
patch for relative zooming
patch for relative zooming, v2 |
Description
Maxime Delorme
2005-04-11 10:29:16 UTC
These are in fact two wishes. I second the first one: zoom in to the center of the displayed part of the image, instead of top-left edge. Re the second one, maybe the zoom level should increase with the same proportional step, instead of the same fixed amount like it is now. > I second the first one: zoom in to the center of the displayed part of the image, instead of top-left edge. Effectively should by very usefull > Re the second one, maybe the zoom level should increase with the same proportional step, instead of the same fixed amount like it is now. Should be confusing. IMHO a slider should be really better or maybe like kpdf [+][xxx% |V][-] with fit to heigth, fit to width, shrink to window... When I play with Ctrl+MouseWhell to zoom in / out the behaviour is quite understandable the picture move on left when I zoom in / on right when I zoom out But it keep center when the picture is smaller than screen. For consistency is a bit confusing. Concerning Ctrl+MouseWheel: I think that it would be much better if one keeps the point fixed over which the mouse pointer currently is. This would allow for zooming into any region of interest (and not just the center) without too much panning. Moreover: why can't one zoom in, when being in auto-fit mode? (Presently one has to press A to leave auto-fit mode which brings a 100% view, which usually fart too large, and then zoom out many times...) Maxime, Related to #1 : - 1th point is fixed in svn yesterday. - 2nd point : we have a combo box to select a preset zoom value, like Gimp do. Gilles Caulier SVN commit 644517 by cgilles: digikam from trunk : if an image selection is set in canvas when user process a zoom, we will use the center and size of selection to focus automaticly canvas content. BUG: 103645 M +26 -3 canvas.cpp --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #644516:644517 @@ -839,10 +839,33 @@ if (d->autoZoom) return; - float cpx = (contentsX() + visibleWidth() / 2.0) / d->zoom; - float cpy = (contentsY() + visibleHeight() / 2.0) / d->zoom; + float cpx, cpy; + int xSel, ySel, wSel, hSel; + d->im->getSelectedArea(xSel, ySel, wSel, hSel); + + if (!wSel && !hSel ) + { + // No current selection, zoom using center of canvas + // and given zoom factor. + cpx = (contentsX() + visibleWidth() / 2.0) / d->zoom; + cpy = (contentsY() + visibleHeight() / 2.0) / d->zoom; + d->zoom = zoom; + } + else + { + // If selected area, use center of selection + // and recompute zoom factor accordinly. + cpx = xSel + wSel / 2.0; + cpy = ySel + hSel / 2.0; - d->zoom = zoom; + double srcWidth = wSel; + double srcHeight = hSel; + double dstWidth = contentsRect().width(); + double dstHeight = contentsRect().height(); + + d->zoom = QMIN(dstWidth/srcWidth, dstHeight/srcHeight); + } + d->im->zoom(d->zoom); updateContentsSize(); Great! That's a stupid detail, but you've just solved one of the major usability problem of the image viewer IMHO. THANKS A LOT! (and continue the good work ;-) ) What about the suggestion in #4 concerning CTRL+MouseWheel to keep the place under the mouse pointer as the position around which the zoom is done? Also, the 10% increase when using the mouse-wheel seems too small at large magnifications (and too large at small magnifications); therefore the suggestion in #1, """the zoom level should increase with the same proportional step, instead of the same fixed amount like it is now.""" seems like a good idea. 20 Mar 2007 10:01:16 -0000, Arnd Baecker <arnd.baecker@web.de>: [bugs.kde.org quoted mail] About this point, all is already done in editor canvas implementation, but it won't work duing (i suspect) a bug in Qt... Investigaution in progress to find a solution... Also, the 10% increase when using the mouse-wheel seems > too small The previous value, before my patch is around 6% (:=))) at large magnifications (and too large at small > magnifications); > therefore the suggestion in #1, """the zoom level should increase with the > same > proportional step, instead of the same fixed amount like it is now.""" > seems like a good idea. If i following you, you want not a constant zoom step, but a progressive one, depanding of current zoom factor ? If yes, i would to have more feedback about this point. Is other picture viewver work like this ? Gilles _______________________________________________ > Digikam-devel mailing list > Digikam-devel@kde.org > https://mail.kde.org/mailman/listinfo/digikam-devel > <br><br><div><span class="gmail_quote">20 Mar 2007 10:01:16 -0000, Arnd Baecker <<a href="mailto:arnd.baecker@web.de">arnd.baecker@web.de</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> ------- You are receiving this mail because: -------<br>You are the assignee for the bug, or are watching the assignee.<br><br><a href="http://bugs.kde.org/show_bug.cgi?id=103645">http://bugs.kde.org/show_bug.cgi?id=103645 </a><br><br><br><br><br>------- Additional Comments From arnd.baecker web de 2007-03-20 11:01 -------<br>What about the suggestion in #4 concerning CTRL+MouseWheel to<br>keep the place under the mouse pointer as the position around <br>which the zoom is done?</blockquote><div><br>About this point, all is already done in editor canvas implementation, but it won't work duing (i suspect) a bug in Qt...<br><br>Investigaution in progress to find a solution... </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Also, the 10% increase when using the mouse-wheel seems<br>too small </blockquote> <div><br>The previous value, before my patch is around 6% (:=))) </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> at large magnifications (and too large at small <br>magnifications);<br>therefore the suggestion in #1, """the zoom level should increase with the same<br>proportional step, instead of the same fixed amount like it is now."""<br>seems like a good idea. </blockquote><div><br>If i following you, you want not a constant zoom step, but a progressive one, depanding of current zoom factor ? If yes, i would to have more feedback about this point. Is other picture viewver work like this ? <br><br>Gilles<br><br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">_______________________________________________<br>Digikam-devel mailing list <br><a href="mailto:Digikam-devel@kde.org">Digikam-devel@kde.org</a><br><a href="https://mail.kde.org/mailman/listinfo/digikam-devel">https://mail.kde.org/mailman/listinfo/digikam-devel</a><br></blockquote></div><br> > If i following you, you want not a constant zoom step, but a progressive
> one, depanding of current zoom factor ? If yes, i would to have more
> feedback about this point. Is other picture viewver work like this ?
The ``problem`` is that currently a change of 10% is something different
at 25% compared to 300%. While in the first case it is a big change,
in the second case this is really a small one.
Going from one zoom-level to the next should always give the
same magnification ratio, I think.
(It seems that gqview does that pretty well, also via CTRL-mousewheel)
Maybe the following would be a simple solution: introduce a new (user-changeable) zoom_factor, by which the magnification gets multiplied (divided by): E.g. with zoom_factor=1.4 using the mousewheel for zooming would lead to the sequence 100% 140% 196% 274% 384% ... and in the other direction: 71% 51% 36% ... Technical remark: If the actual zoom-level is just an integer percentage, going up and down will lead to rounding errors. This could be prevented by pre-generating the sequence of zoom-levels as 100% * zoom_factor**zoom_value, e.g with zoom_value = -10, -9, ..., 10 (With zoom_factor=1.4 this covers the range from 3% to 2892%, while with zoom_factor=1.1 this would only be 38% to 260%; so maybe the range of zoom_value should be made dependent on the zoom_factor, so that always a range of 10% to 1000% is covered?) > Maybe the following would be a simple solution: > introduce a new (user-changeable) zoom_factor, by which > the magnification gets multiplied (divided by): > E.g. with zoom_factor=1.4 using the mousewheel for zooming are you read my previous messages ? The mouse wheel zooming control is already implemented in editor like this : CRTL + mousewheel == Zoom +/- SHIFT + mousewheel == previous / next image. look in canvas.cpp the method "void Canvas::contentsWheelEvent(QWheelEvent *e)" But for obscurs reasons, the keyboard events is not handle at the same time than mouse wheel events by QT. I don't know why... > would lead > to the sequence > 100% 140% 196% 274% 384% ... > and in the other direction: > 71% 51% 36% ... > Technical remark: If the actual zoom-level is just an integer percentage, no, internally, it's a float value. Gilles > are you read my previous messages ? Sure! ;-) > The mouse wheel zooming control is already implemented in editor like > this : > > CRTL + mousewheel == Zoom +/- Yes, I have tested this - it works fine for me > SHIFT + mousewheel == previous / next image. > > look in canvas.cpp the method "void Canvas::contentsWheelEvent(QWheelEvent *e)" > > But for obscurs reasons, the keyboard events is not handle at the same time than mouse wheel events by QT. I don't know why... Both CTRL+mousewheel and SHIF+mousewheel work fine for me! (Apart from the fact that the point over which the mouse pointer currently is not kept fixed, my first remark in #8 ...) So because it works for me, but not for you, this must then be the reason for the confusion? I am talking about something differnt, namely the sequence of zoom values which is obtained when using CTRL + mousewheel ... > > would lead > > to the sequence > > 100% 140% 196% 274% 384% ... > > and in the other direction: > > 71% 51% 36% ... > > > Technical remark: If the actual zoom-level is just an integer percentage, > > no, internally, it's a float value. OK, then it seems easier to implement (no need to care about a stored list). Best, Arnd Created attachment 20089 [details]
patch for relative zooming
This simple patch illustrates how CTRL+mousewheel
zooms in/out such that the magnification is independent
of the current zoom level.
This is achieved by using a zoomStep, with value 1.2
as multiplier (or divisor) of the current zoom factor.
I think that this leads to a much more intuitive behaviour
than the current one.
Maybe it would be better to rename `zoomStep` to `zoomMultiplier`.
One could also think of making this multiplier user-configurable
(though maybe a fixed 1.2 is a good enough start).
Gilles, if I understand you correctly, CTRL+mousewheel
does not work for you, right?
For me it does, so could it be some window-manager
or X configuration issue?
If you need further details of my configuration,
just let me know.
Best, Arnd
Arnd, This patch sound fine. Give me a new version renaming zoomStep to zoomMultiplier 1.2 witch be a fine value to start. We will see if user will request something to configure this value in setup later 0.9.2-beta1. About my problem with CTRL+mouse wheel, it appear only on my new laptop. All others computers work properlly. And yes, it sound like a X11 conf problem. i will trying to fix it. Gilles Created attachment 20091 [details]
patch for relative zooming, v2
New version of the patch attached.
(Good luck with the X11 issue ...)
SVN commit 646267 by cgilles: digikam from trunk : patch from Arnd Baecker to use a zoom multiplier adapted to the current zoom factor instead to use a constant zoom step. CCBUGS: 103645 M +6 -6 canvas.cpp --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #646266:646267 @@ -76,7 +76,7 @@ public: CanvasPrivate() : - tileSize(128), minZoom(0.1), maxZoom(10.0), zoomStep(0.1) + tileSize(128), minZoom(0.1), maxZoom(10.0), zoomMultiplier(1.2) { rubber = 0; pressedMoved = false; @@ -121,7 +121,7 @@ double zoom; const double minZoom; const double maxZoom; - const double zoomStep; + const double zoomMultiplier; QToolButton *cornerButton; @@ -849,12 +849,12 @@ bool Canvas::maxZoom() { - return ((d->zoom + d->zoomStep) >= d->maxZoom); + return ((d->zoom * d->zoomMultiplier) >= d->maxZoom); } bool Canvas::minZoom() { - return ((d->zoom - d->zoomStep) <= d->minZoom); + return ((d->zoom / d->zoomMultiplier) <= d->minZoom); } bool Canvas::exifRotated() @@ -867,7 +867,7 @@ if (maxZoom()) return; - setZoomFactor(d->zoom + d->zoomStep); + setZoomFactor(d->zoom * d->zoomMultiplier); } void Canvas::slotDecreaseZoom() @@ -875,7 +875,7 @@ if (minZoom()) return; - setZoomFactor(d->zoom - d->zoomStep); + setZoomFactor(d->zoom / d->zoomMultiplier); } void Canvas::setZoomFactor(float zoom) SVN commit 648043 by cgilles: digikam from trunk : Image Editor canvas : - button from bottom/left corner of editor canvas used to handle pan icon widget, is now a toogle button. it show and hide pan icon view. No need to select a regio to pan to hide pan view. Just press again on the button. - pan icon view is just more larger (90*60) ==> (120*80). More adapted to large screen. CCBUGS: 103645 M +21 -8 canvas.cpp M +1 -1 canvas.h --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #648042:648043 @@ -164,6 +164,7 @@ d->cornerButton = new QToolButton(this); d->cornerButton->setIconSet(SmallIcon("move")); + d->cornerButton->setToggleButton(true); d->cornerButton->hide(); setCornerWidget(d->cornerButton); @@ -176,8 +177,8 @@ connect(this, SIGNAL(signalZoomChanged(float)), this, SLOT(slotZoomChanged(float))); - connect(d->cornerButton, SIGNAL(clicked()), - this, SLOT(slotCornerButtonClicked())); + connect(d->cornerButton, SIGNAL(toggled(bool)), + this, SLOT(slotCornerButtonToggled(bool))); connect(d->im, SIGNAL(signalColorManagementTool()), this, SIGNAL(signalColorManagementTool())); @@ -1208,16 +1209,26 @@ emit signalChanged(); } -void Canvas::slotCornerButtonClicked() +void Canvas::slotCornerButtonToggled(bool on) { + if (!on) + { + if (d->panIconPopup) + { + d->panIconPopup->hide(); + delete d->panIconPopup; + d->panIconPopup = 0; + } + return; + } + if (!d->panIconPopup) { - d->panIconPopup = new KPopupFrame(this); - - ImagePanIconWidget *pan = new ImagePanIconWidget(90, 60, d->panIconPopup); + d->panIconPopup = new KPopupFrame(this); + ImagePanIconWidget *pan = new ImagePanIconWidget(120, 80, d->panIconPopup); d->panIconPopup->setMainWidget(pan); - QRect r((int)(contentsX() / d->zoom), (int)(contentsY() / d->zoom), + QRect r((int)(contentsX() / d->zoom), (int)(contentsY() / d->zoom), (int)(visibleWidth() / d->zoom), (int)(visibleHeight() / d->zoom)); pan->setRegionSelection(r); @@ -1228,7 +1239,8 @@ QPoint g = mapToGlobal(viewport()->pos()); g.setX(g.x()+ viewport()->size().width()); g.setY(g.y()+ viewport()->size().height()); - d->panIconPopup->popup(QPoint(g.x() - d->panIconPopup->width(), g.y() - d->panIconPopup->height())); + d->panIconPopup->popup(QPoint(g.x() - d->panIconPopup->width(), + g.y() - d->panIconPopup->height())); } void Canvas::slotPanIconSelectionMoved(QRect r, bool b) @@ -1240,6 +1252,7 @@ d->panIconPopup->hide(); delete d->panIconPopup; d->panIconPopup = 0; + d->cornerButton->setOn(false); } } --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.h #648042:648043 @@ -155,7 +155,7 @@ void slotModified(); void slotImageLoaded(const QString& filePath, bool success); void slotImageSaved(const QString& filePath, bool success); - void slotCornerButtonClicked(); + void slotCornerButtonToggled(bool); void slotPanIconSelectionMoved(QRect, bool); void slotZoomChanged(float); SVN commit 650876 by cgilles: digiKam from trunk : image editor improvement : persistant selection of image in all cases : Zoom In, Zoom out, Fit to Window, and Resize Event. - The AutoZoom option have been renamed "Fit To window". Keyboard Shortcut still CTRL+SHIFT+A - A new option have been added to menu and tool bar to Fit to Selection the current image. You can perform a zoom to the selected area. Keyboard Shortcut is CTRL+SHIFT+S Gerhard, the handbook need to be fixed. Thanks in advance. CCMAIL: digikam-devel@kde.org CCBUGS: 103645 M +5 -3 showfoto/showfotoui.rc M +48 -39 utilities/imageeditor/canvas/canvas.cpp M +44 -40 utilities/imageeditor/canvas/canvas.h M +5 -3 utilities/imageeditor/editor/digikamimagewindowui.rc M +27 -13 utilities/imageeditor/editor/editorwindow.cpp M +1 -1 utilities/imageeditor/editor/editorwindow.h M +6 -4 utilities/imageeditor/editor/editorwindowprivate.h |