Class: Ruler

Ruler


new Ruler(viewer, pixelSize [, options])

Creates a new Ruler instance.

Parameters:
Name Type Argument Description
viewer Viewer

The OpenLIME viewer instance

pixelSize number

Size of a pixel in real-world units

options Object <optional>

Configuration options

Properties
Name Type Argument Default Description
enabled boolean <optional>
false

Whether the ruler is initially enabled

priority number <optional>
100

Event handling priority

fontSize number <optional>
18

Font size for measurements in pixels

markerSize number <optional>
8

Size of measurement markers in pixels

cursor string <optional>
'crosshair'

Cursor style when ruler is active

Source:

Methods


clear()

Clears all measurements. Removes all SVG elements and resets measurement history.

Source:

end()

Deactivates the ruler tool. Restores original cursor and clears current measurement.

Source:

start()

Activates the ruler tool. Creates SVG elements if needed and sets up event listeners. Changes cursor to indicate tool is active.

Source: