UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

33 lines (25 loc) 845 B
/* * L.CRS is a base object for all defined CRS (Coordinate Reference Systems) in Leaflet. */ L.CRS = { latLngToPoint: function (latlng, zoom) { // (LatLng, Number) -> Point var projectedPoint = this.projection.project(latlng), scale = this.scale(zoom); return this.transformation._transform(projectedPoint, scale); }, pointToLatLng: function (point, zoom) { // (Point, Number[, Boolean]) -> LatLng var scale = this.scale(zoom), untransformedPoint = this.transformation.untransform(point, scale); return this.projection.unproject(untransformedPoint); }, project: function (latlng) { return this.projection.project(latlng); }, scale: function (zoom) { return 256 * Math.pow(2, zoom); }, getSize: function (zoom) { var s = this.scale(zoom); return L.point(s, s); } };