Control Container
This library allows placing control elements in the corners of the map container.
Libraries such as Leaflet
and Mapbox GL JS
are already doing this,
but Cesium
and Openlayers
do not have similar functionality.
______________________________
| |
| top-left top-right |
| |
| MAP |
| |
| bottom-left bottom-right |
|____________________________|
Use Item with NPM installation method for building large scale applications. It pairs nicely with module bundlers such as Webpack
$ npm install --save-dev @nextgis/control-container
$ yarn add @nextgis/control-container
import ControlContainer from '@nextgis/control-container';
const controlContainer = new ControlContainer({ target: 'map-control-id' });
const controlContainer = new ControlContainer({ map: webMap });
controlContainer.attach('.map-control-class');
controlContainer.append('top-right', '<div>HTML</div>');
controlContainer.append('top-right', HTMLElement);
const control = {
onAdd(webMap) {
const container = document.createContainer('div');
webMap.emitter.on('zoomend', () => {
container.innerHTML = webMap.getZoom();
});
return container
}
}
controlContainer.addControl('bottom-right', control);
Commercial support
Need to fix a bug or add a feature to @nextgis/control-container
? We provide custom development and support for this software. Contact us to discuss options!