equal
deleted
inserted
replaced
1 var map_config; |
1 var map_config; |
2 var map; |
2 var map; |
3 |
3 |
4 function map_init (_config) { |
4 function map_init (_config) { |
5 map_config = _config; |
5 map_config = _config; |
6 |
6 |
|
7 // pixel coordinates |
7 var bounds = L.latLngBounds( |
8 var bounds = L.latLngBounds( |
8 L.latLng(-map_config.image_height, 0), |
9 L.latLng(-map_config.image_height, 0), |
9 L.latLng(0, +map_config.image_width) |
10 L.latLng(0, +map_config.image_width) |
10 ); |
11 ); |
11 |
12 |
|
13 // in zoom-scaled coordinates |
|
14 var map_bounds = [ |
|
15 [ -(map_config.image_height >> map_config.tile_zoom), 0 ], |
|
16 [ 0, +(map_config.image_width >> map_config.tile_zoom) ], |
|
17 ]; |
|
18 |
12 map = L.map('map', { |
19 map = L.map('map', { |
13 crs: L .CRS.Simple, |
20 crs: L .CRS.Simple, |
14 minZoom: 0, |
21 minZoom: 0, |
15 maxZoom: map_config.tile_zoom, |
22 maxZoom: map_config.tile_zoom, |
16 maxBounds: bounds |
23 maxBounds: map_bounds |
17 }); |
24 }); |
18 |
25 |
19 map.on('move', map_move); |
26 map.on('move', map_move); |
20 |
27 |
21 L.tileLayer(map_config.tile_url, { |
28 L.tileLayer(map_config.tile_url, { |