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
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);

View File

@ -197,7 +197,7 @@
map.addLayer(grid);
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),
marker4 = L.marker(sf).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 marker1 = L.marker(kyiv).addTo(map),
marker2 = L.marker(lnd).addTo(map);
marker2 = L.marker(lnd).addTo(map),
marker3 = L.marker(dc).addTo(map),
marker4 = L.marker(sf).addTo(map),
marker5 = L.marker(trd).addTo(map),

View File

@ -10,7 +10,6 @@
<link rel="stylesheet" href="../css/screen.css" />
<script type="text/javascript" src="../../build/deps.js"></script>
<script src="../leaflet-include.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.0.js'></script>
</head>
<body>
@ -26,7 +25,7 @@
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 topoMap = new L.TileLayer(topoUrl, { maxZoom: 19, attribution: 'Tiles: &copy; Esri' });
map.addLayer(topoMap);

View File

@ -3,8 +3,9 @@
<link rel="stylesheet" href="../../dist/leaflet.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>
<body>
@ -12,8 +13,6 @@
<script>
$(document).ready(function() {
//Init a map, and attempt a locate.
var map = L.map('map', {
center: [39.84, -96.591],
@ -33,13 +32,8 @@
});
//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 type="text/javascript" src="../../build/deps.js"></script>
<script src="../leaflet-include.js"></script>
</body>
</html>

View File

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

View File

@ -13,7 +13,7 @@
osm = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
recreateMap = function(){
var recreateMap = function(){
// destroy previous map and div
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" />
<script type="text/javascript" src="../../build/deps.js"></script>
<script src="../leaflet-include.js"></script>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.8.0.js'></script>
</head>
<body>
<p>
@ -47,12 +46,10 @@
dragging : false,
worldCopyJump : true
});
$("#foo").click(function() {
document.getElementById("foo").addEventListener('click', function() {
map2.dragging.enable();
});
addLayerAndMarker(map1);
addLayerAndMarker(map2);

View File

@ -31,17 +31,19 @@
var map = new L.Map('map', {center: latlng, zoom: 15, layers: [osm]});
//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);
var visible = true;
marker.on('click', function () {
if (visible) {
marker.setOpacity(0.3);
marker._icon.innerHTML = 'transparent';
marker.setIcon(transparentIcon)
} else {
marker.setOpacity(1);
marker._icon.innerHTML = 'opaque';
marker.setIcon(opaqueIcon);
}
visible = !visible;
});

View File

@ -21,7 +21,6 @@
map.on('click', function(e) {
L.popup().setLatLng(e.latlng).setContent('Hello').openOn(map);
});
</script>
</body>
</html>

View File

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

View File

@ -137,9 +137,10 @@
geojson = L.geoJson(statesData, {
style: style,
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'});

View File

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

View File

@ -18,7 +18,9 @@
osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
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[route.length - 1]));
@ -51,7 +53,7 @@
'circle': circle,
'circleMarker': circleMarker,
'canvas': canvas,
'svg': map._renderer,
'svg': svg,
}, {collapsed: false});
map.addControl(layersControl);
</script>