I have made simple leaflet example. It renders procedural tiles with position and zoom displayed on each one. Projection and CRS are configured to map lat and lng directly to x and y without any transformation at zoom=20. You can easily check this by clicking on the map and viewing popup with coordinates.
var naturalZoom = 20;
L.Projection.Direct = {
project: function (latlng) {
return new L.Point(latlng.lat, -latlng.lng);
},
unproject: function (point) {
return new L.LatLng(point.x, -point.y);
}
};
L.CRS.Wall = L.extend({}, L.CRS, {
projection: L.Projection.Direct,
transformation: new L.Transformation(1, 0, -1, 0),
scale: function (zoom) {
return Math.pow(2, zoom-naturalZoom);
}
});
var map = L.map('map', {
crs: L.CRS.Wall,
maxBounds: new L.LatLngBounds([0,0], [4096, 4096])
});
map.setView([0,0], naturalZoom);
I am trying to restrict the bounds of the map (uncomment line #26 of the code in jsfiddle example) but this breaks the dragging of the whole layer. Does anyone have similar problem with custom crs and maxBounds? Can this be a bug in the leaflet library?
Thank you for any help.