Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions AltUI/Controls/DarkScrollBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public int Value
value = Minimum;

var maximumValue = Maximum - ViewSize;
if (maximumValue < Minimum)
maximumValue = Minimum;

if (value > maximumValue)
value = maximumValue;

Expand Down Expand Up @@ -376,13 +379,7 @@ public void ScrollBy(int offset)

public void ScrollByPhysical(int offsetInPixels)
{
var isVert = _scrollOrientation == DarkScrollOrientation.Vertical;

var thumbPos = isVert ? (_thumbArea.Top - _trackArea.Top) : (_thumbArea.Left - _trackArea.Left);

var newPosition = thumbPos - offsetInPixels;

ScrollToPhysical(newPosition);
Value += offsetInPixels;
}

public void UpdateScrollBar()
Expand Down
11 changes: 7 additions & 4 deletions AltUI/Controls/DarkScrollBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public abstract class DarkScrollBase : Control

#region Property Region

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int MouseScrollPixelStep { get; set; } = 20;

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
Expand Down Expand Up @@ -323,16 +326,16 @@ protected override void OnMouseWheel(MouseEventArgs e)
if (!horizontal)
{
if (e.Delta > 0)
_vScrollBar.ScrollByPhysical(3);
_vScrollBar.ScrollByPhysical(-MouseScrollPixelStep);
else if (e.Delta < 0)
_vScrollBar.ScrollByPhysical(-3);
_vScrollBar.ScrollByPhysical(MouseScrollPixelStep);
}
else
{
if (e.Delta > 0)
_hScrollBar.ScrollByPhysical(3);
_hScrollBar.ScrollByPhysical(-MouseScrollPixelStep);
else if (e.Delta < 0)
_hScrollBar.ScrollByPhysical(-3);
_hScrollBar.ScrollByPhysical(MouseScrollPixelStep);
}
}

Expand Down