button for adding tile layer

This commit is contained in:
Nils Schneider 2015-04-12 03:24:46 +02:00
parent 0758614688
commit a0120221ae
2 changed files with 30 additions and 0 deletions

View File

@ -5,6 +5,28 @@ define(["d3", "leaflet", "moment", "locationmarker", "leaflet.label",
zoomControl: false zoomControl: false
} }
var AddLayerButton = L.Control.extend({
options: {
position: "bottomright"
},
initialize: function (f, options) {
L.Util.setOptions(this, options)
this.f = f
},
onAdd: function () {
var button = L.DomUtil.create("button", "add-layer")
L.DomEvent.disableClickPropagation(button)
L.DomEvent.addListener(button, "click", this.f, this)
this.button = button
return button
}
})
var LocateButton = L.Control.extend({ var LocateButton = L.Control.extend({
options: { options: {
position: "bottomright" position: "bottomright"
@ -156,6 +178,10 @@ define(["d3", "leaflet", "moment", "locationmarker", "leaflet.label",
map.addControl(locateUserButton) map.addControl(locateUserButton)
map.addControl(new AddLayerButton(function () {
L.tileLayer.provider(prompt()).addTo(map)
}))
var nodeDict = {} var nodeDict = {}
var linkDict = {} var linkDict = {}
var highlight var highlight

View File

@ -10,6 +10,10 @@
content: '\f2a7'; content: '\f2a7';
} }
button.add-layer:after {
content: '\f217';
}
.node-alert { .node-alert {
-webkit-animation: blink 2s linear; -webkit-animation: blink 2s linear;
-webkit-animation-iteration-count: infinite; -webkit-animation-iteration-count: infinite;