yet-another-react-lightbox
Advanced tools
Comparing version 3.21.3 to 3.21.4
@@ -118,2 +118,5 @@ import * as React from 'react'; | ||
} | ||
function scaleZoom(value, delta, factor = 100, clamp = 2) { | ||
return value * Math.min(1 + Math.abs(delta / factor), clamp) ** Math.sign(delta); | ||
} | ||
function useZoomSensors(zoom, maxZoom, disabled, changeZoom, changeOffsets, zoomWrapperRef) { | ||
@@ -178,3 +181,3 @@ const activePointers = React.useRef([]); | ||
event.stopPropagation(); | ||
changeZoom(zoom * (1 - event.deltaY / wheelZoomDistanceFactor), true, ...translateCoordinates(event)); | ||
changeZoom(scaleZoom(zoom, -event.deltaY, wheelZoomDistanceFactor), true, ...translateCoordinates(event)); | ||
return; | ||
@@ -202,3 +205,4 @@ } | ||
const pointers = activePointers.current; | ||
if (!((_a = zoomWrapperRef === null || zoomWrapperRef === void 0 ? void 0 : zoomWrapperRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) { | ||
if ((event.pointerType === "mouse" && event.buttons > 1) || | ||
!((_a = zoomWrapperRef === null || zoomWrapperRef === void 0 ? void 0 : zoomWrapperRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) { | ||
return; | ||
@@ -232,3 +236,3 @@ } | ||
if (Math.abs(delta) > 0) { | ||
changeZoom(zoom * (1 + delta / pinchZoomDistanceFactor), true, ...pointers | ||
changeZoom(scaleZoom(zoom, delta, pinchZoomDistanceFactor), true, ...pointers | ||
.map((x) => translateCoordinates(x)) | ||
@@ -235,0 +239,0 @@ .reduce((acc, coordinate) => coordinate.map((x, i) => acc[i] + x / 2))); |
{ | ||
"name": "yet-another-react-lightbox", | ||
"version": "3.21.3", | ||
"version": "3.21.4", | ||
"description": "Modern React lightbox component", | ||
@@ -5,0 +5,0 @@ "author": "Igor Danchenko", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
224045
4195