UNPKG

rsuite

Version:

A suite of react components

34 lines (32 loc) 1 kB
'use client'; "use strict"; exports.__esModule = true; exports.checkValue = checkValue; exports.getPosition = getPosition; exports.precisionMath = void 0; const precisionMath = value => parseFloat(value.toFixed(10)); exports.precisionMath = precisionMath; function checkValue(value, min, max) { if (typeof value === 'undefined' || value === null) { return value; } if (typeof value === 'number' && value < min) { return min; } if (typeof value === 'number' && value > max) { return max; } return value; } function getPosition(e) { var _event, _event2; let event = 'touches' in e ? e.touches[0] : e; // For touchend event, we need to use `changedTouches` instead of `touches` if (e.type === 'touchend' && 'changedTouches' in e) { event = e.changedTouches[0]; } return { pageX: ((_event = event) === null || _event === void 0 ? void 0 : _event.pageX) || 0, pageY: ((_event2 = event) === null || _event2 === void 0 ? void 0 : _event2.pageY) || 0 }; }