Fixed Adornment.FrameToscreen bug

This commit is contained in:
Tig Kindel
2024-02-27 09:59:45 -07:00
parent f8283ecc83
commit 07647d6139

View File

@@ -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>