From 425fa13cb45c417ed07173d5b7892af04ed9acf2 Mon Sep 17 00:00:00 2001 From: Nathan Cahill Date: Fri, 29 Apr 2016 03:35:50 -0600 Subject: [PATCH] Various debug fixes (#4515) * various debug fixes * fix mixed spaces and tabs --- debug/map/image-overlay.html | 4 +- debug/map/layer_remove_add.html | 18 ++-- debug/map/markers.html | 18 ++-- debug/map/opacity.html | 75 +++++++-------- debug/map/tile-debug.html | 2 +- debug/map/zoom-remain-centered.html | 10 +- debug/map/zoompan.html | 2 +- debug/tests/bringtoback.html | 3 +- debug/tests/canvasloop.html | 12 +-- debug/tests/click_on_canvas.html | 76 +++++++-------- debug/tests/detached-dom-memory-leak.html | 6 +- debug/tests/dragging_and_copyworldjump.html | 9 +- debug/tests/mousemove_on_polygons.html | 30 +++--- debug/tests/opacity.html | 20 ++-- debug/tests/popupcontextmenuclicks.html | 20 ++-- debug/tests/remove_while_dragging.html | 2 +- debug/tests/rtl2.html | 27 +++--- debug/tests/svg_clicks.html | 38 ++++---- debug/tests/tile-opacity.html | 4 +- debug/tests/touch-shake.html | 2 +- debug/tests/touch-zoom-bounce.html | 26 ++--- debug/vector/bounds-extend.html | 100 ++++++++++---------- debug/vector/geojson.html | 19 ++-- debug/vector/vector-bounds.html | 6 +- debug/vector/vector-canvas.html | 20 ++-- debug/vector/vector2.html | 6 +- 26 files changed, 273 insertions(+), 282 deletions(-) diff --git a/debug/map/image-overlay.html b/debug/map/image-overlay.html index cb136015..21377b6b 100644 --- a/debug/map/image-overlay.html +++ b/debug/map/image-overlay.html @@ -28,8 +28,8 @@ map.addLayer(osm); var bounds = new L.LatLngBounds( - new L.LatLng(40.71222,-74.22655), - new L.LatLng(40.77394,-74.12544)); + new L.LatLng(40.71222,-74.22655), + new L.LatLng(40.77394,-74.12544)); map.fitBounds(bounds); diff --git a/debug/map/layer_remove_add.html b/debug/map/layer_remove_add.html index 9397728f..46a964f6 100644 --- a/debug/map/layer_remove_add.html +++ b/debug/map/layer_remove_add.html @@ -1,23 +1,23 @@ - Leaflet debug page + Leaflet debug page - + - + - + - - + + -
+
- + diff --git a/debug/map/markers.html b/debug/map/markers.html index 075dea21..9669c927 100644 --- a/debug/map/markers.html +++ b/debug/map/markers.html @@ -1,22 +1,22 @@ - Leaflet debug page + Leaflet debug page - + - + - + - - + + -
+
- + diff --git a/debug/map/opacity.html b/debug/map/opacity.html index 65baa95d..e0dc3fd4 100644 --- a/debug/map/opacity.html +++ b/debug/map/opacity.html @@ -13,22 +13,22 @@ @@ -67,8 +67,8 @@ - @@ -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: © Esri' }); map.addLayer(topoMap); diff --git a/debug/tests/canvasloop.html b/debug/tests/canvasloop.html index 6e64c908..6f5dbcf8 100644 --- a/debug/tests/canvasloop.html +++ b/debug/tests/canvasloop.html @@ -3,8 +3,9 @@ - + + @@ -12,8 +13,6 @@ - - - diff --git a/debug/tests/click_on_canvas.html b/debug/tests/click_on_canvas.html index 6b20a623..834e277f 100644 --- a/debug/tests/click_on_canvas.html +++ b/debug/tests/click_on_canvas.html @@ -8,51 +8,47 @@ - - - -
+ + diff --git a/debug/tests/detached-dom-memory-leak.html b/debug/tests/detached-dom-memory-leak.html index 220cfe11..ddf56cde 100644 --- a/debug/tests/detached-dom-memory-leak.html +++ b/debug/tests/detached-dom-memory-leak.html @@ -9,11 +9,11 @@ -

@@ -47,11 +46,9 @@ dragging : false, worldCopyJump : true }); - $("#foo").click(function() { - map2.dragging.enable(); - }); - - + document.getElementById("foo").addEventListener('click', function() { + map2.dragging.enable(); + }); addLayerAndMarker(map1); addLayerAndMarker(map2); diff --git a/debug/tests/mousemove_on_polygons.html b/debug/tests/mousemove_on_polygons.html index 96c08acb..62114fb4 100644 --- a/debug/tests/mousemove_on_polygons.html +++ b/debug/tests/mousemove_on_polygons.html @@ -49,9 +49,9 @@ - + + -

- +
+ - + diff --git a/debug/tests/remove_while_dragging.html b/debug/tests/remove_while_dragging.html index 29911571..4d29c5fa 100644 --- a/debug/tests/remove_while_dragging.html +++ b/debug/tests/remove_while_dragging.html @@ -20,7 +20,7 @@ var marker = L.marker([50, 50], {draggable: true}).addTo(map); setTimeout(function() { - map.removeLayer(marker); + map.removeLayer(marker); }, 3000); diff --git a/debug/tests/rtl2.html b/debug/tests/rtl2.html index eaa4f635..03236e38 100644 --- a/debug/tests/rtl2.html +++ b/debug/tests/rtl2.html @@ -1,27 +1,26 @@ - + - + - + - - - + + +
diff --git a/debug/tests/svg_clicks.html b/debug/tests/svg_clicks.html index 706f3456..d2e175b1 100644 --- a/debug/tests/svg_clicks.html +++ b/debug/tests/svg_clicks.html @@ -24,29 +24,29 @@ initmap(); function initmap() { - // set up the map - map = new L.Map('map'); + // set up the map + map = new L.Map('map'); - // create the tile layer with correct attribution - var osmUrl = 'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png'; - var osm = new L.TileLayer(osmUrl, { minZoom: 1, maxZoom: 17 }); - map.addLayer(osm); - map.fitBounds(new L.LatLngBounds([51,7],[51,7])); + // create the tile layer with correct attribution + var osmUrl = 'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png'; + var osm = new L.TileLayer(osmUrl, { minZoom: 1, maxZoom: 17 }); + map.addLayer(osm); + map.fitBounds(new L.LatLngBounds([51,7],[51,7])); - var route = L.polyline([ - [51, 7.000], - [51.002, 7.004], - [51.004, 7.006] - ]).addTo(map).on('click',function(e){console.log('bottom')}) + var route = L.polyline([ + [51, 7.000], + [51.002, 7.004], + [51.004, 7.006] + ]).addTo(map).on('click',function(e){console.log('bottom')}) - var route2 = L.polyline([ - [51, 7.000], - [51.002, 7.004] - ], - { interactive:false,color:'#f00' } - ).addTo(map); + var route2 = L.polyline([ + [51, 7.000], + [51.002, 7.004] + ], + { interactive:false,color:'#f00' } + ).addTo(map); - // when the mouse hovers over the red route2, you cannot click through the blue route1 beneath + // when the mouse hovers over the red route2, you cannot click through the blue route1 beneath }; diff --git a/debug/tests/tile-opacity.html b/debug/tests/tile-opacity.html index 0430328c..e6cdd3ed 100644 --- a/debug/tests/tile-opacity.html +++ b/debug/tests/tile-opacity.html @@ -21,8 +21,8 @@ - - Leaflet test for pinch-zoom-without-bounce - + + Leaflet test for pinch-zoom-without-bounce + @@ -150,6 +150,6 @@ pinchAndPanV(); // pinchAndPanII(); - + \ No newline at end of file diff --git a/debug/vector/bounds-extend.html b/debug/vector/bounds-extend.html index db57402c..29304e81 100644 --- a/debug/vector/bounds-extend.html +++ b/debug/vector/bounds-extend.html @@ -1,35 +1,35 @@ - Leaflet debug page + Leaflet debug page - + - + - - + + -
+
- - + + diff --git a/debug/vector/geojson.html b/debug/vector/geojson.html index d52c1fa5..8b274f6c 100644 --- a/debug/vector/geojson.html +++ b/debug/vector/geojson.html @@ -78,13 +78,13 @@ // get color depending on population density value function getColor(d) { return d > 1000 ? '#800026' : - d > 500 ? '#BD0026' : - d > 200 ? '#E31A1C' : - d > 100 ? '#FC4E2A' : - d > 50 ? '#FD8D3C' : - d > 20 ? '#FEB24C' : - d > 10 ? '#FED976' : - '#FFEDA0'; + d > 500 ? '#BD0026' : + d > 200 ? '#E31A1C' : + d > 100 ? '#FC4E2A' : + d > 50 ? '#FD8D3C' : + d > 20 ? '#FEB24C' : + d > 10 ? '#FED976' : + '#FFEDA0'; } function style(feature) { @@ -137,9 +137,10 @@ geojson = L.geoJson(statesData, { style: style, onEachFeature: onEachFeature - }).addTo(map); + }); - map.attributionControl.addAttribution('Population data © US Census Bureau'); + geojson.getAttribution = function() { return 'Population data © US Census Bureau' }; + geojson.addTo(map); var legend = L.control({position: 'bottomright'}); diff --git a/debug/vector/vector-bounds.html b/debug/vector/vector-bounds.html index 6b303ed5..7f982325 100644 --- a/debug/vector/vector-bounds.html +++ b/debug/vector/vector-bounds.html @@ -51,9 +51,9 @@ var poly = new L.Polygon(latlngs2); var map = new L.Map('map', { - layers: [osm], - center: new L.LatLng(39.69596043694606, -104.95084762573242), - zoom: 12 + layers: [osm], + center: new L.LatLng(39.69596043694606, -104.95084762573242), + zoom: 12 }); //map.fitBounds(new L.LatLngBounds(latlngs)); diff --git a/debug/vector/vector-canvas.html b/debug/vector/vector-canvas.html index f89c2c94..e62fc987 100644 --- a/debug/vector/vector-canvas.html +++ b/debug/vector/vector-canvas.html @@ -12,9 +12,9 @@
- - - + + + @@ -37,10 +37,10 @@ var circleLocation = new L.LatLng(51.508, -0.11), circleOptions = { - color: 'red', - fillColor: 'yellow', - fillOpacity: 0.7, - renderer: canvas + color: 'red', + fillColor: 'yellow', + fillOpacity: 0.7, + renderer: canvas }; var circle = new L.Circle(circleLocation, 500000, circleOptions), @@ -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]; diff --git a/debug/vector/vector2.html b/debug/vector/vector2.html index 6f1c093c..a333a52e 100644 --- a/debug/vector/vector2.html +++ b/debug/vector/vector2.html @@ -18,7 +18,9 @@ osmAttrib = '© OpenStreetMap 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);