Open scaddenp opened 4 years ago
Hi, I think it might actually be better to throw an error when constructing the CRS
without scales
or resolutions
, since it is highly unlikely the default scale
calculation will work - it is pretty closely tied to the way spherical Mercator works in Leaflet, IIRC.
Hmm. I ran into it with a custom version of world mercator (Pacific-centric custom version without the antimeridian hassles). No resolutions information available from tiler. Not sure how you would specify scales and resolution to imitate the default calculation. How about possibility of passing scale and resolution functions in? ie options of scaleFunction, resolutionFunction. Or maybe just option of "useMercatorScales". If true, then inherit functions from L.CRS since they are the most likely functions to use.
Sorry for the delay, don't have much time for open source maintenance these days.
I would go with allowing scale/resolution to be either an array or a function, I think it is a quite common pattern in the JavaScript world, and I seem to remember even Leaflet using it for some options. That would allow a lot of flexibility!
Yes, I agree. That is an excellent suggestion. Maximum flexibility.
The L.CRS.scale and zoom function depend on _scales array. If neither scales nor resoltions defined in the constructor, then it fails. I believe it use parent (L.CRS) methods when _scales is not defined.