diff --git a/static/js/map/LayerControl.js b/static/js/map/LayerControl.js new file mode 100644 index 0000000..77d7aea --- /dev/null +++ b/static/js/map/LayerControl.js @@ -0,0 +1,20 @@ + +const Component = { + view: function(){ + return m("select", { + class: "form-control" + },[ + m("option", { value: "Ground" }, "Ground"), + m("option", { value: "Sky" }, "Sky") + ] + ); + } +}; + +export default L.Control.extend({ + onAdd: function() { + var div = L.DomUtil.create('div'); + m.mount(div, Component); + return div; + } +}); diff --git a/static/js/map/MapFactory.js b/static/js/map/MapFactory.js index 789f81c..ff04555 100644 --- a/static/js/map/MapFactory.js +++ b/static/js/map/MapFactory.js @@ -3,6 +3,7 @@ import SimpleCRS from './SimpleCRS.js'; import CoordinatesDisplay from './CoordinatesDisplay.js'; import WorldInfoDisplay from './WorldInfoDisplay.js'; import SearchControl from './SearchControl.js'; +import LayerControl from './LayerControl.js'; import Overlaysetup from './Overlaysetup.js'; import CustomOverlay from './CustomOverlay.js'; import layerManager from './LayerManager.js'; @@ -38,6 +39,8 @@ export function createMap(node, layerId, zoom, lat, lon){ new SearchControl(wsChannel, { position: 'topright' }).addTo(map); } + new LayerControl({ position: 'topright' }).addTo(map); + //layer control L.control.layers(layerManager.layerObjects, overlays, { position: "topright" }).addTo(map);