Open cusspvz opened 7 years ago
@dagatsoin @EddyVerbruggen @anothar what's the difficulty we would have to implement this?
Hi @cusspvz.
Why not use your own button that you position on top of the map and use:
Mapbox.setCenter(
{
lat: 52.3602160, // mandatory
lng: 4.8891680, // mandatory
animated: false // default true
}
);
Hey @Nauzer, thanks for your reply. Because we cannot place elements over the mapview yet.
Right. I see those steps:
@dagatsoin nice! Seems we got a path.
Although the button placement and position should be optional, don't you agree?
If I had to design an API I would do it like:
geolocationButton
onGeolocationButtonClickCallback
ENUM( 'top-left', 'top-right', 'bottom-left', 'bottom-right', 'middle-left', 'middle-right' )
, as it should have a default I would choose 'top-left'.Note: Doesn't the mapbox gl native provides some sort of controls mechanisms already?
That seems good, but I would prefer the option to specify the layout params for the button instead of restrictive ENUM values so: (int width, int height, int left, int top, int right, int bottom)
Nice come up @dagatsoin ! I prefer it as well, but how would you handle the non-specified ones? Should they be int or either null
, being null
the default?
What about passing an object {width, height, left, top, right, bottom}
?
The native method should also have a default place/dimension. So the passing value will just override the default position.
About the implementation of the default position in the native method, I used to use LayoutParams
object to set size and margin.
I don't know a lot about android layout. Maybe @anothar could help us find a better way?
This issue is a proposal for introducing a button that handles the map centering to the user's geolocation.