yet-another-react-lightbox
Advanced tools
Comparing version 3.12.3 to 3.13.0
@@ -79,2 +79,4 @@ import * as React from 'react'; | ||
zoomOut: Callback; | ||
/** change zoom level */ | ||
changeZoom: (targetZoom: number, rapid?: boolean, dx?: number, dy?: number) => void; | ||
} | ||
@@ -81,0 +83,0 @@ } |
@@ -300,4 +300,4 @@ import { useLightboxProps, useMotionPreference, useEventCallback, useLayoutEffect, useLightboxState, isImageSlide, isImageFitCover, round, useController, usePointerEvents, cleanup, makeUseContext, createIcon, IconButton, devicePixelRatio, ImageSlide, clsx, cssClass, addToolbarButton, createModule } from '../../index.js'; | ||
}, [zoom, offsetX, offsetY, slideRect, imageRect.width, imageRect.height]); | ||
const changeZoom = React.useCallback((value, rapid, dx, dy) => { | ||
const newZoom = round(Math.min(Math.max(value + 0.001 < maxZoom ? value : maxZoom, 1), maxZoom), 5); | ||
const changeZoom = React.useCallback((targetZoom, rapid, dx, dy) => { | ||
const newZoom = round(Math.min(Math.max(targetZoom + 0.001 < maxZoom ? targetZoom : maxZoom, 1), maxZoom), 5); | ||
if (newZoom === zoom) | ||
@@ -338,3 +338,3 @@ return; | ||
useZoomSensors(zoom, maxZoom, disabled, changeZoom, changeOffsets, zoomWrapper === null || zoomWrapper === void 0 ? void 0 : zoomWrapper.zoomWrapperRef); | ||
const zoomRef = React.useMemo(() => ({ zoom, maxZoom, offsetX, offsetY, disabled, zoomIn, zoomOut }), [zoom, maxZoom, offsetX, offsetY, disabled, zoomIn, zoomOut]); | ||
const zoomRef = React.useMemo(() => ({ zoom, maxZoom, offsetX, offsetY, disabled, zoomIn, zoomOut, changeZoom }), [zoom, maxZoom, offsetX, offsetY, disabled, zoomIn, zoomOut, changeZoom]); | ||
React.useImperativeHandle(useZoomProps().ref, () => zoomRef, [zoomRef]); | ||
@@ -341,0 +341,0 @@ const context = React.useMemo(() => ({ ...zoomRef, setZoomWrapper }), [zoomRef, setZoomWrapper]); |
{ | ||
"name": "yet-another-react-lightbox", | ||
"version": "3.12.3", | ||
"version": "3.13.0", | ||
"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
216556
4016