Browse Source

GetContainerBounds already has called ViewToScreen, so do the same to GetNeedDisplay and fixing some typo.

BDisp 2 years ago
parent
commit
886cfc6a8e
1 changed files with 7 additions and 8 deletions
  1. 7 8
      Terminal.Gui/Core/View.cs

+ 7 - 8
Terminal.Gui/Core/View.cs

@@ -1527,7 +1527,7 @@ namespace Terminal.Gui {
 
 
 			if (!ustring.IsNullOrEmpty (TextFormatter.Text)) {
 			if (!ustring.IsNullOrEmpty (TextFormatter.Text)) {
 				Rect containerBounds = GetContainerBounds ();
 				Rect containerBounds = GetContainerBounds ();
-				Clear (ViewToScreen (GetNeedDisplay (containerBounds)));
+				Clear (GetNeedDisplay (containerBounds));
 				SetChildNeedsDisplay ();
 				SetChildNeedsDisplay ();
 				// Draw any Text
 				// Draw any Text
 				if (TextFormatter != null) {
 				if (TextFormatter != null) {
@@ -1573,7 +1573,7 @@ namespace Terminal.Gui {
 
 
 		Rect GetNeedDisplay (Rect containerBounds)
 		Rect GetNeedDisplay (Rect containerBounds)
 		{
 		{
-			Rect rect = NeedDisplay;
+			Rect rect = ViewToScreen (NeedDisplay);
 			if (!containerBounds.IsEmpty) {
 			if (!containerBounds.IsEmpty) {
 				rect.Width = Math.Min (NeedDisplay.Width, containerBounds.Width);
 				rect.Width = Math.Min (NeedDisplay.Width, containerBounds.Width);
 				rect.Height = Math.Min (NeedDisplay.Height, containerBounds.Height);
 				rect.Height = Math.Min (NeedDisplay.Height, containerBounds.Height);
@@ -2214,8 +2214,7 @@ namespace Terminal.Gui {
 					newLocation = pos.Anchor (superviewDimension - newDimension);
 					newLocation = pos.Anchor (superviewDimension - newDimension);
 					break;
 					break;
 
 
-				case Pos.PosCombine:
-					var combine = pos as Pos.PosCombine;
+				case Pos.PosCombine combine:
 					int left, right;
 					int left, right;
 					(left, newDimension) = GetNewLocationAndDimension (superviewLocation, superviewDimension, combine.left, dim, autosizeDimension);
 					(left, newDimension) = GetNewLocationAndDimension (superviewLocation, superviewDimension, combine.left, dim, autosizeDimension);
 					(right, newDimension) = GetNewLocationAndDimension (superviewLocation, superviewDimension, combine.right, dim, autosizeDimension);
 					(right, newDimension) = GetNewLocationAndDimension (superviewLocation, superviewDimension, combine.right, dim, autosizeDimension);
@@ -2242,7 +2241,7 @@ namespace Terminal.Gui {
 
 
 			// Recursively calculates the new dimension (width or height) of the given Dim given:
 			// Recursively calculates the new dimension (width or height) of the given Dim given:
 			//   the current location (x or y)
 			//   the current location (x or y)
-			//   the current dimennsion (width or height)
+			//   the current dimension (width or height)
 			int CalculateNewDimension (Dim d, int location, int dimension, int autosize)
 			int CalculateNewDimension (Dim d, int location, int dimension, int autosize)
 			{
 			{
 				int newDimension;
 				int newDimension;
@@ -2277,11 +2276,11 @@ namespace Terminal.Gui {
 			}
 			}
 
 
 
 
-			// horiztonal
-			(newX, newW) = GetNewLocationAndDimension (superviewFrame.X, superviewFrame.Width, x, Width, autosize.Width);
+			// horizontal
+			(newX, newW) = GetNewLocationAndDimension (superviewFrame.X, superviewFrame.Width, x, width, autosize.Width);
 
 
 			// vertical
 			// vertical
-			(newY, newH) = GetNewLocationAndDimension (superviewFrame.Y, superviewFrame.Height, y, Height, autosize.Height);
+			(newY, newH) = GetNewLocationAndDimension (superviewFrame.Y, superviewFrame.Height, y, height, autosize.Height);
 
 
 			var r = new Rect (newX, newY, newW, newH);
 			var r = new Rect (newX, newY, newW, newH);
 			if (Frame != r) {
 			if (Frame != r) {