diff options
author | Rodolfo Ribeiro Gomes <libo@rodolfo.eng.br> | 2015-01-31 19:08:05 -0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-02-09 14:58:18 +0000 |
commit | 53740bd71a0ae569da36b9293ef22842a0b53f1e (patch) | |
tree | eb6e64aa83e92047ff9ee01a75804f3ac17ae1e4 /svx | |
parent | fab828d1a144b70a75e90e2bac484bc409b1e4e4 (diff) |
tdf#47577 Zoom slider should only react to full click
Change-Id: If859754c956a634a96066ac407b70d6dd2759d53
Signed-off-by: Rodolfo Ribeiro Gomes <libo@rodolfo.eng.br>
Reviewed-on: https://gerrit.libreoffice.org/14265
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/stbctrls/zoomsliderctrl.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx index dcb0c556f448..c2e0f218c6e9 100644 --- a/svx/source/stbctrls/zoomsliderctrl.cxx +++ b/svx/source/stbctrls/zoomsliderctrl.cxx @@ -45,6 +45,7 @@ struct SvxZoomSliderControl::SvxZoomSliderControl_Impl Image maDecreaseButton; bool mbValuesSet; bool mbOmitPaint; + bool mbDraggingStarted; SvxZoomSliderControl_Impl() : mnCurrentZoom( 0 ), @@ -57,7 +58,8 @@ struct SvxZoomSliderControl::SvxZoomSliderControl_Impl maIncreaseButton(), maDecreaseButton(), mbValuesSet( false ), - mbOmitPaint( false ) {} + mbOmitPaint( false ), + mbDraggingStarted( false ) {} }; const long nSliderXOffset = 20; @@ -331,7 +333,10 @@ bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt ) mpImpl->mnCurrentZoom = basegfx::zoomtools::zoomIn( static_cast<int>(mpImpl->mnCurrentZoom) ); // click to slider else if( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset ) + { mpImpl->mnCurrentZoom = Offset2Zoom( nXDiff ); + mpImpl->mbDraggingStarted = true; + } if ( mpImpl->mnCurrentZoom < mpImpl->mnMinZoom ) mpImpl->mnCurrentZoom = mpImpl->mnMinZoom; @@ -346,6 +351,12 @@ bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt ) return true; } +bool SvxZoomSliderControl::MouseButtonUp( const MouseEvent & ) +{ + mpImpl->mbDraggingStarted = false; + return true; +} + bool SvxZoomSliderControl::MouseMove( const MouseEvent & rEvt ) { if ( !mpImpl->mbValuesSet ) @@ -357,7 +368,7 @@ bool SvxZoomSliderControl::MouseMove( const MouseEvent & rEvt ) const sal_Int32 nXDiff = aPoint.X() - aControlRect.Left(); // check mouse move with button pressed - if ( 1 == nButtons ) + if ( 1 == nButtons && mpImpl->mbDraggingStarted ) { if ( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset ) { |