UNPKG

react-image-video-viewer

Version:

A React lightbox that supports videos, images and pinch zooming on images. Optimized for mobile UI with swiping, but can be used on desktop as well.

17 lines 641 B
export var settle = function settle(val, target, range) { var lowerRange = val > target - range && val < target; var upperRange = val < target + range && val > target; return lowerRange || upperRange ? target : val; }; export var getPointFromTouch = function getPointFromTouch(touch) { return { x: touch.clientX, y: touch.clientY }; }; export var getDistanceBetweenPoints = function getDistanceBetweenPoints(pointA, pointB) { return Math.sqrt(Math.pow(pointA.y - pointB.y, 2) + Math.pow(pointA.x - pointB.x, 2)); }; export var between = function between(min, max, value) { return Math.min(max, Math.max(min, value)); };