diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-24 15:01:01 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-24 15:53:44 +0100 |
commit | d7acb44b148893fe0cc48a54c3eb73406c251668 (patch) | |
tree | ea90579e6acca19edfd65d8bb700cf8244308820 | |
parent | b1e5983f04095346bee48dc3b413c0ae28789c27 (diff) |
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
-rw-r--r-- | vcl/source/control/scrbar.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 4ed19836e403..5d44cd7e9eed 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -1058,7 +1058,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 ) |