boolder-org/boolder-android

Area detector

Closed this issue · 1 comments

We want to be able to detect in which area the user is currently looking at on the map.
This will be useful for a number of features (example: show more info about the area, show the list of the area's circuits, ...)

To do so, we draw an (invisible) square in the middle of the screen, and we check if it collides with an area's hull (= the shape of the area on the map, shown in grey to the users).

Demo iOS

RPReplay_Final1689971333.MP4

Notice how the top bar shows "Cuvier" and then "Cuvier Ouest" just by moving the map

Code iOS

https://github.com/boolder-org/boolder-ios/blob/b418c9d55501a911de4b49b6b2a8b8d51ae2c403/Boolder/UI/Map/MapboxViewController.swift#L593-L632

https://github.com/boolder-org/boolder-ios/blob/b418c9d55501a911de4b49b6b2a8b8d51ae2c403/Boolder/UI/Map/MapboxViewController.swift#L60-L74

What it looks like with the square displayed in red:

Capture d’écran 2023-07-21 à 22 31 55