More appropriate solution for the issue #2331.

This commit is contained in:
BDisp
2023-02-09 23:41:27 +00:00
parent 895b3894f5
commit 51c64babc7
2 changed files with 16 additions and 7 deletions

View File

@@ -1575,8 +1575,18 @@ namespace Terminal.Gui {
var driverClip = Driver == null ? Rect.Empty : Driver.Clip;
containerBounds.X = Math.Max (containerBounds.X, driverClip.X);
containerBounds.Y = Math.Max (containerBounds.Y, driverClip.Y);
containerBounds.Width = Math.Min (containerBounds.Width, driverClip.Width);
containerBounds.Height = Math.Min (containerBounds.Height, driverClip.Height);
var lenOffset = (driverClip.X + driverClip.Width) - (containerBounds.X + containerBounds.Width);
if (containerBounds.X + containerBounds.Width > driverClip.X + driverClip.Width) {
containerBounds.Width = Math.Max (containerBounds.Width + lenOffset, 0);
} else {
containerBounds.Width = Math.Min (containerBounds.Width, driverClip.Width);
}
lenOffset = (driverClip.Y + driverClip.Height) - (containerBounds.Y + containerBounds.Height);
if (containerBounds.Y + containerBounds.Height > driverClip.Y + driverClip.Height) {
containerBounds.Height = Math.Max (containerBounds.Height + lenOffset, 0);
} else {
containerBounds.Height = Math.Min (containerBounds.Height, driverClip.Height);
}
return containerBounds;
}

View File

@@ -329,11 +329,10 @@ namespace Terminal.Gui {
//Clear ();
var savedClip = ClipToBounds ();
var rect = new Rect (new Point (-contentView.Frame.X, -contentView.Frame.Y),
OnDrawContent (new Rect (ContentOffset,
new Size (Math.Max (Bounds.Width - (ShowVerticalScrollIndicator ? 1 : 0), 0),
Math.Max (Bounds.Height - (ShowHorizontalScrollIndicator ? 1 : 0), 0)));
OnDrawContent (rect);
contentView.Redraw (rect);
Math.Max (Bounds.Height - (ShowHorizontalScrollIndicator ? 1 : 0), 0))));
contentView.Redraw (contentView.Frame);
Driver.Clip = savedClip;
if (autoHideScrollBars) {
@@ -509,7 +508,7 @@ namespace Terminal.Gui {
{
if (me.Flags != MouseFlags.WheeledDown && me.Flags != MouseFlags.WheeledUp &&
me.Flags != MouseFlags.WheeledRight && me.Flags != MouseFlags.WheeledLeft &&
// me.Flags != MouseFlags.Button1Pressed && me.Flags != MouseFlags.Button1Clicked &&
// me.Flags != MouseFlags.Button1Pressed && me.Flags != MouseFlags.Button1Clicked &&
!me.Flags.HasFlag (MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition)) {
return false;
}