UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

26 lines (19 loc) 527 B
/* * A simple CRS that can be used for flat non-Earth maps like panoramas or game maps. */ L.CRS.Simple = L.extend({}, L.CRS, { projection: L.Projection.LonLat, transformation: new L.Transformation(1, 0, -1, 0), scale: function (zoom) { return Math.pow(2, zoom); }, zoom: function (scale) { return Math.log(scale) / Math.LN2; }, distance: function (latlng1, latlng2) { var dx = latlng2.lng - latlng1.lng, dy = latlng2.lat - latlng1.lat; return Math.sqrt(dx * dx + dy * dy); }, infinite: true });