Changeset 9196 for src/django_gheat/website/static/heatmap.js
- Timestamp:
- May 13, 2011, 12:23:52 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/static/heatmap.js
r9190 r9196 21 21 map.events.register('click', map, GetMousePos); 22 22 function GetMousePos(pos) { 23 var pixbuffer = 100; 24 var sw = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x+pixbuffer,pos.xy.y-pixbuffer)); 25 var ne = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x-pixbuffer,pos.xy.y+pixbuffer)); 26 var pointsw = OpenLayers.Layer.SphericalMercator.inverseMercator(sw.lon, sw.lat); 27 var pointne = OpenLayers.Layer.SphericalMercator.inverseMercator(ne.lon, ne.lat); 28 getNodeList(pointsw, pointne); 23 var pix = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x,pos.xy.y)); 24 var mousepos = OpenLayers.Layer.SphericalMercator.inverseMercator(pix.lon, pix.lat); 25 var zoomlevel = map.getZoom(); 26 getNodeList(zoom, mousepos); 29 27 } 30 28 … … 49 47 } 50 48 51 function getNodeList( sw, ne){49 function getNodeList(zoomlevel, mousepos){ 52 50 var nodelist; 53 51 if (window.XMLHttpRequest){ … … 62 60 nodelist.onreadystatechange=function(){ 63 61 if (nodelist.readyState==4 && nodelist.status==200){ 64 txt=nodelist.responseText 62 txt=nodelist.responseText; 65 63 document.getElementById('nodelist').innerHTML=txt; 66 64 } 67 65 } 68 66 69 nodelist.open("GET","/website/nodelist/" + sw.lat + "," + sw.lon + "," + ne.lat + "," + ne.lon,true);67 nodelist.open("GET","/website/nodelist/" + zoomlevel + "," + mousepos.lat + "," + mousepos.lon,true); 70 68 nodelist.send(); 71 69 }
Note:
See TracChangeset
for help on using the changeset viewer.