Show:

Wrapper for DOM wheel/mousewheel events. Converts scroll events to start, update and end events and emits them with the payload:

 value     - Scroll displacement in pixels from start
 delta     - Scroll differential in pixels between subsequent events
 velocity  - Velocity of scroll
 event     - Original DOM event

Constructor

Inputs.ScrollInput

(
  • [options]
)

Parameters:

  • [options] Object optional

    Options

    • [direction] Number optional

      Direction to project movement onto. Options found in TouchInput.DIRECTION.

    • [scale=1] Number optional

      Scale the response to the mouse

Example:

 var scrollInput = new ScrollInput();
        
         scrollInput.subscribe(surface)
        
         scrollInput.on('start', function(payload){
             console.log('start', payload);
         });
        
         scrollInput.on('update', function(payload){
             console.log('update', payload);
         });
        
         scrollInput.on('end', function(payload){
             console.log('end', payload);
         });

Item Index

Methods

Properties

Methods

filter

(
  • filterFn
)
SimpleStream

Inherited from Streams.SimpleStream:

Filter converts the current stream into a new stream that only emits if the filter condition is satisfied. The filter function should return a Boolean value.

Parameters:

  • filterFn Function
    Function to filter event payload

Returns:

SimpleStream: stream Filtered stream

map

(
  • mapperFn
)
SimpleStream

Inherited from Streams.SimpleStream:

Map converts the current stream into a new stream with a modified (mapped) data payload.

Parameters:

  • mapperFn Function
    Function to map event payload

Returns:

SimpleStream: stream Mapped stream

pluck

(
  • key
)
SimpleStream

Inherited from Streams.SimpleStream:

Pluck is an opinionated mapper. It projects a Stream onto one of its return values. Useful if a Stream returns an array or object.

Parameters:

Returns:

SimpleStream: stream Plucked stream

split

(
  • splitterFn
)

Inherited from Streams.SimpleStream:

Split maps one of several streams based on custom logic. The splitter function should return an EventEmitter type.

Parameters:

Properties

DIRECTION

Object static

Constrain the input along a specific axis.

Sub-properties: