Explorar o código

Fixes Label text alignment.

BDisp %!s(int64=5) %!d(string=hai) anos
pai
achega
771bc93141
Modificáronse 2 ficheiros con 6 adicións e 6 borrados
  1. 3 3
      Terminal.Gui/Views/Label.cs
  2. 3 3
      UICatalog/Scenarios/Keys.cs

+ 3 - 3
Terminal.Gui/Views/Label.cs

@@ -183,13 +183,13 @@ namespace Terminal.Gui {
 					break;
 				case TextAlignment.Justified:
 					Recalc ();
-					x = Frame.Left;
+					x = Bounds.Left;
 					break;
 				case TextAlignment.Right:
-					x = Frame.Right - str.Length;
+					x = Bounds.Right - str.Length;
 					break;
 				case TextAlignment.Centered:
-					x = Frame.Left + (Frame.Width - str.Length) / 2;
+					x = Bounds.Left + (Bounds.Width - str.Length) / 2;
 					break;
 				default:
 					throw new ArgumentOutOfRangeException ();

+ 3 - 3
UICatalog/Scenarios/Keys.cs

@@ -83,11 +83,11 @@ namespace UICatalog {
 			};
 			Win.Add (keyPressedLabel);
 			// BUGBUG: Label is not positioning right with Pos, so using TextField instead
-			var labelKeypress = new TextField ("") {
-				X = Pos.Right (keyPressedLabel) + 1,
+			var labelKeypress = new Label ("") {
+				X = Pos.Left (edit),
 				Y = Pos.Top (keyPressedLabel),
 				Width = 20,
-				//TextAlignment = Terminal.Gui.TextAlignment.Left,
+				TextAlignment = Terminal.Gui.TextAlignment.Centered,
 				ColorScheme = Colors.Error,
 			};
 			Win.Add (labelKeypress);