From 08848e52e13270c1a53af1da296a4fb3245a1fef Mon Sep 17 00:00:00 2001 From: Daniel Gilbers <158507595+danielgilbers@users.noreply.github.com> Date: Mon, 9 Sep 2024 08:33:58 +0200 Subject: [PATCH] add UI.js --- js/UI.js | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 js/UI.js diff --git a/js/UI.js b/js/UI.js new file mode 100644 index 00000000..c1fbf157 --- /dev/null +++ b/js/UI.js @@ -0,0 +1,79 @@ +'use strict' + +import 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.js' +import { map } from './map.js' + +/** + * Search bar with menu button + */ +L.Control.Search = L.Control.extend({ + onAdd: function () { + this.container = L.DomUtil.create('div') + this.container.innerHTML = + '
' + + '' + + '' + + '
' + this.container.id = 'topControl' + return this.container + } + + }) + +new L.Control.Search({ position: 'topleft' }).addTo(map) + +/** + * Graph UI - Download-button + */ +L.Control.GraphButtons = L.Control.extend({ + onAdd: function () { + this.container = L.DomUtil.create('div', 'graphUI d-none') + this.container.innerHTML = + '' + + '' + + return this.container + } + }) + + new L.Control.GraphButtons({ position: 'topleft' }).addTo(map) + +/** + * QR Code button + */ +L.Control.QRButton = L.Control.extend({ + onAdd: function () { + this.container = L.DomUtil.create('div', 'graphUI') + this.container.innerHTML = + '' + + return this.container + } + }) + +new L.Control.QRButton({ position: 'bottomright' }).addTo(map) + +/** + * Compass Button + */ +L.Control.Compass = L.Control.extend({ + onAdd: function () { + this.container = L.DomUtil.create('div', 'graphUI') + this.container.innerHTML = + '' + + return this.container + } + }) + +new L.Control.Compass({ position: 'bottomright' }).addTo(map) \ No newline at end of file