fix VML remove/add losing styles issue, closes #830
This commit is contained in:
parent
a7f730690d
commit
65aafc3a8f
@ -8,7 +8,7 @@
|
||||
|
||||
<link rel="stylesheet" href="../css/screen.css" />
|
||||
|
||||
<script src="../leaflet-include.js"></script>
|
||||
<script src="../../dist/leaflet-src.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
var map = new L.Map('map').addLayer(cloudmade).setView(new L.LatLng(50.5, 30.51), 15);
|
||||
|
||||
var marker = new L.Marker(new L.LatLng(50.5, 30.505));
|
||||
var marker = new L.CircleMarker(new L.LatLng(50.5, 30.505), {color: 'red'});
|
||||
map.addLayer(marker);
|
||||
marker.bindPopup("Hello World").openPopup();
|
||||
|
||||
|
21
dist/leaflet-src.js
vendored
21
dist/leaflet-src.js
vendored
@ -3528,11 +3528,16 @@ L.Path = L.Class.extend({
|
||||
onAdd: function (map) {
|
||||
this._map = map;
|
||||
|
||||
this._initElements();
|
||||
this._initEvents();
|
||||
if (!this._container) {
|
||||
this._initElements();
|
||||
this._initEvents();
|
||||
}
|
||||
|
||||
this.projectLatlngs();
|
||||
this._updatePath();
|
||||
|
||||
this._map._pathRoot.appendChild(this._container);
|
||||
|
||||
map.on({
|
||||
'viewreset': this.projectLatlngs,
|
||||
'moveend': this._updatePath
|
||||
@ -3545,9 +3550,15 @@ L.Path = L.Class.extend({
|
||||
},
|
||||
|
||||
onRemove: function (map) {
|
||||
map._pathRoot.removeChild(this._container);
|
||||
|
||||
this._map = null;
|
||||
|
||||
map._pathRoot.removeChild(this._container);
|
||||
if (L.Browser.vml) {
|
||||
this._container = null;
|
||||
this._stroke = null;
|
||||
this._fill = null;
|
||||
}
|
||||
|
||||
map.off({
|
||||
'viewreset': this.projectLatlngs,
|
||||
@ -3632,8 +3643,6 @@ L.Path = L.Path.extend({
|
||||
|
||||
this._path = this._createElement('path');
|
||||
this._container.appendChild(this._path);
|
||||
|
||||
this._map._pathRoot.appendChild(this._container);
|
||||
},
|
||||
|
||||
_initStyle: function () {
|
||||
@ -3705,7 +3714,7 @@ L.Path = L.Path.extend({
|
||||
if (!this.hasEventListeners(e.type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (e.type === 'contextmenu') {
|
||||
L.DomEvent.preventDefault(e);
|
||||
}
|
||||
|
2
dist/leaflet.js
vendored
2
dist/leaflet.js
vendored
File diff suppressed because one or more lines are too long
@ -39,8 +39,6 @@ L.Path = L.Path.extend({
|
||||
|
||||
this._path = this._createElement('path');
|
||||
this._container.appendChild(this._path);
|
||||
|
||||
this._map._pathRoot.appendChild(this._container);
|
||||
},
|
||||
|
||||
_initStyle: function () {
|
||||
@ -112,7 +110,7 @@ L.Path = L.Path.extend({
|
||||
if (!this.hasEventListeners(e.type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (e.type === 'contextmenu') {
|
||||
L.DomEvent.preventDefault(e);
|
||||
}
|
||||
|
@ -36,11 +36,16 @@ L.Path = L.Class.extend({
|
||||
onAdd: function (map) {
|
||||
this._map = map;
|
||||
|
||||
this._initElements();
|
||||
this._initEvents();
|
||||
if (!this._container) {
|
||||
this._initElements();
|
||||
this._initEvents();
|
||||
}
|
||||
|
||||
this.projectLatlngs();
|
||||
this._updatePath();
|
||||
|
||||
this._map._pathRoot.appendChild(this._container);
|
||||
|
||||
map.on({
|
||||
'viewreset': this.projectLatlngs,
|
||||
'moveend': this._updatePath
|
||||
@ -53,9 +58,15 @@ L.Path = L.Class.extend({
|
||||
},
|
||||
|
||||
onRemove: function (map) {
|
||||
map._pathRoot.removeChild(this._container);
|
||||
|
||||
this._map = null;
|
||||
|
||||
map._pathRoot.removeChild(this._container);
|
||||
if (L.Browser.vml) {
|
||||
this._container = null;
|
||||
this._stroke = null;
|
||||
this._fill = null;
|
||||
}
|
||||
|
||||
map.off({
|
||||
'viewreset': this.projectLatlngs,
|
||||
|
Loading…
Reference in New Issue
Block a user