Dock Magnifier
Enlarge nearby items as the pointer moves along a dock
Overview
Dock Magnifier scales nearby UI items according to their distance from the pointer. It can be used for a toolbar, dock, or row of shortcuts.
Usage
Add Dock Magnifier to a container of UI rectangles.
Choose the layout orientation and scale direction.
Set base scale, maximum scale, and influence radius.
Add exceptions to Ignored Rects when some children should not magnify.
Customization
Axis Bias adjusts how the layout axis influences distance. Smooth Time controls how quickly items reach their target scales. Pointer-inside and hover-refresh options control when calculations run.
Public API
Use DockMagnifier in the Evo.UI namespace.
After changing the child hierarchy, call RefreshTargets(). GetRestingSize() returns an item’s unexpanded size for layout coordination.
Fields
| Name | Type | Description |
|---|---|---|
baseScale | float | Resting scale. |
maxScale | float | Maximum scale near the pointer. |
influenceRadius | float | Distance over which magnification applies. |
orientation | Orientation | Layout direction. |
scaleDirection | Orientation | Axes affected by scaling. |
ignoredRects | List<RectTransform> | Children excluded from magnification. |
Methods
| Name | Parameters | Description |
|---|---|---|
RefreshTargets() | None | Rebuilds the managed target list. |
GetRestingSize() | RectTransform rt | Returns a rectangle’s resting size. Returns Vector2. |
Example
using UnityEngine;
using Evo.UI;
public class DockMagnifierExample : MonoBehaviour
{
[SerializeField] private DockMagnifier target;
private void Start()
{
target.maxScale = 1.4f;
target.influenceRadius = 140f;
target.RefreshTargets();
}
}