diff options
| author | Robert Günzler <r@gnzler.io> | 2026-10-02 10:33:53 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2026-10-02 10:45:00 +0200 |
| commit | 3c588cb48d4d3026c8a00faa8732c0655328e63c (patch) | |
| tree | 535ea33bf7fbd30e0fef1ebbf2a5c975418d5f14 /map/controls.js | |
| parent | f8a7a9ab00efe774f28f8f3211aef90a9abfc6be (diff) | |
| download | site-3c588cb48d4d3026c8a00faa8732c0655328e63c.tar.gz | |
*
Automated-commit-by: commitall Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'map/controls.js')
| -rw-r--r-- | map/controls.js | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/map/controls.js b/map/controls.js deleted file mode 100644 index e407a0c..0000000 --- a/map/controls.js +++ /dev/null @@ -1,39 +0,0 @@ -export class CustomControl { - _map = undefined; - _container = undefined; - _data = undefined; - - constructor(data) { - if (Object.hasOwn(data, "label") && - Object.hasOwn(data, "icon") && - Object.hasOwn(data, "onclick")) { - this._data = data; - } else { - throw new Error("missing required property"); - } - } - - onAdd(map) { - this._map = map; - this._container = document.createElement('div'); - this._container.className = 'maplibregl-ctrl maplibregl-ctrl-group'; - - const button = document.createElement('button'); - button.type = 'button'; - button.title = this._data.label; - button.textContent = this._data.icon; - button.onclick = () => { - this._data.onclick(); - } - - this._container.appendChild(button); - // this._map.on('mousedown', () => { }); - return this._container; - } - - onRemove() { - this._container.parentNode.removeChild(this._container); - // this._map.off('mousedown', () => { }); - this._map = undefined; - } -} |