This commit is contained in:
Tig
2024-05-08 16:51:21 -06:00
parent a9b0591c7d
commit 14beaefe5c
2 changed files with 8 additions and 12 deletions

View File

@@ -135,7 +135,7 @@ public class Adornment : View
}
/// <inheritdoc/>
public override Point ScreenToFrame (Point location)
public override Point ScreenToFrame (in Point location)
{
return Parent.ScreenToFrame (new (location.X - Frame.X, location.Y - Frame.Y));
}

View File

@@ -88,15 +88,13 @@ public partial class View
}
}
private void SetFrame (Rectangle frame)
private void SetFrame (in Rectangle frame)
{
var oldViewport = Rectangle.Empty;
Size? oldContentSize = null;
if (IsInitialized)
{
oldViewport = Viewport;
oldContentSize = ContentSize;
}
// This is the only place where _frame should be set directly. Use Frame = or SetFrame instead.
@@ -148,7 +146,7 @@ public partial class View
/// </summary>
/// <returns>The coordinate relative to the <see cref="SuperView"/>'s <see cref="Viewport"/>.</returns>
/// <param name="location">Screen-relative coordinate.</param>
public virtual Point ScreenToFrame (Point location)
public virtual Point ScreenToFrame (in Point location)
{
if (SuperView is null)
{
@@ -156,15 +154,13 @@ public partial class View
}
Point superViewViewportOffset = SuperView.GetViewportOffsetFromFrame ();
superViewViewportOffset.X -= SuperView.Viewport.X;
superViewViewportOffset.Y -= SuperView.Viewport.Y;
superViewViewportOffset.Offset(-SuperView.Viewport.X, -SuperView.Viewport.Y);
location.X -= superViewViewportOffset.X;
location.Y -= superViewViewportOffset.Y;
Point frame = location;
frame.Offset(-superViewViewportOffset.X, -superViewViewportOffset.Y);
Point frame = SuperView.ScreenToFrame (location);
frame.X -= Frame.X;
frame.Y -= Frame.Y;
frame = SuperView.ScreenToFrame (frame);
frame.Offset (-Frame.X, -Frame.Y);
return frame;
}