I am using Leaflet 0.7.7, the latest stable release, and I am using custom CRS inherited from L.CRS.Simple .
CRS:
It is very similar to Simple CRS, but with c set to 1 (in Simple, c set to -1 ).
L.CRS.XY = L.Util.extend({}, L.CRS.Simple, { code: 'XY', projection: L.Projection.LonLat, transformation: new L.Transformation(1, 0, 1, 0) });
The goal of this CRS is to have a real display system {x, y} , where y gets higher when reaching the bottom of the map (for example, a bitmap image).
Verification Code:
var southWest = L.latLng(133, 0); var northEast = L.latLng(0, 170); var bounds = L.latLngBounds(southWest, northEast); document._map.setMaxBounds(bounds); document._map.fitBounds(bounds); document._markers[68].setLatLng(bounds.getNorthEast()); console.info('southWest', southWest);
In fact, since I have custom CRS, I think that these lines are the source of the problem, since the maximum and minimum values are incorrect in the {x, y} plane (even if I would prefer to use the "Point", but I can only use LatLng objects: confused :).
Actually, it seems obvious that this problem comes from my code, but in fact I would like to find a solution for this, that I did not need to switch to L.CRS.Simple , in which y above on the map.
So what is the solution to using borders with this simple custom projection?