Replace area-based formula with binary search to find zoom where
regions occupy 10-20% of magnifier area.
Binary search algorithm:
1. Start with minZoom=1, maxZoom=1000
2. Test midpoint zoom level
3. Calculate how much of magnified view each region occupies
4. If no regions fit → zoom out (maxZoom = mid)
5. If regions < 10% → zoom in (minZoom = mid)
6. If regions > 20% → zoom out (maxZoom = mid)
7. If 10-20% → perfect, done!
8. Iterate max 20 times or until range < 0.1
This handles all regions in the detection box, not just the one
under cursor, giving better overall framing.
For Gibraltar area:
- Binary search will find zoom ~800-1000x where Gibraltar occupies
10-20% of magnifier
- Converges in ~10-15 iterations
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>