Merge pull request #968 from danzel/tilelayer-fixes
TileLayer fixes - Removing a TileLayer while dragging
This commit is contained in:
commit
622060d336
41
debug/tests/removetilewhilepan.html
Normal file
41
debug/tests/removetilewhilepan.html
Normal file
@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Leaflet debug page</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
|
||||
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
||||
<!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
|
||||
|
||||
<link rel="stylesheet" href="../css/screen.css" />
|
||||
<script src="../leaflet-include.js"></script>
|
||||
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.0.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="map"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var map = new L.Map('map', { center: new L.LatLng(45.50144, -122.67599), zoom: 4 });
|
||||
|
||||
var demoUrl='http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Average_Household_Size/MapServer/tile/{z}/{y}/{x}';
|
||||
var demoMap = new L.TileLayer(demoUrl, { maxZoom: 19, attribution: 'Tiles: © Esri' });
|
||||
|
||||
var topoUrl = 'http://server.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}';
|
||||
var topoMap = new L.TileLayer(topoUrl, { maxZoom: 19, attribution: 'Tiles: © Esri' });
|
||||
map.addLayer(topoMap);
|
||||
|
||||
map.addLayer(demoMap);
|
||||
|
||||
map.on('dragstart', function () {
|
||||
console.log('dragstart');
|
||||
setTimeout(function () {
|
||||
console.log('removing');
|
||||
map.removeLayer(demoMap);
|
||||
}, 400);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -245,7 +245,8 @@ L.TileLayer = L.Class.extend({
|
||||
},
|
||||
|
||||
_update: function (e) {
|
||||
if (this._map._panTransition && this._map._panTransition._inProgress) { return; }
|
||||
|
||||
if (!this._map || (this._map._panTransition && this._map._panTransition._inProgress)) { return; }
|
||||
|
||||
var bounds = this._map.getPixelBounds(),
|
||||
zoom = this._map.getZoom(),
|
||||
|
Loading…
Reference in New Issue
Block a user