1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-10-06 18:59:58 +01:00

fix: limit pinch scale to minimum 0.5 (#1740)

This commit is contained in:
Chee Aun 2023-02-16 03:20:10 +08:00 committed by GitHub
parent 33a53de8d7
commit 769b84867a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,7 +64,7 @@ const { isSwiping, lengthX, lengthY, direction } = useSwipe(target, {
useGesture({ useGesture({
onPinch({ offset: [distance, angle] }) { onPinch({ offset: [distance, angle] }) {
set({ scale: 1 + distance / 200 }) set({ scale: Math.max(0.5, 1 + distance / 200) })
}, },
onMove({ movement: [x, y], dragging, pinching }) { onMove({ movement: [x, y], dragging, pinching }) {
if (dragging && !pinching) if (dragging && !pinching)