# HG changeset patch # User Tero Marttila # Date 1410729351 -10800 # Node ID 22efa9fe73c83fd97720a2f791096e6e5a4561bd # Parent 9b316e83e9e33afb497be9d64a9e1208c0f0464c pngtile: fix map_bounds diff -r 9b316e83e9e3 -r 22efa9fe73c8 static/pngtile/map.js --- a/static/pngtile/map.js Mon Sep 15 00:10:43 2014 +0300 +++ b/static/pngtile/map.js Mon Sep 15 00:15:51 2014 +0300 @@ -3,17 +3,24 @@ function map_init (_config) { map_config = _config; - + + // pixel coordinates var bounds = L.latLngBounds( L.latLng(-map_config.image_height, 0), L.latLng(0, +map_config.image_width) ); + // in zoom-scaled coordinates + var map_bounds = [ + [ -(map_config.image_height >> map_config.tile_zoom), 0 ], + [ 0, +(map_config.image_width >> map_config.tile_zoom) ], + ]; + map = L.map('map', { crs: L .CRS.Simple, minZoom: 0, maxZoom: map_config.tile_zoom, - maxBounds: bounds + maxBounds: map_bounds }); map.on('move', map_move);