Skip to content

fix(camera): keep zoom slider off the ultra-wide lens - #728

Merged
farfromrefug merged 1 commit into
mainfrom
fix/693-camera-zoom-slider
Sep 14, 2026
Merged

farfromrefug merged 1 commit into
mainfrom
fix/693-camera-zoom-slider

Conversation

@farfromrefug

Copy link
Copy Markdown
Collaborator

Summary

  • The zoom slider is now driven by a logarithmic 0..100 scale instead of raw zoom ratios. On Android slider is an android.widget.SeekBar whose progress is an int, so raw ratios were truncated: on a device reporting a minimum zoom of 0.7 (ultra wide lens) the only reachable values were 0.7 / 1.7 / 2.7 … — 1x could not be selected, and 0.7x was the easiest value to land on.
  • The scale snaps to the camera neutral zoom, with a snap window derived from the device range (slightly wider than half a slider step), so an exact 1x is always reachable whatever the device reports.
  • The zoom stored in defaultZoom is clamped to the range of the current device on camera open, and the ratio reported by the native pinch handler (which is not coerced by the plugin) is clamped before being persisted. A stale or out of range value can no longer pin the camera to the ultra wide lens on every launch.
  • Mapping and clamping live in a new UI free app/utils/cameraZoom.ts so they can be unit tested.

Testing

  • npx vitest run app/utils/cameraZoom.test.ts — round trip, neutral snap, exact 1x reachability over several device ranges, clamping of out of range and non finite values, degenerate ranges.
  • yarn svelte-check — clean.
  • Still needs a visual check on Android, ideally on a device with a sub 1x minimum zoom (Pixel 7): camera opens at 1x, the floating label tracks the thumb, sliding reaches exactly 1x, and the chosen zoom survives a relaunch.

Refs #693

The Android slider is a SeekBar with an int progress, so feeding it raw zoom ratios
truncated every value: on a device whose minimum zoom is 0.7 (ultra wide lens) the
slider could only produce 0.7/1.7/2.7, making 1x unreachable and pinning the camera
to the ultra wide lens once the value was persisted.

Map the slider to a logarithmic 0..100 scale snapped to the neutral zoom, and clamp
both the stored and the pinch reported zoom to the range of the current device.

Refs #693

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@farfromrefug farfromrefug added the bug Something isn't working label Sep 14, 2026
@farfromrefug
farfromrefug marked this pull request as ready for review September 14, 2026 12:37
@farfromrefug
farfromrefug merged commit 4f5ef2c into main Sep 14, 2026
1 check passed
@farfromrefug
farfromrefug deleted the fix/693-camera-zoom-slider branch September 14, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant