Changeset 149 for binary-improvements
- Timestamp:
- Aug 31, 2014, 4:46:56 PM (10 years ago)
- Location:
- binary-improvements/webserver
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/webserver/css/style.css
r133 r149 5 5 background-color: #230000; 6 6 } 7 # pos{7 #info { 8 8 background-color: #aaaaaa; 9 9 position: absolute; -
binary-improvements/webserver/index.html
r133 r149 9 9 <body> 10 10 <div id="map"></div> 11 <div id="pos">Coords: </div> 11 <div id="info"> 12 MouseCoords: <span id="pos"></span><br/> 13 RegionFile: <span id="regfile"></span> 14 </div> 12 15 13 <script src="leaflet/leaflet.js"></script>14 <script src="js/index.js"></script>16 <script type="text/javascript" src="leaflet/leaflet.js"></script> 17 <script type="text/javascript" src="js/index.js"></script> 15 18 </body> 16 19 </html> -
binary-improvements/webserver/js/index.js
r133 r149 18 18 }); 19 19 20 var CoordToChunk = function(latlng) { 21 var x = Math.floor(((latlng.lng + 16777216) / 16) - (16777216 / 16)); 22 var y = Math.floor(((latlng.lat + 16777216) / 16) - (16777216 / 16)); 23 return L.latLng(y, x); 24 } 25 26 var CoordToRegion = function(latlng) { 27 var x = Math.floor(((latlng.lng + 16777216) / 512) - (16777216 / 512)); 28 var y = Math.floor(((latlng.lat + 16777216) / 512) - (16777216 / 512)); 29 return L.latLng(y, x); 30 } 31 32 var FormatCoord = function(latlng) { 33 return Math.abs(latlng.lat)+ (latlng.lat>=0 ? " N" : " S") + " / " + Math.abs(latlng.lng) + (latlng.lng>=0 ? " E" : " W"); 34 } 35 20 36 var map = L.map('map', { 21 37 zoomControl: true, … … 35 51 }).addTo(map); 36 52 53 37 54 map.on('mousemove', function(e) { 38 L.DomUtil.get('pos').textContent = "MouseCoord: " + Math.abs(e.latlng.lng) + (e.latlng.lng>=0 ? " E" : " W") + " / " + Math.abs(e.latlng.lat)+ (e.latlng.lat>=0 ? " N" : " S"); 55 var rf = CoordToRegion(e.latlng); 56 L.DomUtil.get('pos').textContent = FormatCoord(e.latlng); 57 L.DomUtil.get('regfile').textContent = "r." + rf.lng + "." + rf.lat + ".7rg"; 39 58 });
Note:
See TracChangeset
for help on using the changeset viewer.