Fixed bugs

This commit is contained in:
Tig
2024-11-10 09:25:39 -07:00
parent f206bb06c3
commit 6f9816bbb8
3 changed files with 18 additions and 11 deletions

View File

@@ -143,7 +143,8 @@ public class Scroll : View, IOrientation, IDesignable
}
int framePos = Orientation == Orientation.Vertical ? args.CurrentValue.Y : args.CurrentValue.X;
SliderPosition = framePos;
RaiseSliderPositionChangeEvents (CalculateSliderPosition (_contentPosition), framePos);
}
/// <summary>
@@ -152,13 +153,11 @@ public class Scroll : View, IOrientation, IDesignable
public int SliderPosition
{
get => CalculateSliderPosition (_contentPosition);
set => RaiseSliderPositionChangeEvents (value);
set => RaiseSliderPositionChangeEvents (_slider.Position, value);
}
private void RaiseSliderPositionChangeEvents (int newSliderPosition)
private void RaiseSliderPositionChangeEvents (int currentSliderPosition, int newSliderPosition)
{
int currentSliderPosition = CalculateSliderPosition (_contentPosition);
if (/*newSliderPosition > Size - ViewportDimension ||*/ currentSliderPosition == newSliderPosition)
{
return;

View File

@@ -154,11 +154,11 @@ public class ScrollBar : View, IOrientation, IDesignable
if (Orientation == Orientation.Vertical)
{
Visible = Frame.Height - (_decreaseButton.Frame.Height + _increaseButton.Frame.Height) < Size;
Visible = Frame.Height < Size;
}
else
{
Visible = Frame.Width - (_decreaseButton.Frame.Width + _increaseButton.Frame.Width) < Size;
Visible = Frame.Width < Size;
}
}
@@ -208,8 +208,16 @@ public class ScrollBar : View, IOrientation, IDesignable
/// </summary>
public int Size
{
get => _scroll.Size;
set => _scroll.Size = value;
get
{
// Add two for increment/decrement buttons
return _scroll.Size + 2;
}
set
{
// Remove two for increment/decrement buttons
_scroll.Size = value - 2;
}
}
/// <summary>

View File

@@ -346,7 +346,7 @@ internal class CharMap : View, IDesignable
//ViewportSettings = ViewportSettings.AllowLocationGreaterThanContentSize;
SetContentSize (new (COLUMN_WIDTH * 16 + RowLabelWidth, _maxCodePoint / 16 * _rowHeight)); // +1 for Header
SetContentSize (new (COLUMN_WIDTH * 16 + RowLabelWidth, _maxCodePoint / 16 * _rowHeight + 1)); // +1 for Header
AddCommand (
Command.Up,
@@ -483,7 +483,7 @@ internal class CharMap : View, IDesignable
{
Viewport = Viewport with
{
Y = Math.Min (args.CurrentValue, GetContentSize ().Height - (Viewport.Height - 2))
Y = Math.Min (args.CurrentValue, GetContentSize ().Height - (Viewport.Height - 1))
};
}
};