@nextgis/control-container
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

Control Container

size version

This library allows placing control elements in the corners of the map container.

Libraries such as Leaflet and Maplibre GL JS are already doing this, but Cesium and Openlayers do not have similar functionality.

╭───────────────────────────────────────────╮
│ top-left                        top-right │
│                   MAP                     │
│ bottom-left                  bottom-right │
╰───────────────────────────────────────────╯

Installation

# latest stable
npm install @nextgis/control-container

Usage

import ControlContainer from '@nextgis/control-container';

// initialization
const controlContainer = new ControlContainer({ target: 'map-control-id' });
// or
const controlContainer = new ControlContainer({ map: webMap });
controlContainer.addTo('.map-control-class');

// add simple HTML string
controlContainer.append('<div>HTML</div>', 'top-right');
// or HTML element
controlContainer.append(HTMLElement, 'top-right');

// add control
const control = {
    onAdd(webMap) {
        const container = document.createContainer('div');
        webMap.emitter.on('zoomend', () => {
            container.innerHTML = webMap.getZoom();
        });
        return container
    }
}
controlContainer.addControl(control, 'bottom-right');

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!

http://nextgis.com

Readme

Keywords

Package Sidebar

Install

npm i @nextgis/control-container

Weekly Downloads

66

Version

2.1.0

License

MIT

Unpacked Size

111 kB

Total Files

17

Last publish

Collaborators

  • rendrom
  • maximdubinin
  • karavanjo