summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorRodolfo Ribeiro Gomes <libo@rodolfo.eng.br>2015-02-02 03:45:51 -0200
committerCaolán McNamara <caolanm@redhat.com>2015-02-12 10:07:51 +0000
commit2d5d52c2abc9fa882b1350a522f2989933fcb67b (patch)
treeaa01c306615a105552ae7c5290a82f3d8f44bd2c /sd
parent45b881801785d6bb6df1304732243e87c918c7c9 (diff)
draw/impress - zoom in/out to the mouse position
Change-Id: I2bff851c683fdffe9a6074fedc2f2151650f79da Signed-off-by: Rodolfo Ribeiro Gomes <libo@rodolfo.eng.br> Reviewed-on: https://gerrit.libreoffice.org/14307 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/view/viewshel.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index a78c68f36f46..83dc9ca199bc 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -648,6 +648,7 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi
{
const long nOldZoom = GetActiveWindow()->GetZoom();
long nNewZoom;
+ Point aOldMousePos = GetActiveWindow()->PixelToLogic(rCEvt.GetMousePosPixel());
if( pData->GetDelta() < 0L )
nNewZoom = std::max( (long) pWin->GetMinZoom(), basegfx::zoomtools::zoomOut( nOldZoom ));
@@ -655,6 +656,10 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi
nNewZoom = std::min( (long) pWin->GetMaxZoom(), basegfx::zoomtools::zoomIn( nOldZoom ));
SetZoom( nNewZoom );
+ // Keep mouse at same doc point before zoom
+ Point aNewMousePos = GetActiveWindow()->PixelToLogic(rCEvt.GetMousePosPixel());
+ SetWinViewPos(GetWinViewPos() - (aNewMousePos - aOldMousePos), true);
+
Invalidate( SID_ATTR_ZOOM );
Invalidate( SID_ATTR_ZOOMSLIDER );