Drag scroll now recognises scrollbar areas.

This commit is contained in:
Robin 2015-12-16 17:07:05 +00:00
parent fd54b0245e
commit 45391b90ac

View File

@ -338,6 +338,15 @@ namespace DarkUI.Controls
{
var pos = PointToClient(MousePosition);
var right = ClientRectangle.Right;
var bottom = ClientRectangle.Bottom;
if (_vScrollBar.Visible)
right = _vScrollBar.Left;
if (_hScrollBar.Visible)
bottom = _hScrollBar.Top;
if (_vScrollBar.Visible)
{
// Scroll up
@ -352,9 +361,9 @@ namespace DarkUI.Controls
}
// Scroll down
if (pos.Y > ClientRectangle.Bottom)
if (pos.Y > bottom)
{
var difference = pos.Y - ClientRectangle.Bottom;
var difference = pos.Y - bottom;
if (MaxDragChange > 0 && difference > MaxDragChange)
difference = MaxDragChange;
@ -377,9 +386,9 @@ namespace DarkUI.Controls
}
// Scroll right
if (pos.X > ClientRectangle.Right)
if (pos.X > right)
{
var difference = pos.X - ClientRectangle.Right;
var difference = pos.X - right;
if (MaxDragChange > 0 && difference > MaxDragChange)
difference = MaxDragChange;