Merge pull request #1055 from aparshin/layers-control-html
Allow HTML in Layer Names (issue #1009)
This commit is contained in:
commit
09060ff163
8
dist/leaflet.css
vendored
8
dist/leaflet.css
vendored
@ -122,7 +122,7 @@
|
|||||||
.leaflet-control-zoom a {
|
.leaflet-control-zoom a {
|
||||||
background-color: rgba(255, 255, 255, 0.75);
|
background-color: rgba(255, 255, 255, 0.75);
|
||||||
}
|
}
|
||||||
.leaflet-control-zoom a, .leaflet-control-layers a {
|
.leaflet-control-zoom a, .leaflet-control-layers-toggle {
|
||||||
background-position: 50% 50%;
|
background-position: 50% 50%;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
display: block;
|
display: block;
|
||||||
@ -156,12 +156,12 @@
|
|||||||
-webkit-border-radius: 8px;
|
-webkit-border-radius: 8px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
.leaflet-control-layers a {
|
.leaflet-control-layers-toggle {
|
||||||
background-image: url(images/layers.png);
|
background-image: url(images/layers.png);
|
||||||
width: 36px;
|
width: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
}
|
}
|
||||||
.leaflet-touch .leaflet-control-layers a {
|
.leaflet-touch .leaflet-control-layers-toggle {
|
||||||
width: 44px;
|
width: 44px;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@
|
|||||||
color: #333;
|
color: #333;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
.leaflet-control-layers input {
|
.leaflet-control-layers-selector {
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 1px;
|
top: 1px;
|
||||||
|
@ -135,7 +135,7 @@ L.Control.Layers = L.Control.extend({
|
|||||||
// IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)
|
// IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)
|
||||||
_createRadioElement: function (name, checked) {
|
_createRadioElement: function (name, checked) {
|
||||||
|
|
||||||
var radioHtml = '<input type="radio" name="' + name + '"';
|
var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' + name + '"';
|
||||||
if (checked) {
|
if (checked) {
|
||||||
radioHtml += ' checked="checked"';
|
radioHtml += ' checked="checked"';
|
||||||
}
|
}
|
||||||
@ -155,6 +155,7 @@ L.Control.Layers = L.Control.extend({
|
|||||||
if (obj.overlay) {
|
if (obj.overlay) {
|
||||||
input = document.createElement('input');
|
input = document.createElement('input');
|
||||||
input.type = 'checkbox';
|
input.type = 'checkbox';
|
||||||
|
input.className = 'leaflet-control-layers-selector';
|
||||||
input.defaultChecked = checked;
|
input.defaultChecked = checked;
|
||||||
} else {
|
} else {
|
||||||
input = this._createRadioElement('leaflet-base-layers', checked);
|
input = this._createRadioElement('leaflet-base-layers', checked);
|
||||||
@ -164,7 +165,8 @@ L.Control.Layers = L.Control.extend({
|
|||||||
|
|
||||||
L.DomEvent.on(input, 'click', this._onInputClick, this);
|
L.DomEvent.on(input, 'click', this._onInputClick, this);
|
||||||
|
|
||||||
var name = document.createTextNode(' ' + obj.name);
|
var name = document.createElement('span');
|
||||||
|
name.innerHTML = ' ' + obj.name;
|
||||||
|
|
||||||
label.appendChild(input);
|
label.appendChild(input);
|
||||||
label.appendChild(name);
|
label.appendChild(name);
|
||||||
|
Loading…
Reference in New Issue
Block a user