CloudMade/Leaflet — pull request #844 by jtreml (2012-07-28 12:15:45+00:00)
Title: Add support for custom units in scale control

This is meant as a more lightweight (yet also more flexible) solution to the nautical miles scale proposed in https://github.com/CloudMade/Leaflet/pull/839, not introducing any more (unit) specific code (rounding functions, etc.) into the leaflet core, but instead allowing leaflet users to implement any custom scale via a simple callback function.

Would this be more appropriate to go into leaflet core?

Commit message with details:
Custom unit works via a callback that is passed the current
maximum scale in meters and supposed to return a hash containing
a caption (number and unit) to be displayed in the scale control
and a ratio (rounded meters / max meters) for correct sizing of
the scale control.

For convenience and consistency, the callback also receives a
reference to the default leaflet scale control rounding function.

Styles have been more made slightly more generic to (theoretically)
support an infinite number of scales (treating the first and last
ones as special).

The controls example has be amended with an example of a custom
scale (nautical miles).