add draw icons to map editor
This commit is contained in:
parent
bc29193c7b
commit
fac6b12212
2 changed files with 45 additions and 4 deletions
|
@ -13,6 +13,9 @@
|
||||||
top:2px;
|
top:2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.leaflet-biggericon {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
.leaflet-levels a {
|
.leaflet-levels a {
|
||||||
font-size:16px;
|
font-size:16px;
|
||||||
color:#333333;
|
color:#333333;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{% extends 'control/base.html' %}
|
{% extends 'control/base.html' %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Editor</h1>
|
|
||||||
<div id="mapeditor"></div>
|
<div id="mapeditor"></div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -23,11 +22,9 @@ L.control.layers([], {
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
L.LevelControl = L.Control.extend({
|
L.LevelControl = L.Control.extend({
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
position: 'bottomright'
|
position: 'bottomright'
|
||||||
},
|
},
|
||||||
|
|
||||||
onAdd: function (map) {
|
onAdd: function (map) {
|
||||||
var container = L.DomUtil.create('div', 'leaflet-control leaflet-bar leaflet-levels'), link;
|
var container = L.DomUtil.create('div', 'leaflet-control leaflet-bar leaflet-levels'), link;
|
||||||
{% for level in map.levels reversed %}
|
{% for level in map.levels reversed %}
|
||||||
|
@ -37,10 +34,51 @@ L.LevelControl = L.Control.extend({
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
map.addControl(new L.LevelControl());
|
map.addControl(new L.LevelControl());
|
||||||
|
|
||||||
|
L.DrawControl = L.Control.extend({
|
||||||
|
options: {
|
||||||
|
position: 'topleft'
|
||||||
|
},
|
||||||
|
onAdd: function (map) {
|
||||||
|
var container = L.DomUtil.create('div', 'leaflet-control leaflet-bar'), link;
|
||||||
|
|
||||||
|
link = L.DomUtil.create('a', 'leaflet-biggericon', container);
|
||||||
|
link.href = '{% url "control.editor" level=level %}';
|
||||||
|
link.title = 'add building'
|
||||||
|
link.innerHTML = '🏠';
|
||||||
|
|
||||||
|
link = L.DomUtil.create('a', 'leaflet-biggericon', container);
|
||||||
|
link.href = '{% url "control.editor" level=level %}';
|
||||||
|
link.title = 'add room/area';
|
||||||
|
link.innerHTML = '⬠';
|
||||||
|
|
||||||
|
link = L.DomUtil.create('a', 'leaflet-biggericon', container);
|
||||||
|
link.href = '{% url "control.editor" level=level %}';
|
||||||
|
link.title = 'add obstacle'
|
||||||
|
link.innerHTML = '⬟';
|
||||||
|
|
||||||
|
link = L.DomUtil.create('a', 'leaflet-biggericon', container);
|
||||||
|
link.href = '{% url "control.editor" level=level %}';
|
||||||
|
link.title = 'add door';
|
||||||
|
link.innerHTML = '🚪';
|
||||||
|
|
||||||
|
link = L.DomUtil.create('a', '', container);
|
||||||
|
link.href = '{% url "control.editor" level=level %}';
|
||||||
|
link.title = 'add steps';
|
||||||
|
link.innerHTML = '┌┘';
|
||||||
|
|
||||||
|
link = L.DomUtil.create('a', 'leaflet-biggericon', container);
|
||||||
|
link.href = '{% url "control.editor" level=level %}';
|
||||||
|
link.title = 'add elevator';
|
||||||
|
link.innerHTML = '▴▾';
|
||||||
|
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map.addControl(new L.DrawControl());
|
||||||
|
|
||||||
|
|
||||||
L.control.scale({imperial: false}).addTo(map);
|
L.control.scale({imperial: false}).addTo(map);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue