l7hammerjs
Version:
A javascript library for multi-touch gestures
22 lines (18 loc) • 667 B
JavaScript
import { NATIVE_TOUCH_ACTION } from './touchaction-Consts';
import { isMini } from '../utils/env'
export default function getTouchActionProps() {
if (!NATIVE_TOUCH_ACTION) {
return false;
}
let touchMap = {};
if(isMini) {
return touchMap;
}
let cssSupports = window.CSS && window.CSS.supports;
['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach((val) => {
// If css.supports is not supported but there is native touch-action assume it supports
// all values. This is the case for IE 10 and 11.
return touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
});
return touchMap;
}