فهرست منبع

Simplified FindDeepestView

Tig Kindel 1 سال پیش
والد
کامیت
19e574916f
2فایلهای تغییر یافته به همراه11 افزوده شده و 16 حذف شده
  1. 1 2
      Terminal.Gui/View/Adornment/Adornment.cs
  2. 10 14
      Terminal.Gui/View/Layout/ViewLayout.cs

+ 1 - 2
Terminal.Gui/View/Adornment/Adornment.cs

@@ -2,7 +2,6 @@
 
 // TODO: Missing 3D effect - 3D effects will be drawn by a mechanism separate from Adornments
 // TODO: If a Adornment has focus, navigation keys (e.g Command.NextView) should cycle through SubViews of the Adornments
-// TODO: Why don't we let Frame.X/Y be the location of the Adornment> Why always 0?
 // QUESTION: How does a user navigate out of an Adornment to another Adornment, or back into the Parent's SubViews?
 
 /// <summary>
@@ -144,7 +143,7 @@ public class Adornment : View
 
         // This just draws/clears the thickness, not the insides.
         Driver.SetAttribute (normalAttr);
-        Thickness.Draw (screenBounds, (string)(Data ?? string.Empty));
+        Thickness.Draw (screenBounds, ToString ());
 
         if (!string.IsNullOrEmpty (TextFormatter.Text))
         {

+ 10 - 14
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -580,13 +580,10 @@ public partial class View
                 return start.Margin;
             }
 
-            // TODO: Move this logic into Adornment? Why can't Adornment.Frame be used?
             if (start.Border.Thickness.Contains (
-                                                 new (
-                                                      start.Frame.X + start.Margin.Thickness.Left,
-                                                      start.Frame.Y + start.Margin.Thickness.Top,
-                                                      start.Frame.Width - start.Margin.Thickness.Horizontal,
-                                                      start.Frame.Height - start.Margin.Thickness.Vertical),
+                                                 start.Border.Frame with { 
+                                                     X = start.Frame.X + start.Border.Frame.X,
+                                                     Y = start.Frame.Y + start.Border.Frame.Y },
                                                  x,
                                                  y))
             {
@@ -594,14 +591,13 @@ public partial class View
             }
 
             if (start.Padding.Thickness.Contains (
-                                                  new (
-                                                       start.Frame.X + start.Margin.Thickness.Left + start.Border.Thickness.Left,
-                                                       start.Frame.Y + start.Margin.Thickness.Top + start.Border.Thickness.Top,
-                                                       start.Frame.Width - start.Margin.Thickness.Horizontal - start.Border.Thickness.Horizontal,
-                                                       start.Frame.Height - start.Margin.Thickness.Vertical - start.Border.Thickness.Vertical),
+                                                  start.Padding.Frame with
+                                                  {
+                                                      X = start.Frame.X + start.Padding.Frame.X,
+                                                      Y = start.Frame.Y + start.Padding.Frame.Y
+                                                  },
                                                   x,
                                                   y))
-
             {
                 return start.Padding;
             }
@@ -716,7 +712,7 @@ public partial class View
         LayoutAdornments ();
 
         Rectangle oldBounds = Bounds;
-        OnLayoutStarted (new() { OldBounds = oldBounds });
+        OnLayoutStarted (new () { OldBounds = oldBounds });
 
         SetTextFormatterSize ();
 
@@ -743,7 +739,7 @@ public partial class View
 
         LayoutNeeded = false;
 
-        OnLayoutComplete (new() { OldBounds = oldBounds });
+        OnLayoutComplete (new () { OldBounds = oldBounds });
     }
 
     /// <summary>Converts a screen-relative coordinate to a bounds-relative coordinate.</summary>