From fac6b12212fab3e3501622831663b258b6e65eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sun, 21 Aug 2016 19:56:38 +0200 Subject: [PATCH] add draw icons to map editor --- src/c3nav/control/static/control/control.css | 3 ++ .../control/templates/control/editor.html | 46 +++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/c3nav/control/static/control/control.css b/src/c3nav/control/static/control/control.css index 7aac6029..fc1392e0 100644 --- a/src/c3nav/control/static/control/control.css +++ b/src/c3nav/control/static/control/control.css @@ -13,6 +13,9 @@ top:2px; } +.leaflet-biggericon { + font-size: 14px; +} .leaflet-levels a { font-size:16px; color:#333333; diff --git a/src/c3nav/control/templates/control/editor.html b/src/c3nav/control/templates/control/editor.html index 3927c64f..e5918363 100644 --- a/src/c3nav/control/templates/control/editor.html +++ b/src/c3nav/control/templates/control/editor.html @@ -1,6 +1,5 @@ {% extends 'control/base.html' %} {% block content %} -

Editor

{% endblock %} @@ -23,11 +22,9 @@ L.control.layers([], { {% endfor %} L.LevelControl = L.Control.extend({ - options: { position: 'bottomright' }, - onAdd: function (map) { var container = L.DomUtil.create('div', 'leaflet-control leaflet-bar leaflet-levels'), link; {% for level in map.levels reversed %} @@ -37,10 +34,51 @@ L.LevelControl = L.Control.extend({ {% endfor %} return container; } - }); 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);