ChangeCoordinatesTo
Transforms a point from the local space of an element to the local space of another element.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
ChangeCoordinatesTo(VisualElement, VisualElement, Vector2)
Transforms a point from the local space of an element to the local space of another element.
public static Vector2 ChangeCoordinatesTo(this VisualElement src, VisualElement dest, Vector2 point)
Parameters
The element to use as a reference as the source local space.
The element to use as a reference as the destination local space.
The point to transform, in the local space of the source element.
Returns
Type | Description |
|---|---|
| Vector2 | A point in the local space of destination element. |
Remarks
The elements both need to be attached to a panel and must receive a valid VisualElement.layout. Otherwise, this method may return invalid results.
ChangeCoordinatesTo(VisualElement, VisualElement, Rect)
Transforms a rectangle from the local space of an element to the local space of another element.
public static Rect ChangeCoordinatesTo(this VisualElement src, VisualElement dest, Rect rect)
Parameters
The element to use as a reference as the source local space.
The element to use as a reference as the destination local space.
The rectangle to transform, in the local space of the source element.
Returns
Type | Description |
|---|---|
| Rect | A rectangle in the local space of destination element. |
Remarks
The elements both need to be attached to a panel and have received a valid VisualElement.layout. Otherwise, this method may return invalid results.