浏览代码

Reverting the draw text.

BDisp 4 年之前
父节点
当前提交
69200a2f85
共有 1 个文件被更改,包括 13 次插入29 次删除
  1. 13 29
      Terminal.Gui/Core/View.cs

+ 13 - 29
Terminal.Gui/Core/View.cs

@@ -1338,7 +1338,18 @@ namespace Terminal.Gui {
 
 
 			var clipRect = new Rect (Point.Empty, frame.Size);
 			var clipRect = new Rect (Point.Empty, frame.Size);
 
 
-			DrawText ();
+			if (ColorScheme != null) {
+				Driver.SetAttribute (HasFocus ? ColorScheme.Focus : ColorScheme.Normal);
+			}
+
+			if (!ustring.IsNullOrEmpty (Text) || (this is Label && !AutoSize)) {
+				Clear ();
+				// Draw any Text
+				if (textFormatter != null) {
+					textFormatter.NeedsFormat = true;
+				}
+				textFormatter?.Draw (ViewToScreen (Bounds), HasFocus ? ColorScheme.Focus : ColorScheme.Normal, HasFocus ? ColorScheme.HotFocus : ColorScheme.HotNormal);
+			}
 
 
 			// Invoke DrawContentEvent
 			// Invoke DrawContentEvent
 			OnDrawContent (bounds);
 			OnDrawContent (bounds);
@@ -1366,33 +1377,6 @@ namespace Terminal.Gui {
 			ClearNeedsDisplay ();
 			ClearNeedsDisplay ();
 		}
 		}
 
 
-		void DrawText ()
-		{
-			if (ColorScheme != null) {
-				Driver.SetAttribute (HasFocus ? ColorScheme.Focus : ColorScheme.Normal);
-			}
-
-			if (!ustring.IsNullOrEmpty (Text)) {
-				var savedClip = ClipToBounds ();
-				Rect viewBounds = Bounds;
-				if (SuperView != null && viewBounds.Width > SuperView.Bounds.Width) {
-					viewBounds.Width = SuperView.Bounds.Width;
-				}
-				if (SuperView != null && viewBounds.Height > SuperView.Bounds.Height) {
-					viewBounds.Height = SuperView.Bounds.Height;
-				}
-				var viewFrame = ViewToScreen (viewBounds);
-				Clear (viewFrame);
-				// Draw any Text
-				if (textFormatter != null) {
-					textFormatter.NeedsFormat = true;
-				}
-				textFormatter?.Draw (viewFrame, HasFocus ? ColorScheme.Focus : ColorScheme.Normal, HasFocus ? ColorScheme.HotFocus : ColorScheme.HotNormal);
-
-				Driver.Clip = savedClip;
-			}
-		}
-
 		/// <summary>
 		/// <summary>
 		/// Event invoked when the content area of the View is to be drawn.
 		/// Event invoked when the content area of the View is to be drawn.
 		/// </summary>
 		/// </summary>
@@ -2276,7 +2260,7 @@ namespace Terminal.Gui {
 		/// </summary>
 		/// </summary>
 		public bool Visible { get; set; } = true;
 		public bool Visible { get; set; } = true;
 
 
-		internal bool CanBeVisible (View view)
+		bool CanBeVisible (View view)
 		{
 		{
 			if (!view.Visible) {
 			if (!view.Visible) {
 				return false;
 				return false;