Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SnapPoint.cs
Go to the documentation of this file.
3
4namespace Terraria.UI;
5
6[DebuggerDisplay("Snap Point - {Name} {Id}")]
7public class SnapPoint
8{
9 public string Name;
10
12
14
15 public int Id { get; private set; }
16
17 public Vector2 Position { get; private set; }
18
19 public SnapPoint(string name, int id, Vector2 anchor, Vector2 offset)
20 {
21 Name = name;
22 Id = id;
23 _anchor = anchor;
24 _offset = offset;
25 }
26
27 public void Calculate(UIElement element)
28 {
29 CalculatedStyle dimensions = element.GetDimensions();
30 Position = dimensions.Position() + _offset + _anchor * new Vector2(dimensions.Width, dimensions.Height);
31 }
32
33 public void ThisIsAHackThatChangesTheSnapPointsInfo(Vector2 anchor, Vector2 offset, int id)
34 {
35 _anchor = anchor;
36 _offset = offset;
37 Id = id;
38 }
39}
void Calculate(UIElement element)
Definition SnapPoint.cs:27
SnapPoint(string name, int id, Vector2 anchor, Vector2 offset)
Definition SnapPoint.cs:19
void ThisIsAHackThatChangesTheSnapPointsInfo(Vector2 anchor, Vector2 offset, int id)
Definition SnapPoint.cs:33
CalculatedStyle GetDimensions()
Definition UIElement.cs:382