Class: Scrubbable
Defined in: src/interaction/Scrubbable.ts:62
Scrubbable: drag a DecimalNumber to change its value, in place.
Like a Tangle / wigglystuff TangleLatex number: the number does not move;
the drag distance along one axis maps to a value change. The value is
snapped to step, clamped to [min, max], written with setValue() and
reported through onChange.
Uses Pointer Events, so mouse, pen and touch all work.
Example
const a = new DecimalNumber({ value: 1, numDecimalPlaces: 1 });
scene.add(a);
makeScrubbable(a, scene, { min: -5, max: 5, step: 0.1, onChange: (v) => redraw(v) });
Constructors
Constructor
new Scrubbable(
decimal,scene,options):Scrubbable
Defined in: src/interaction/Scrubbable.ts:87
Parameters
decimal
The number to scrub. Its position never changes.
scene
The scene whose canvas receives the pointer events.
options
ScrubbableOptions = {}
Scrub configuration.
Returns
Scrubbable
Accessors
decimal
Get Signature
get decimal():
DecimalNumber
Defined in: src/interaction/Scrubbable.ts:112
The number this behavior scrubs.
Returns
isEnabled
Get Signature
get isEnabled():
boolean
Defined in: src/interaction/Scrubbable.ts:122
Whether scrubbing is enabled.
Returns
boolean
isScrubbing
Get Signature
get isScrubbing():
boolean
Defined in: src/interaction/Scrubbable.ts:117
Whether a scrub gesture is in progress.
Returns
boolean
Methods
disable()
disable():
void
Defined in: src/interaction/Scrubbable.ts:132
Disable scrubbing. A scrub in progress ends at once.
Returns
void
dispose()
dispose():
void
Defined in: src/interaction/Scrubbable.ts:139
Remove all event listeners and release the cursor.
Returns
void
enable()
enable():
void
Defined in: src/interaction/Scrubbable.ts:127
Enable scrubbing.
Returns
void