@mdbootstrap/bootstrap-dark-mode
Version:
Responsive Dark Mode theme built with Bootstrap 5 with Dark Mode toggle button that switches between dark and light themes.
25 lines (22 loc) • 489 B
JavaScript
class TouchUtil {
_getCoordinates(e) {
const [touch] = e.touches;
return {
x: touch.clientX,
y: touch.clientY,
};
}
_getDirection(displacement) {
return {
x: {
direction: displacement.x < 0 ? 'left' : 'right',
value: Math.abs(displacement.x),
},
y: {
direction: displacement.y < 0 ? 'up' : 'down',
value: Math.abs(displacement.y),
},
};
}
}
export default TouchUtil;