# Two.ZUI

Two.ZUI is an extra class to turn your Two.js scene into a Google Maps or Adobe Illustrator style interface. See https://codepen.io/jonobr1/pen/PobMKwb (opens new window) for example usage.

# Constructor

Argument Description
group The scene or group to
domElement The HTML Element to attach event listeners to.

# addLimits

Argument Description
min The minimum scale the ZUI can zoom out to.
max The maximum scale teh ZUI can zoom in to.

# clientToSurface

Returns: Two.Vector

Argument Description
x The x position of the user's input.
y The y position of the user's input.

Convert an x, y coordinate in user space into projected space.

# surfaceToClient

Argument Description

Convert an x, y coordinate in projected space to the user's space.

# zoomBy

Argument Description
byF The factor to scale by.
clientX The x position of the user's input.
clientY The y position of the user's input.

A function to zoom by an incremental amount and a position. Typically used for pinch-and-zoom or mousewheel effects.

# zoomSet

Argument Description
zoom The level of the zoom.
clientX The x position of the user's input.
clientY The y position of the user's input.

A function to set the zoom amount and the origin position. This is used internally by {@Two.ZUI#zoomBy}.

# translateSurface

Argument Description
x The x amount to pan.
y The y amount to pan.

Set the position of the ZUI by an incremental translation amount.

# reset

Reset the zoom and scale factors to their original instantiated state.