MCPcopy Create free account
hub / github.com/microsoft/SandDance / inputHandler

Function inputHandler

docs/tests/v2/es6/js/sanddance.js:51850–51871  ·  view source on GitHub ↗

* handle input events * @param {Manager} manager * @param {String} eventType * @param {Object} input

(manager, eventType, input)

Source from the content-addressed store, hash-verified

51848
51849
51850 function inputHandler(manager, eventType, input) {
51851 var pointersLen = input.pointers.length;
51852 var changedPointersLen = input.changedPointers.length;
51853 var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;
51854 var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;
51855 input.isFirst = !!isFirst;
51856 input.isFinal = !!isFinal;
51857
51858 if (isFirst) {
51859 manager.session = {};
51860 } // source event is the normalized value of the domEvents
51861 // like 'touchstart, mouseup, pointerdown'
51862
51863
51864 input.eventType = eventType; // compute scale, rotation etc
51865
51866 computeInputData(manager, input); // emit secret event
51867
51868 manager.emit('hammer.input', input);
51869 manager.recognize(input);
51870 manager.session.prevInput = input;
51871 }
51872 /**
51873 * extend the data with some usable properties like scale, rotate, velocity etc
51874 * @param {Object} manager

Callers

nothing calls this directly

Calls 1

computeInputDataFunction · 0.70

Tested by

no test coverage detected