@baleada/listenable-gestures
Version:
A collection of gesture recognizers that are compatible with Baleada Logic's Listenable class.
29 lines (26 loc) • 570 B
JavaScript
function getMousePoint(event) {
return {
x: event.clientX,
y: event.clientY
};
}
function getTouchMovePoint(event) {
return {
x: event.touches.item(0).clientX,
y: event.touches.item(0).clientY
};
}
function getTouchEndPoint(event) {
return {
x: event.changedTouches.item(0).clientX,
y: event.changedTouches.item(0).clientY
};
}
var getGetPointDictionary = {
'mouse': getMousePoint,
'touch': getTouchMovePoint,
'touchend': getTouchEndPoint
};
export default function getGetPoint(type) {
return getGetPointDictionary[type];
}