Skip to content

Comments

Make 'Zoom in for stops' warning clickable to auto-zoom (#1062)#1063

Open
Vedd-Patel wants to merge 1 commit intoOneBusAway:mainfrom
Vedd-Patel:feature/zoom-in-for-stops-button
Open

Make 'Zoom in for stops' warning clickable to auto-zoom (#1062)#1063
Vedd-Patel wants to merge 1 commit intoOneBusAway:mainfrom
Vedd-Patel:feature/zoom-in-for-stops-button

Conversation

@Vedd-Patel
Copy link
Contributor

Fixes

Fixes #1062

Overview

Currently, when a user zooms out too far on the main map, a passive "Zoom in for stops" warning appears at the top of the screen. To actually see the stops, the user is forced to manually pinch and adjust the map until they find the exact zoom level that triggers the map pins to render.

Proposed Behavior

To reduce UX friction and make map discovery more seamless, I have transformed this informational warning into an actionable trigger. When a user taps the "Zoom in for stops" text, the map now automatically animates and zooms into a 0.01 degree coordinate span. This guarantees that transit stops instantly become visible with a single tap, completely bypassing the need for manual gestures.

Changes Made

  • Interactive Status View: Added a UITapGestureRecognizer to the mapStatusView in MapViewController to handle user interaction.
  • Automated Zoom Logic: Implemented didTapZoomInForStops(), which calculates the current map center and performs a programmatic zoom to a safe threshold where stops are guaranteed to load.
  • State Tracking & Safety: Introduced an isShowingZoomWarning boolean tracked via the mapRegionManagerShowZoomInStatus delegate method. This ensures that when the zoom warning is not present, standard taps on the status view still correctly trigger the expected location service alerts.

Visual Proof

StopButton1.mov

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea turning the passive "Zoom in for stops" banner into an actionable tap target, Ved — this is the kind of small UX improvement that makes a real difference for users. The implementation approach is sound: dispatching from a single gesture recognizer based on state is clean. A couple of things to fix up before merging.

Critical Issues

None.

Important Issues

  1. Indentation regression in mapRegionManagerShowZoomInStatus (MapViewController.swift:931-938): The method body is indented with 12 spaces and the closing brace with 8, but the rest of the file (and the method signature itself) uses standard 4-space indentation for method bodies. Compare with the adjacent mapRegionManager(_:didRemoveUserAnnotation:) at line 926. Please re-indent to match the file's convention.

Fit-and-Finish

  1. Magic number 0.01 (MapViewController.swift:211-212): The zoom span of 0.01 degrees is hardcoded. Consider extracting this to a named constant (e.g., private static let zoomInForStopsSpan = 0.01) so the intent is clear and the value is easy to tune later.

  2. Unnecessary self. prefix (MapViewController.swift:932): self.isShowingZoomWarning = showStatus doesn't need the self. prefix — there's no naming ambiguity here, and the surrounding code in this file doesn't use self. outside of closures.

Strengths

  • The dispatcher pattern in handleMapStatusTap is a clean way to branch behavior while keeping the original didTapMapStatus intact.
  • Tracking isShowingZoomWarning via the existing delegate callback is the right approach — no new notification or KVO plumbing needed.
  • The video demo in the PR description is very helpful for understanding the UX change.

Recommended Action

Please fix the indentation issue (#1 above), then this is good to merge. The fit-and-finish items are optional but would improve the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Make "Zoom in for stops" warning clickable to auto-zoom

2 participants