|
@@ -128,17 +128,21 @@ public class Scroll : View
|
|
|
int location = Orientation == Orientation.Vertical ? mouseEvent.Position.Y : mouseEvent.Position.X;
|
|
|
int barSize = BarSize;
|
|
|
|
|
|
- (int topLeft, int bottomRight) sliderPos = _orientation == Orientation.Vertical
|
|
|
- ? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
|
|
|
- : new (_slider.Frame.X, _slider.Frame.Right - 1);
|
|
|
+ (int start, int end) sliderPos = _orientation == Orientation.Vertical
|
|
|
+ ? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
|
|
|
+ : new (_slider.Frame.X, _slider.Frame.Right - 1);
|
|
|
|
|
|
- if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed) && location < sliderPos.topLeft)
|
|
|
+ if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed) && location < sliderPos.start)
|
|
|
{
|
|
|
- Position = Math.Max (Position - barSize, 0);
|
|
|
+ int distance = sliderPos.start - location;
|
|
|
+ int scrollAmount = (int)((double)distance / barSize * (Size - barSize));
|
|
|
+ Position = Math.Max (Position - scrollAmount, 0);
|
|
|
}
|
|
|
- else if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed) && location > sliderPos.bottomRight)
|
|
|
+ else if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed) && location > sliderPos.end)
|
|
|
{
|
|
|
- Position = Math.Min (Position + barSize, Size - barSize);
|
|
|
+ int distance = location - sliderPos.end;
|
|
|
+ int scrollAmount = (int)((double)distance / barSize * (Size - barSize));
|
|
|
+ Position = Math.Min (Position + scrollAmount, Size - barSize);
|
|
|
}
|
|
|
else if ((mouseEvent.Flags == MouseFlags.WheeledDown && Orientation == Orientation.Vertical)
|
|
|
|| (mouseEvent.Flags == MouseFlags.WheeledRight && Orientation == Orientation.Horizontal))
|