mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-06 17:58:05 +02:00
Add GetLocalPosition to controls (#4872)
* Add GetLocalPosition to controls In my case I want the mouse's position inside of the control to show something under it unless there's a better way. * weh --------- Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
co-authored by
Pieter-Jan Briers
parent
7cee5b67a7
commit
754d5a1fbb
@@ -468,6 +468,14 @@ namespace Robust.Client.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the screen coordinates position relative to the control.
|
||||
/// </summary>
|
||||
public Vector2 GetLocalPosition(ScreenCoordinates coordinates)
|
||||
{
|
||||
return coordinates.Position - GlobalPixelPosition;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notify the layout system that this control's <see cref="Measure"/> result may have changed
|
||||
/// and must be recalculated.
|
||||
|
||||
Reference in New Issue
Block a user