yet-another-react-lightbox-lite 1.6.0 → 1.6.1
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/index.js +12 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -272,38 +272,39 @@ function useSensors() {
|
|
|
272
272
|
};
|
|
273
273
|
return useMemo(() => {
|
|
274
274
|
const onKeyDown = (event) => {
|
|
275
|
-
const
|
|
275
|
+
const { key, metaKey, ctrlKey } = event;
|
|
276
|
+
const meta = metaKey || ctrlKey;
|
|
276
277
|
const preventDefault = () => event.preventDefault();
|
|
277
278
|
const handleChangeZoom = (newZoom) => {
|
|
278
279
|
preventDefault();
|
|
279
280
|
changeZoom(newZoom);
|
|
280
281
|
};
|
|
281
|
-
if (
|
|
282
|
+
if (key === "+" || (meta && key === "="))
|
|
282
283
|
handleChangeZoom(zoom * KEYBOARD_ZOOM_FACTOR);
|
|
283
|
-
if (
|
|
284
|
+
if (key === "-" || (meta && key === "_"))
|
|
284
285
|
handleChangeZoom(zoom / KEYBOARD_ZOOM_FACTOR);
|
|
285
|
-
if (meta &&
|
|
286
|
+
if (meta && key === "0")
|
|
286
287
|
handleChangeZoom(1);
|
|
287
|
-
if (
|
|
288
|
+
if (key === "Escape")
|
|
288
289
|
close();
|
|
289
290
|
if (zoom > 1) {
|
|
290
291
|
const move = (deltaX, deltaY) => {
|
|
291
292
|
preventDefault();
|
|
292
293
|
changeOffsets(deltaX, deltaY);
|
|
293
294
|
};
|
|
294
|
-
if (
|
|
295
|
+
if (key === "ArrowUp")
|
|
295
296
|
move(0, KEYBOARD_MOVE_DISTANCE);
|
|
296
|
-
if (
|
|
297
|
+
if (key === "ArrowDown")
|
|
297
298
|
move(0, -KEYBOARD_MOVE_DISTANCE);
|
|
298
|
-
if (
|
|
299
|
+
if (key === "ArrowLeft")
|
|
299
300
|
move(KEYBOARD_MOVE_DISTANCE, 0);
|
|
300
|
-
if (
|
|
301
|
+
if (key === "ArrowRight")
|
|
301
302
|
move(-KEYBOARD_MOVE_DISTANCE, 0);
|
|
302
303
|
return;
|
|
303
304
|
}
|
|
304
|
-
if (
|
|
305
|
+
if (key === "ArrowLeft")
|
|
305
306
|
prev();
|
|
306
|
-
if (
|
|
307
|
+
if (key === "ArrowRight")
|
|
307
308
|
next();
|
|
308
309
|
};
|
|
309
310
|
const removePointer = (event) => {
|