Changeset 149 for binary-improvements


Ignore:
Timestamp:
Aug 31, 2014, 4:46:56 PM (5 years ago)
Author:
alloc
Message:

Webserver files

Location:
binary-improvements/webserver
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements/webserver/css/style.css

    r133 r149  
    55  background-color: #230000;
    66}
    7 #pos {
     7#info {
    88  background-color: #aaaaaa;
    99  position: absolute;
  • binary-improvements/webserver/index.html

    r133 r149  
    99<body>
    1010        <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>
    1215
    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>
    1518</body>
    1619</html>
  • binary-improvements/webserver/js/index.js

    r133 r149  
    1818});
    1919
     20var 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
     26var 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
     32var 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
    2036var map = L.map('map', {
    2137        zoomControl: true,
     
    3551}).addTo(map);
    3652
     53
    3754map.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";
    3958});
Note: See TracChangeset for help on using the changeset viewer.