Inputs.ScaleInput Class
Detects two-finger pinching motion and emits start
, update
and
end
events with the payload data:
value
- Distance between the two touches
delta
- Differential in successive distances
velocity
- Relative velocity between two touches
displacement
- Total accumulated displacement
center
- Midpoint between the two touches
touchIds
- Array of DOM event touch identifiers
Note: Unlike PinchInput, which produces pixel values of displacement between two touches, ScaleInput produces dimensionless values corresponding to scaling of the initial distance between the touches. For example, if two touches begin at 100 px apart, and move to 200 px apart, ScaleInput will emit a value of 2 (for 2x magnification), while PinchInput will emit a value of 100.
Constructor
Inputs.ScaleInput
-
options
Example:
var scaleInput = new ScaleInput();
scaleInput.subscribe(Engine) // listens on window
events
scaleInput.on('start', function(payload){
console.log('start', payload);
});
scaleInput.on('update', function(payload){
console.log('update', payload);
});
scaleInput.on('end', function(payload){
console.log('end', payload);
});
Item Index
Methods
Methods
"on"
-
type
-
handler
Adds a handler to the type
channel which will be executed on emit
.
filter
-
filterFn
Parameters:
-
filterFn
FunctionFunction to filter event payload
get
-
key
Look up options value by key or get the full options hash.
Parameters:
-
key
StringKey
Returns:
Associated object or full options hash
getOptions
()
Alias for get
key
-
key
Return OptionsManager based on sub-object retrieved by key
.
Parameters:
-
key
StringKey
Returns:
Value
map
-
mapperFn
Parameters:
-
mapperFn
FunctionFunction to map event payload
off
-
type
-
handler
Removes the handler
from the type
channel.
This undoes the work of on
.
OptionsManager.patch
-
options
-
patch
Constructor method. Create OptionsManager from source dictionary with arguments overriden by patch dictionary.
Parameters:
-
options
ObjectOptions to be patched
-
patch
...ObjectOptions to overwrite
Returns:
source
patch
-
options
Patch options with provided patches. Triggers change
event on the object.
Parameters:
-
options
ObjectPatch options
Returns:
this
pluck
-
key
set
-
key
-
value
Set key to value. Outputs change
event if a value is overwritten.
Returns:
Updated OptionsManager
setOptions
()
Alias for patch
split
-
splitterFn
Parameters:
-
splitterFn
FunctionSplitter function