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

Function simpleCloneInputData

docs/app/js/sanddance-app.js:92954–92973  ·  view source on GitHub ↗

* create a simple clone from the input used for storage of firstInput and firstMultiple * @param {Object} input * @returns {Object} clonedInputData

(input)

Source from the content-addressed store, hash-verified

92952 * @param {Object} input
92953 * @returns {Object} clonedInputData
92954 */ function simpleCloneInputData(input) {
92955 // make a simple copy of the pointers because we will get a reference if we don't
92956 // we only need clientXY for the calculations
92957 var pointers = [];
92958 var i = 0;
92959 while(i < input.pointers.length){
92960 pointers[i] = {
92961 clientX: round(input.pointers[i].clientX),
92962 clientY: round(input.pointers[i].clientY)
92963 };
92964 i++;
92965 }
92966 return {
92967 timeStamp: now(),
92968 pointers: pointers,
92969 center: getCenter(pointers),
92970 deltaX: input.deltaX,
92971 deltaY: input.deltaY
92972 };
92973 }
92974 /**
92975 * get the center of all the pointers
92976 * @param {Array} pointers

Callers 1

computeInputDataFunction · 0.70

Calls 3

roundFunction · 0.70
nowFunction · 0.70
getCenterFunction · 0.70

Tested by

no test coverage detected