Quellcode durchsuchen

Fixed Adornment.FrameToscreen bug

Tig Kindel vor 1 Jahr
Ursprung
Commit
07647d6139
1 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
  1. 7 5
      Terminal.Gui/View/Adornment/Adornment.cs

+ 7 - 5
Terminal.Gui/View/Adornment/Adornment.cs

@@ -100,17 +100,19 @@ public class Adornment : View
     /// <inheritdoc/>
     public override Rectangle FrameToScreen ()
     {
+        if (Parent is null)
+        {
+            return Frame;
+        }
+
         // Adornments are *Children* of a View, not SubViews. Thus View.FrameToScreen will not work.
         // To get the screen-relative coordinates of a Adornment, we need to know who
         // the Parent is
-        Rectangle ret = Parent?.Frame ?? Frame;
-        ret.Size = Frame.Size;
-
-        ret.Location = Parent?.FrameToScreen ().Location ?? ret.Location;
+        Rectangle parent = Parent.FrameToScreen ();
 
         // We now have coordinates relative to our View. If our View's SuperView has
         // a SuperView, keep going...
-        return ret;
+        return new (new (parent.X + Frame.X, parent.Y + Frame.Y), Frame.Size);
     }
 
     /// <summary>Does nothing for Adornment</summary>