Compare commits
2 commits
39e055592a
...
d25dab2b58
Author | SHA1 | Date | |
---|---|---|---|
Gandalf | d25dab2b58 | ||
Gandalf | be29ec7527 |
BIN
sketch/html/android-chrome-192x192.png
Normal file
BIN
sketch/html/android-chrome-192x192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
BIN
sketch/html/android-chrome-512x512.png
Normal file
BIN
sketch/html/android-chrome-512x512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 337 KiB |
BIN
sketch/html/apple-touch-icon.png
Normal file
BIN
sketch/html/apple-touch-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
BIN
sketch/html/favicon-16x16.png
Normal file
BIN
sketch/html/favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 718 B |
BIN
sketch/html/favicon-32x32.png
Normal file
BIN
sketch/html/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
sketch/html/favicon.ico
Normal file
BIN
sketch/html/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -41,8 +41,8 @@
|
||||||
Treehouse (form)
|
Treehouse (form)
|
||||||
<span class="leaflet-sidebar-close"><i class="fa fa-caret-left"></i></span>
|
<span class="leaflet-sidebar-close"><i class="fa fa-caret-left"></i></span>
|
||||||
</h1>
|
</h1>
|
||||||
|
<p>Here you'll see a form to enter a new treehouse or the data about existing ones, depending on mode</p>
|
||||||
<p>Here you'll see a form to enter a new treehouse or the data about existing ones, depending on mode</p>
|
<iframe src="treehouse_form.html"></iframe>
|
||||||
</div><!--sidebar-pane tree_form-->
|
</div><!--sidebar-pane tree_form-->
|
||||||
<div class="leaflet-sidebar-pane" id="barrio">
|
<div class="leaflet-sidebar-pane" id="barrio">
|
||||||
<h1 class="leaflet-sidebar-header">
|
<h1 class="leaflet-sidebar-header">
|
||||||
|
@ -69,9 +69,62 @@
|
||||||
<!--integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="-->
|
<!--integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="-->
|
||||||
</script>
|
</script>
|
||||||
<script src="leaflet/leaflet-sidebar-v2/js/leaflet-sidebar.js"></script>
|
<script src="leaflet/leaflet-sidebar-v2/js/leaflet-sidebar.js"></script>
|
||||||
|
<script src="leaflet/Leaflet.SelectAreaFeature/src/Leaflet.SelectAreaFeature.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
const max_barrio_zoom = 16;
|
||||||
|
L.Control.EditButton = L.Control.extend({
|
||||||
|
|
||||||
|
onAdd: function (map) {
|
||||||
|
var editButton = L.DomUtil.create('button', 'w3-button w3-white w3-hover-light-blue w3-small leaflet-bar');
|
||||||
|
|
||||||
|
//var editButton = L.DomUtil.create('button', 'leaflet-bar leaflet-control leaflet-control-custom');
|
||||||
|
|
||||||
|
// editButton.style.backgroundColor = 'white';
|
||||||
|
// editButton.style.backgroundSize = "30px 30px";
|
||||||
|
let active = false;
|
||||||
|
let title_inactive_treehouse = 'Add a treehouse in the current map area';
|
||||||
|
let title_inactive_barrio = 'Add a barrio in the current map area';
|
||||||
|
let title_active = 'Disable edit mode to drag the map';
|
||||||
|
title_inactive = function(){
|
||||||
|
let zoom = map.getZoom();
|
||||||
|
if (zoom <= max_barrio_zoom) return title_inactive_barrio;
|
||||||
|
// if (layer == 'treehouse') // uncomment if you ever introduce another layer or default value
|
||||||
|
return title_inactive_treehouse;
|
||||||
|
};
|
||||||
|
|
||||||
|
editButton.innerHTML = 'edit';
|
||||||
|
editButton.title = title_inactive();
|
||||||
|
|
||||||
|
editButton.onclick = function(){
|
||||||
|
if (active) {
|
||||||
|
editButton.className = editButton.className.replace("w3-blue", "w3-white");
|
||||||
|
editButton.title = title_inactive();
|
||||||
|
map.selectAreaFeature.disable();
|
||||||
|
active = false;
|
||||||
|
} else {
|
||||||
|
editButton.className = editButton.className.replace("w3-white", "w3-blue");
|
||||||
|
editButton.title = title_active;
|
||||||
|
map.selectAreaFeature.enable();
|
||||||
|
active = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return editButton;
|
||||||
|
},
|
||||||
|
|
||||||
|
onRemove: function(map) {
|
||||||
|
// Nothing to do here
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
L.control.editButton = function(opts) {
|
||||||
|
return new L.Control.EditButton(opts);
|
||||||
|
}
|
||||||
|
|
||||||
var map = L.map('map').setView([50.880301, 6.560531], 13,);
|
var map = L.map('map').setView([50.880301, 6.560531], 13,);
|
||||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 12, maxZoom: 19, attribution: 'Map data: © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>' }).addTo(map);
|
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 12, maxZoom: 19, attribution: 'Map data: © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>' }).addTo(map);
|
||||||
|
let editButton = L.control.editButton({position: 'topright'});
|
||||||
|
map.addControl(editButton,);
|
||||||
|
|
||||||
var barrio_markers = L.layerGroup(); //overlay where all barrio markers will be added
|
var barrio_markers = L.layerGroup(); //overlay where all barrio markers will be added
|
||||||
var tree_markers = L.layerGroup(); //overlay where all tree(house) markers will be added
|
var tree_markers = L.layerGroup(); //overlay where all tree(house) markers will be added
|
||||||
|
@ -81,11 +134,12 @@ map.addLayer(tree_markers);
|
||||||
|
|
||||||
function onMapClick(e){} //for adding a tree(house)
|
function onMapClick(e){} //for adding a tree(house)
|
||||||
function onMapZoom(e){ //for deciding wether to show barrios or treehouses
|
function onMapZoom(e){ //for deciding wether to show barrios or treehouses
|
||||||
if (map.getZoom() > 16) {
|
if (map.getZoom() > max_barrio_zoom) {
|
||||||
map.addLayer(barrio_markers);
|
map.addLayer(barrio_markers);
|
||||||
map.removeLayer(tree_markers);
|
map.removeLayer(tree_markers);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (map.getZoom() <= 16) {
|
if (map.getZoom() <= max_barrio_zoom) {
|
||||||
map.addLayer(tree_markers);
|
map.addLayer(tree_markers);
|
||||||
map.removeLayer(barrio_markers);
|
map.removeLayer(barrio_markers);
|
||||||
}
|
}
|
||||||
|
|
1
sketch/html/site.webmanifest
Normal file
1
sketch/html/site.webmanifest
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
Loading…
Reference in a new issue