yet-another-react-lightbox 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/Zoom.js +7 -7
- package/package.json +1 -1
package/dist/plugins/Zoom.js
CHANGED
|
@@ -221,17 +221,17 @@ const ZoomContainer = ({ slide, offset, rect, render, carousel, animation, zoom:
|
|
|
221
221
|
}, [offset]);
|
|
222
222
|
useEnhancedEffect(() => {
|
|
223
223
|
if (offset === 0) {
|
|
224
|
-
const { setMinZoom, setMaxZoom
|
|
224
|
+
const { setMinZoom, setMaxZoom } = refs.current;
|
|
225
225
|
setMinZoom(state.zoom <= 1);
|
|
226
|
-
setMaxZoom(state.zoom >=
|
|
226
|
+
setMaxZoom(state.zoom >= currentMaxZoom);
|
|
227
227
|
}
|
|
228
|
-
}, [offset, state.zoom]);
|
|
228
|
+
}, [offset, state.zoom, currentMaxZoom]);
|
|
229
229
|
const changeZoom = React.useCallback((value, rapid, dx, dy) => {
|
|
230
230
|
const { current } = refs;
|
|
231
231
|
const { state: { zoom }, containerRef, containerRect, maxZoom, } = current;
|
|
232
232
|
if (!containerRef.current || !containerRect)
|
|
233
233
|
return;
|
|
234
|
-
const newZoom = round(Math.min(Math.max(value, 1), maxZoom), 5);
|
|
234
|
+
const newZoom = round(Math.min(Math.max(value + 0.001 < maxZoom ? value : maxZoom, 1), maxZoom), 5);
|
|
235
235
|
if (newZoom === zoom)
|
|
236
236
|
return;
|
|
237
237
|
if (!rapid) {
|
|
@@ -379,7 +379,7 @@ const ZoomContainer = ({ slide, offset, rect, render, carousel, animation, zoom:
|
|
|
379
379
|
? { style: { transform: `scale(${zoom}) translate3d(${offsetX}px, ${offsetY}px, 0)` } }
|
|
380
380
|
: null) }, rendered)) : null;
|
|
381
381
|
};
|
|
382
|
-
const ZoomWrapper = ({ slide, offset, rect, render, carousel, animation }) => {
|
|
382
|
+
const ZoomWrapper = ({ slide, offset, rect, render, carousel, animation, zoom }) => {
|
|
383
383
|
var _a;
|
|
384
384
|
const { setZoomSupported } = useZoom();
|
|
385
385
|
const imageSlide = !("type" in slide);
|
|
@@ -390,7 +390,7 @@ const ZoomWrapper = ({ slide, offset, rect, render, carousel, animation }) => {
|
|
|
390
390
|
}
|
|
391
391
|
}, [offset, zoomSupported, setZoomSupported]);
|
|
392
392
|
if (zoomSupported) {
|
|
393
|
-
return (React.createElement(ZoomContainer, { slide: slide, offset: offset, rect: rect, render: render, carousel: carousel, animation: animation }));
|
|
393
|
+
return (React.createElement(ZoomContainer, { slide: slide, offset: offset, rect: rect, render: render, carousel: carousel, animation: animation, zoom: zoom }));
|
|
394
394
|
}
|
|
395
395
|
const rendered = (_a = render.slide) === null || _a === void 0 ? void 0 : _a.call(render, slide, offset, rect);
|
|
396
396
|
if (rendered) {
|
|
@@ -410,7 +410,7 @@ export const Zoom = ({ augment, append }) => {
|
|
|
410
410
|
},
|
|
411
411
|
render: {
|
|
412
412
|
...render,
|
|
413
|
-
slide: (slide, offset, rect) => (React.createElement(ZoomWrapper, { slide: slide, offset: offset, rect: rect, render: render, carousel: carousel, animation: animation })),
|
|
413
|
+
slide: (slide, offset, rect) => (React.createElement(ZoomWrapper, { slide: slide, offset: offset, rect: rect, render: render, carousel: carousel, animation: animation, zoom: zoom })),
|
|
414
414
|
},
|
|
415
415
|
zoom: {
|
|
416
416
|
...defaultZoomProps,
|