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,
 clientX   - DOM event clientX property
 clientY   - DOM event clientY property
 offsetX   - DOM event offsetX property
 offsetY   - DOM event offsetY property

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(Engine) // listens on window events
        
         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);
         });

Methods

"on"

(
  • type
  • handler
)

Inherited from Core.OptionsManager:

Adds a handler to the type channel which will be executed on emit.

Parameters:

filter

(
  • filterFn
)

Inherited from Streams.SimpleStream:

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

Parameters:

  • filterFn Function
    Function to filter event payload

get

(
  • key
)
Object

Inherited from Core.OptionsManager:

Look up options value by key or get the full options hash.

Parameters:

Returns:

Object:

Associated object or full options hash

getOptions

()

Inherited from Core.OptionsManager:

Alias for get

key

(
  • key
)
OptionsManager

Inherited from Core.OptionsManager:

Return OptionsManager based on sub-object retrieved by key.

Parameters:

Returns:

OptionsManager:

Value

map

(
  • mapperFn
)

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

off

(
  • type
  • handler
)

Inherited from Core.OptionsManager:

Removes the handler from the type channel. This undoes the work of on.

Parameters:

OptionsManager.patch

(
  • options
  • patch
)
Object

Inherited from Core.OptionsManager but overwritten in

Constructor method. Create OptionsManager from source dictionary with arguments overriden by patch dictionary.

Parameters:

  • options Object

    Options to be patched

  • patch ...Object

    Options to overwrite

Returns:

Object:

source

patch

(
  • options
)
OptionsManager

Inherited from Core.OptionsManager:

Patch options with provided patches. Triggers change event on the object.

Parameters:

  • options Object

    Patch options

Returns:

OptionsManager:

this

pluck

(
  • key
)

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 an object.

Parameters:

set

(
  • key
  • value
)
OptionsManager

Inherited from Core.OptionsManager:

Set key to value. Outputs change event if a value is overwritten.

Parameters:

Returns:

OptionsManager:

Updated OptionsManager

setOptions

()

Inherited from Core.OptionsManager:

Alias for patch

split

(
  • splitterFn
)

Inherited from Streams.SimpleStream:

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

Parameters:

track

(
  • data
)
private

Inherited from Inputs.TouchTracker:

Record touch data, if selective is false.

Parameters:

Properties

DIRECTION

Object static

Constrain the input along a specific axis.

Sub-properties: