UNPKG

equal-vue

Version:

Equal is a Vue 3 hackable UI library empowered by tailwindcss

19 lines (16 loc) 538 B
import { TTotalValuePosition } from '@/components/slider/types' export const getTotalPosition = ({ value, min, max, }: TTotalValuePosition): number => ((value - min) * 100) / (max - min) export const getCoordsByEvent = ({ changedTouches, clientX, clientY, }: MouseEvent & TouchEvent): { clientX: number; clientY: number } => { const firstTouch = changedTouches ? changedTouches[0] : null return firstTouch ? { clientX: firstTouch.clientX, clientY: firstTouch.clientY } : { clientX, clientY } }