Class: FocusContext

FocusContext

FocusContext manages the focus+context visualization technique for lens-based interaction. It handles the distribution of user interactions between lens movement (focus) and camera movement (context) to maintain optimal viewing conditions.

Key responsibilities:

  • Maintains proper spacing between lens and viewport boundaries
  • Distributes pan and zoom operations between lens and camera
  • Ensures lens stays within valid viewport bounds
  • Adapts camera transform to accommodate lens position
  • Manages lens radius constraints

new FocusContext()

Source:

Methods


<static> adaptContext(viewport, focus, context, desiredScale)

Adjusts the camera transform to ensure focus+context conditions are met for a given lens

Parameters:
Name Type Description
viewport Viewport

The current viewport

focus Focus

The lens object

context Transform

The camera transform to be updated

desiredScale number

Target scale for the camera transform

Source:

<static> pan(viewport, focus, context, delta, imageSize)

Distributes a pan operation between lens movement and camera transform to maintain focus+context

Parameters:
Name Type Description
viewport Viewport

The current viewport

focus Focus

The lens object to be updated

context Transform

The camera transform to be updated

delta Object

Pan amount in dataset pixels

Properties
Name Type Description
x number

Horizontal pan amount

y number

Vertical pan amount

imageSize Object

Dataset dimensions

Properties
Name Type Description
w number

Dataset width

h number

Dataset height

Source:

<static> scale(camera, focus, context, dz)

Distributes a scale operation between lens radius and camera zoom to maintain focus+context

Parameters:
Name Type Description
camera Camera

The camera object containing viewport and zoom constraints

focus Focus

The lens object to be updated

context Transform

The camera transform to be updated

dz number

Scale factor to be applied (multiplier)

Source: