UNPKG

react-toggle

Version:

An elegant, accessible toggle component for React. Also a glorified checkbox.

26 lines (24 loc) 722 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pointerCoord = pointerCoord; // Copyright 2015-present Drifty Co. // http://drifty.com/ // from: https://github.com/driftyco/ionic/blob/master/src/util/dom.ts function pointerCoord(event) { // get coordinates for either a mouse click // or a touch depending on the given event if (event) { var changedTouches = event.changedTouches; if (changedTouches && changedTouches.length > 0) { var touch = changedTouches[0]; return { x: touch.clientX, y: touch.clientY }; } var pageX = event.pageX; if (pageX !== undefined) { return { x: pageX, y: event.pageY }; } } return { x: 0, y: 0 }; }