From 077f463e0fdb16d1bd37154d0cfcb84959c63a66 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 24 Nov 2015 15:01:01 +0100 Subject: [PATCH 359/398] vcl lok: handle tracking coordinates which are in twips This is similar to the mouse button down handling. When the map mode is disabled and the map mode is in twips, then in general it's possible to send mouse coordinates in twips. The scrollbar is usually in pixels, so add extra code to still make this possible. Change-Id: I0c7e404ecd7ac839e000266e396683bb7d15c505 (cherry picked from commit d7acb44b148893fe0cc48a54c3eb73406c251668) --- vcl/source/control/scrbar.cxx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index e8004d13d177..0679c848b682 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -1076,7 +1076,19 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt ) } else { - const Point rMousePos = rTEvt.GetMouseEvent().GetPosPixel(); + Point aPosPixel; + if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MAP_TWIP) + { + // rTEvt coordinates are in twips. + Push(PushFlags::MAPMODE); + EnableMapMode(); + MapMode aMapMode = GetMapMode(); + aMapMode.SetOrigin(Point(0, 0)); + SetMapMode(aMapMode); + aPosPixel = LogicToPixel(rTEvt.GetMouseEvent().GetPosPixel()); + Pop(); + } + const Point rMousePos = (GetMapMode().GetMapUnit() != MAP_TWIP ? rTEvt.GetMouseEvent().GetPosPixel() : aPosPixel); // Dragging is treated in a special way if ( meScrollType == SCROLL_DRAG ) -- 2.12.0