source: binary-improvements/webserver/js/index.js@ 145

Last change on this file since 145 was 133, checked in by alloc, 10 years ago

Fixes

  • Property svn:executable set to *
File size: 957 bytes
Line 
1SDTD_Projection = {
2 project: function (latlng) {
3 return new L.Point(latlng.lng / 16, latlng.lat / 16);
4 },
5
6 unproject: function (point) {
7 return new L.LatLng(point.y * 16, point.x * 16);
8 }
9};
10
11SDTD_CRS = L.extend({}, L.CRS.Simple, {
12 projection: SDTD_Projection,
13 transformation: new L.Transformation(1, 0, -1, 0),
14
15 scale: function (zoom) {
16 return Math.pow(2, zoom);
17 }
18});
19
20var map = L.map('map', {
21 zoomControl: true,
22 attributionControl: false,
23 crs: SDTD_CRS
24}).setView([0, 0], 0);
25
26L.tileLayer('../../map/{z}/{x}/{y}.png?t={time}', {
27 maxZoom: 5,
28 minZoom: 0,
29 maxNativeZoom: 4,
30 tileSize: 128,
31 continuousWorld: true,
32 tms: true,
33 unloadInvisibleTiles: true,
34 time: function() { return new Date().getTime(); }
35}).addTo(map);
36
37map.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");
39});
Note: See TracBrowser for help on using the repository browser.