minor cleanup

This commit is contained in:
mourner 2012-02-25 17:13:30 +02:00
parent 90198ec519
commit fc0b477622
6 changed files with 3 additions and 89 deletions

View File

@ -1,29 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Leaflet debug page</title>
<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>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
latlng = new L.LatLng(50.5, 30.51);
var map = new L.Map('map').addLayer(cloudmade).setView(latlng, 15);
var zoomControl = new L.Control.Zoom();
map.addControl(zoomControl);
</script>
</body>
</html>

View File

@ -1,55 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Leaflet debug page</title>
<meta name="viewport" content="initial-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]-->
<script src="../leaflet-include.js"></script>
</head>
<body>
<div id="map" style="width: 500px; height: 500px;"></div>
<button onclick="javascript:capture1();">Capture Bounds 1</button>
<button onclick="javascript:capture2();">Capture Bounds 2</button>
<button onclick="javascript:testBounds();">Test Bounds</button>
<script type="text/javascript">
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}),
bounds = new L.LatLngBounds(new L.LatLng(49.5, -11.3), new L.LatLng(61.2, 2.5));
var bounds1, bounds2;
var map = new L.Map('map', {
center: bounds.getCenter(),
zoom: 7,
layers: [cloudmade],
maxBounds: bounds
});
function capture1 () {
bounds1 = map.getBounds();
}
function capture2() {
bounds2 = map.getBounds();
}
function testBounds() {
if (!(bounds1 && bounds2)) {
alert("Bounds 1 and 2 have not been set");
return;
}
alert("Bounds 1 " + (bounds1.equals(bounds2) ? "equals": "does not equal") + " bounds 2.")
}
</script>
</body>
</html>

View File

@ -87,10 +87,8 @@ L.Control.Scale = L.Control.extend({
var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1), var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1),
d = num / pow10; d = num / pow10;
return pow10 * (d >= 10 ? d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 2 ? 2 : 1;
10 :
d >= 5 ? return pow10 * d;
5 :
d >= 2 ? 2 : 1);
} }
}); });