Various debug fixes (#4515)

* various debug fixes
* fix mixed spaces and tabs
This commit is contained in:
Nathan Cahill 2016-04-29 03:35:50 -06:00 committed by Vladimir Agafonkin
parent 19f048110f
commit 425fa13cb4
26 changed files with 273 additions and 282 deletions

View File

@ -83,6 +83,7 @@
**********/ **********/
// OSM Basemap // OSM Basemap
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors';
var osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: ''}).addTo(map1); var osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: ''}).addTo(map1);

View File

@ -197,7 +197,7 @@
map.addLayer(grid); map.addLayer(grid);
var marker1 = L.marker(kyiv).addTo(map), var marker1 = L.marker(kyiv).addTo(map),
marker2 = L.marker(lnd).addTo(map); marker2 = L.marker(lnd).addTo(map),
marker3 = L.marker(dc).addTo(map), marker3 = L.marker(dc).addTo(map),
marker4 = L.marker(sf).addTo(map), marker4 = L.marker(sf).addTo(map),
marker5 = L.marker(trd).addTo(map), marker5 = L.marker(trd).addTo(map),

View File

@ -65,7 +65,7 @@
var path = new L.Polyline([kyiv, trd, lnd, mad, dc, sf]).addTo(map); var path = new L.Polyline([kyiv, trd, lnd, mad, dc, sf]).addTo(map);
var marker1 = L.marker(kyiv).addTo(map), var marker1 = L.marker(kyiv).addTo(map),
marker2 = L.marker(lnd).addTo(map); marker2 = L.marker(lnd).addTo(map),
marker3 = L.marker(dc).addTo(map), marker3 = L.marker(dc).addTo(map),
marker4 = L.marker(sf).addTo(map), marker4 = L.marker(sf).addTo(map),
marker5 = L.marker(trd).addTo(map), marker5 = L.marker(trd).addTo(map),

View File

@ -10,7 +10,6 @@
<link rel="stylesheet" href="../css/screen.css" /> <link rel="stylesheet" href="../css/screen.css" />
<script type="text/javascript" src="../../build/deps.js"></script> <script type="text/javascript" src="../../build/deps.js"></script>
<script src="../leaflet-include.js"></script> <script src="../leaflet-include.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.0.js'></script>
</head> </head>
<body> <body>
@ -26,7 +25,7 @@
map.addLayer(demoMap); map.addLayer(demoMap);
$('#foo').click(function() { document.getElementById('foo').addEventListener('click', function() {
var topoUrl='http://server.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}'; 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: &copy; Esri' }); var topoMap = new L.TileLayer(topoUrl, { maxZoom: 19, attribution: 'Tiles: &copy; Esri' });
map.addLayer(topoMap); map.addLayer(topoMap);

View File

@ -3,8 +3,9 @@
<link rel="stylesheet" href="../../dist/leaflet.css" /> <link rel="stylesheet" href="../../dist/leaflet.css" />
<link rel="stylesheet" href="../css/screen.css" /> <link rel="stylesheet" href="../css/screen.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="../../build/deps.js"></script>
<script src="../leaflet-include.js"></script>
</head> </head>
<body> <body>
@ -12,8 +13,6 @@
<script> <script>
$(document).ready(function() {
//Init a map, and attempt a locate. //Init a map, and attempt a locate.
var map = L.map('map', { var map = L.map('map', {
center: [39.84, -96.591], center: [39.84, -96.591],
@ -33,13 +32,8 @@
}); });
//For experiments using setRadius //For experiments using setRadius
window.marker = L.circleMarker(map.getCenter(),{radius:30}).addTo(vanillaLayer); var marker = L.circleMarker(map.getCenter(),{radius:30}).addTo(vanillaLayer);
});
</script> </script>
<script type="text/javascript" src="../../build/deps.js"></script>
<script src="../leaflet-include.js"></script>
</body> </body>
</html> </html>

View File

@ -8,10 +8,14 @@
<link rel="stylesheet" href="../../dist/leaflet.css" /> <link rel="stylesheet" href="../../dist/leaflet.css" />
<link rel="stylesheet" href="../css/screen.css" /> <link rel="stylesheet" href="../css/screen.css" />
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.0.js'></script>
<script type="text/javascript" src="../../build/deps.js"></script>
<script src="../leaflet-include.js"></script>
</head>
<body>
<div id="map"></div>
<script> <script>
$(document).ready(function() {
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors', osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}); osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
@ -45,14 +49,6 @@
}); });
polygons.addTo(map); polygons.addTo(map);
});
</script> </script>
<script type="text/javascript" src="../../build/deps.js"></script>
<script src="../leaflet-include.js"></script>
</head>
<body>
<div id="map"></div>
</body> </body>
</html> </html>

View File

@ -13,7 +13,7 @@
osm = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); osm = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
recreateMap = function(){ var recreateMap = function(){
// destroy previous map and div // destroy previous map and div
if(map) map.remove(); // This will destroy all DOM childs from layers and controls if(map) map.remove(); // This will destroy all DOM childs from layers and controls

View File

@ -11,7 +11,6 @@
<link rel="stylesheet" href="../css/screen.css" /> <link rel="stylesheet" href="../css/screen.css" />
<script type="text/javascript" src="../../build/deps.js"></script> <script type="text/javascript" src="../../build/deps.js"></script>
<script src="../leaflet-include.js"></script> <script src="../leaflet-include.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.0.js'></script>
</head> </head>
<body> <body>
<p> <p>
@ -47,12 +46,10 @@
dragging : false, dragging : false,
worldCopyJump : true worldCopyJump : true
}); });
$("#foo").click(function() { document.getElementById("foo").addEventListener('click', function() {
map2.dragging.enable(); map2.dragging.enable();
}); });
addLayerAndMarker(map1); addLayerAndMarker(map1);
addLayerAndMarker(map2); addLayerAndMarker(map2);

View File

@ -31,17 +31,19 @@
var map = new L.Map('map', {center: latlng, zoom: 15, layers: [osm]}); var map = new L.Map('map', {center: latlng, zoom: 15, layers: [osm]});
//Create a marker, clicking it toggles opacity //Create a marker, clicking it toggles opacity
var marker = new L.Marker(latlng, { icon: new L.DivIcon({ className: 'mybox', iconSize: new L.Point(100,100), html: 'opaque. click to toggle' }) }); var opaqueIcon = new L.DivIcon({ className: 'mybox', iconSize: new L.Point(100,100), html: 'opaque. click to toggle' });
var transparentIcon = new L.DivIcon({ className: 'mybox', iconSize: new L.Point(100,100), html: 'transparent' });
var marker = new L.Marker(latlng, { icon: opaqueIcon });
map.addLayer(marker); map.addLayer(marker);
var visible = true; var visible = true;
marker.on('click', function () { marker.on('click', function () {
if (visible) { if (visible) {
marker.setOpacity(0.3); marker.setOpacity(0.3);
marker._icon.innerHTML = 'transparent'; marker.setIcon(transparentIcon)
} else { } else {
marker.setOpacity(1); marker.setOpacity(1);
marker._icon.innerHTML = 'opaque'; marker.setIcon(opaqueIcon);
} }
visible = !visible; visible = !visible;
}); });

View File

@ -18,10 +18,9 @@
<script> <script>
var map = L.map('map').setView([51.505, -0.09], 13); var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
map.on('click', function(e) { map.on('click', function(e) {
L.popup().setLatLng(e.latlng).setContent('Hello').openOn(map); L.popup().setLatLng(e.latlng).setContent('Hello').openOn(map);
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@ -74,7 +74,7 @@
// Map bounds // Map bounds
L.rectangle(bounds,{ L.rectangle(bounds,{
fill: false, fill: false,
stroke: 3, weight: 3,
color: 'black' color: 'black'
}).addTo(map); }).addTo(map);

View File

@ -137,9 +137,10 @@
geojson = L.geoJson(statesData, { geojson = L.geoJson(statesData, {
style: style, style: style,
onEachFeature: onEachFeature onEachFeature: onEachFeature
}).addTo(map); });
map.attributionControl.addAttribution('Population data &copy; <a href="http://census.gov/">US Census Bureau</a>'); geojson.getAttribution = function() { return 'Population data &copy; <a href="http://census.gov/">US Census Bureau</a>' };
geojson.addTo(map);
var legend = L.control({position: 'bottomright'}); var legend = L.control({position: 'bottomright'});

View File

@ -55,9 +55,9 @@
path.bindPopup('I am a polyline'); path.bindPopup('I am a polyline');
var p1 = latlngs[0], var p1 = latlngs[0],
p2 = latlngs[parseInt(len/4)], p2 = latlngs[Math.round(len / 4)],
p3 = latlngs[parseInt(len/3)], p3 = latlngs[Math.round(len / 3)],
p4 = latlngs[parseInt(len/2)], p4 = latlngs[Math.round(len / 2)],
p5 = latlngs[len - 1], p5 = latlngs[len - 1],
polygonPoints = [p1, p2, p3, p4, p5]; polygonPoints = [p1, p2, p3, p4, p5];

View File

@ -18,7 +18,9 @@
osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors', osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}); osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});
var map = new L.Map('map', {layers: [osm]}); var svg = L.svg();
var map = new L.Map('map', {layers: [osm], renderer: svg});
map.addLayer(L.marker(route[0])); map.addLayer(L.marker(route[0]));
map.addLayer(L.marker(route[route.length - 1])); map.addLayer(L.marker(route[route.length - 1]));
@ -51,7 +53,7 @@
'circle': circle, 'circle': circle,
'circleMarker': circleMarker, 'circleMarker': circleMarker,
'canvas': canvas, 'canvas': canvas,
'svg': map._renderer, 'svg': svg,
}, {collapsed: false}); }, {collapsed: false});
map.addControl(layersControl); map.addControl(layersControl);
</script> </script>