[Libreoffice-commits] core.git: sd/source
Rodolfo Ribeiro Gomes
libo at rodolfo.eng.br
Thu Feb 12 02:08:18 PST 2015
sd/source/ui/view/viewshel.cxx | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit 2d5d52c2abc9fa882b1350a522f2989933fcb67b
Author: Rodolfo Ribeiro Gomes <libo at rodolfo.eng.br>
Date: Mon Feb 2 03:45:51 2015 -0200
draw/impress - zoom in/out to the mouse position
Change-Id: I2bff851c683fdffe9a6074fedc2f2151650f79da
Signed-off-by: Rodolfo Ribeiro Gomes <libo at rodolfo.eng.br>
Reviewed-on: https://gerrit.libreoffice.org/14307
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index a78c68f..83dc9ca 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 );
More information about the Libreoffice-commits
mailing list