mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.19k stars 2.22k forks source link

Geolocate control doesn't drape right with terrain and high pitch #10274

Open asheemmamoowala opened 3 years ago

asheemmamoowala commented 3 years ago

The geolocate control's accuracy circle isn't projected correctly at high pitch+zoom. It should remain attached to the surface. The accuracy circle needs to be rethought for instances when the geolocation is on a hill/slope.

image

image

This will eventually impact the various Mobile/Nav pucks as well.

cc @mapbox/mobile @d-prukop @avi-c

asheemmamoowala commented 3 years ago

Comment from @astojilj

Positioning (given that markers are used here), to follow hight pitch and terrain, is fixed with #148 and #183. It remains attached to surface. Related to that part, this bug could be considered as fixed.

The accuracy circle needs to be rethought for instances when the geolocation is on a hill/slope. Related to behavior of accuracy circle:

Accuracy circle has a feel (as it is one) of an overlaid HTML element - width and height are not implemented to follow map precisely in 2D either, which is observable when panning map in < 60 degrees pitch. This gives it 3D feel as it is laid over horizon when pitch > 60.

https://github.com/mapbox/mapbox-gl-js-internal/blob/decd73917b0dc032e4c619e993ce7c048ecc076e/src/ui/control/geolocate_control.js#L404-L405

https://github.com/mapbox/mapbox-gl-js-internal/blob/decd73917b0dc032e4c619e993ce7c048ecc076e/src/ui/control/geolocate_control.js#L310-L318

Aug-17-2020 08-01-14

Aug-17-2020 08-18-38

cc @mapbox/gl-native: related to work on location indicator.

andrewharvey commented 3 years ago

An easy fix would implement the circle as a style circle layer, not an HTML element.

The problem is, at lest when I first contributed the geolocate dot, this will mutate the users style introducing extra layers and a style source. It might then break for existing applications which mutate the style or when using setStyle etc.

I still think so long as the user is made aware of this, it's probably okay, but it's no longer 100% taken care of by the SDK and the developer needs to manage these layers in their code (during setStyle).

Unless we implement internal style layers/sources to add to the map but are hidden from the user and survive setStyle etc... :thought_balloon: