mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
More autosize related tweaks
This commit is contained in:
@@ -21,7 +21,7 @@ public class Scroll : View
|
||||
CanFocus = false;
|
||||
Orientation = Orientation.Vertical;
|
||||
Width = Dim.Auto (DimAutoStyle.Content, 1);
|
||||
Height = Dim.Auto (DimAutoStyle.Content);
|
||||
Height = Dim.Auto (DimAutoStyle.Content, 1);
|
||||
|
||||
_slider = new ()
|
||||
{
|
||||
@@ -69,7 +69,7 @@ public class Scroll : View
|
||||
get => _position;
|
||||
set
|
||||
{
|
||||
int barSize = Orientation == Orientation.Vertical ? Frame.Height : Frame.Width;
|
||||
int barSize = Orientation == Orientation.Vertical ? ContentSize.Height : ContentSize.Width;
|
||||
|
||||
if (value < 0 || (value > 0 && value + barSize > Size))
|
||||
{
|
||||
@@ -232,7 +232,7 @@ public class Scroll : View
|
||||
{
|
||||
MouseEvent me = e.MouseEvent;
|
||||
int location = Orientation == Orientation.Vertical ? me.Position.Y : me.Position.X;
|
||||
int barSize = Orientation == Orientation.Vertical ? Frame.Height : Frame.Width;
|
||||
int barSize = Orientation == Orientation.Vertical ? ContentSize.Height : ContentSize.Width;
|
||||
|
||||
(int topLeft, int bottomRight) sliderPos = _orientation == Orientation.Vertical
|
||||
? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
|
||||
@@ -285,13 +285,13 @@ public class Scroll : View
|
||||
Text = string.Concat (
|
||||
Enumerable.Repeat (
|
||||
Glyphs.Stipple.ToString (),
|
||||
Frame.Width * Frame.Height));
|
||||
ContentSize.Width * ContentSize.Height));
|
||||
_slider.TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;
|
||||
|
||||
_slider.Text = string.Concat (
|
||||
Enumerable.Repeat (
|
||||
Glyphs.ContinuousMeterSegment.ToString (),
|
||||
_slider.Frame.Width * _slider.Frame.Height));
|
||||
_slider.ContentSize.Width * _slider.ContentSize.Height));
|
||||
}
|
||||
|
||||
private void AdjustSlider ()
|
||||
@@ -318,7 +318,7 @@ public class Scroll : View
|
||||
{
|
||||
MouseEvent me = e.MouseEvent;
|
||||
int location = Orientation == Orientation.Vertical ? me.Position.Y : me.Position.X;
|
||||
int barSize = Orientation == Orientation.Vertical ? Frame.Height : Frame.Width;
|
||||
int barSize = Orientation == Orientation.Vertical ? ContentSize.Height : ContentSize.Width;
|
||||
int offset = _lastLocation > -1 ? location - _lastLocation : 0;
|
||||
|
||||
if (me.Flags == MouseFlags.Button1Pressed)
|
||||
|
||||
@@ -92,6 +92,7 @@ public class ScrollDemo : Scenario
|
||||
{
|
||||
scroll.Orientation = Orientation.Vertical;
|
||||
scroll.X = Pos.AnchorEnd ();
|
||||
scroll.Y = 0;
|
||||
scroll.Width = scrollWidthHeight.Value;
|
||||
scroll.Height = Dim.Fill ();
|
||||
scroll.Size /= 3;
|
||||
@@ -99,6 +100,7 @@ public class ScrollDemo : Scenario
|
||||
else
|
||||
{
|
||||
scroll.Orientation = Orientation.Horizontal;
|
||||
scroll.X = 0;
|
||||
scroll.Y = Pos.AnchorEnd ();
|
||||
scroll.Width = Dim.Fill ();
|
||||
scroll.Height = scrollWidthHeight.Value;
|
||||
@@ -218,7 +220,7 @@ public class ScrollDemo : Scenario
|
||||
editor.Initialized += (s, e) =>
|
||||
{
|
||||
scroll.Size = int.Max (app.ContentSize.Height * 2, app.ContentSize.Width * 2);
|
||||
editor.ViewToEdit = view;
|
||||
editor.ViewToEdit = scroll;
|
||||
};
|
||||
|
||||
app.Closed += (s, e) => View.Diagnostics = _diagnosticFlags;
|
||||
|
||||
Reference in New Issue
Block a user