Class: ControllerLens

ControllerLens

Controller for handling lens-based interactions. Manages user interactions with a lens overlay including panning, zooming, and lens radius adjustments through mouse/touch events.


new ControllerLens(options)

Creates a new ControllerLens instance.

Parameters:
Name Type Description
options Object

Configuration options

Properties
Name Type Argument Default Description
lensLayer Object

Layer used for lens visualization

camera Camera

Camera instance to control

useGL boolean <optional>
false

Whether to use WebGL coordinates

active boolean <optional>
true

Whether the controller is initially active

Source:
Throws:

If required options (lensLayer, camera) are missing

Type
Error

Extends

Methods


<abstract> fingerDoubleTap(e)

Called for quick double mouse press or double finger touch.

Parameters:
Name Type Description
e Event

The double tap event

Inherited From:
Overrides:
Source:

<abstract> fingerSingleTap(e)

Called for quick mouse press or short finger touch.

Parameters:
Name Type Description
e Event

The tap event

Inherited From:
Overrides:
Source:

getFocus()

Gets current focus state.

Source:
Returns:

Focus state object

Type
Object

getPixelPosition(e)

Converts position from canvas HTML coordinates to viewport coordinates.

Parameters:
Name Type Description
e PointerEvent

event

Source:
Returns:

Position in viewport coordinates (origin at bottom-left, y up)

Type
Object

getScenePosition(e)

Converts position from canvas HTML coordinates to scene coordinates.

Parameters:
Name Type Description
e PointerEvent

event

Source:
Returns:

Position in scene coordinates (origin at center, y up)

Type
Object

isInsideLens(p)

Checks if a point is inside the lens.

Parameters:
Name Type Description
p Object

Point to check in scene coordinates

Properties
Name Type Description
x number

X coordinate

y number

Y coordinate

Source:
Returns:

Whether point is inside lens and/or on border

Type
Object

modifierState(e)

Gets the modifier state from an event.

Parameters:
Name Type Description
e Event

The event to check

Inherited From:
Overrides:
Source:
Returns:

Modifier state bitmask where:

  • 0 = No modifiers
  • 1 = Ctrl key
  • 2 = Shift key
  • 4 = Alt key Multiple modifiers combine their values (e.g., Ctrl+Shift = 3)
Type
number

mouseWheel(e)

Handles mouse wheel events.

Parameters:
Name Type Description
e WheelEvent

Wheel event

Inherited From:
Overrides:
Source:
Returns:

True if event was handled

Type
boolean

panEnd(e)

Handles end of pan operation.

Parameters:
Name Type Description
e PointerEvent

Pan end event

Inherited From:
Overrides:
Source:

panMove(e)

Handles pan movement.

Parameters:
Name Type Description
e PointerEvent

Pan move event

Inherited From:
Overrides:
Source:

panStart(e)

Handles start of pan operation.

Parameters:
Name Type Description
e PointerEvent

Pan start event

Inherited From:
Overrides:
Source:

pinchEnd(e, x, y, scale)

Handles end of pinch operation.

Parameters:
Name Type Description
e PointerEvent

End event

x number

X coordinate

y number

Y coordinate

scale number

Final scale value

Inherited From:
Overrides:
Source:

pinchMove(e1, e2)

Handles pinch movement.

Parameters:
Name Type Description
e1 PointerEvent

First finger event

e2 PointerEvent

Second finger event

Inherited From:
Overrides:
Source:

pinchStart(e1, e2)

Handles start of pinch operation.

Parameters:
Name Type Description
e1 PointerEvent

First finger event

e2 PointerEvent

Second finger event

Inherited From:
Overrides:
Source:

zoomEnd()

Ends zoom operation.

Source:

zoomMove(pe)

Updates zoom when dragging lens border.

Parameters:
Name Type Description
pe Object

Pixel position in canvas coordinates

Properties
Name Type Description
offsetX number

X offset from canvas left

offsetY number

Y offset from canvas top

Source:

zoomStart(pe)

Initiates zoom operation when clicking on lens border.

Parameters:
Name Type Description
pe Object

Pixel position in canvas coordinates

Properties
Name Type Description
offsetX number

X offset from canvas left

offsetY number

Y offset from canvas top

Source: