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

Function cleanTouchActions

docs/app/js/sanddance-app.js:93442–93457  ·  view source on GitHub ↗

* when the touchActions are collected they are not a valid value, so we need to clean things up. * * @param {String} actions * @returns {*}

(actions)

Source from the content-addressed store, hash-verified

93440 * @param {String} actions
93441 * @returns {*}
93442 */ function cleanTouchActions(actions) {
93443 // none
93444 if (inStr(actions, TOUCH_ACTION_NONE)) return TOUCH_ACTION_NONE;
93445 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
93446 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
93447 // if both pan-x and pan-y are set (different recognizers
93448 // for different directions, e.g. horizontal pan but vertical swipe?)
93449 // we need none (as otherwise with pan-x pan-y combined none of these
93450 // recognizers will work, since the browser would handle all panning
93451 if (hasPanX && hasPanY) return TOUCH_ACTION_NONE;
93452 // pan-x OR pan-y
93453 if (hasPanX || hasPanY) return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
93454 // manipulation
93455 if (inStr(actions, TOUCH_ACTION_MANIPULATION)) return TOUCH_ACTION_MANIPULATION;
93456 return TOUCH_ACTION_AUTO;
93457 }
93458 function getTouchActionProps() {
93459 if (!NATIVE_TOUCH_ACTION) return false;
93460 var touchMap = {};

Callers 1

sanddance-app.jsFile · 0.70

Calls 1

inStrFunction · 0.70

Tested by

no test coverage detected