Logo
Effects

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.

Preview

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

NameTypeDescription
baseScalefloatResting scale.
maxScalefloatMaximum scale near the pointer.
influenceRadiusfloatDistance over which magnification applies.
orientationOrientationLayout direction.
scaleDirectionOrientationAxes affected by scaling.
ignoredRectsList<RectTransform>Children excluded from magnification.

Methods

NameParametersDescription
RefreshTargets()NoneRebuilds the managed target list.
GetRestingSize()RectTransform rtReturns a rectangle’s resting size. Returns Vector2.

Example

DockMagnifierExample.cs
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();
    }
}

On this page