-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow controls to be placed at top-center, bottom-center, left-center, and right-center #3039
Comments
@mb12 Until this lands in master, you should be able to implement this functionality downstream by adding your own CSS rules for |
@mb12 here's a quick and dirty hack https://jsfiddle.net/wwbh6qsh/ |
A workaround that I'm using, instead of renaming another position like the jsfiddle molly shared. function registerControlPosition(map, positionName) {
if (map._controlPositions[positionName]) {
return;
}
var positionContainer = document.createElement('div');
positionContainer.className = `mapboxgl-ctrl-${positionName}`;
map._controlContainer.appendChild(positionContainer);
map._controlPositions[positionName] = positionContainer;
} You just have to define css rules for |
I hope there should have |
6 years and still nothing... |
+1 for more out-of-the-box options for control positioning |
+1 |
3 similar comments
+1 |
+1 |
+1 |
mapbox-gl-js version:Master
Steps to Trigger Behavior
Can you please suggest a workaround / solution for this? This is blocking switching from G Maps to Mapbox GL JS.
We need to put controls on the map at top center and bottom center. Google maps supports this and other positions for controls. You can find more details of supported positions at the link below. TOP_CENTER and BOTTOM_CENTER would unblock me.
I am hoping it just a matter of adding css. mapbox-gl.css only includes css for adding controls at the four corners.
https://developers.google.com/maps/documentation/javascript/controls
Expected Behavior
Actual Behavior
The text was updated successfully, but these errors were encountered: