Unverified Commit 0809c8bf authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by GitHub
Browse files

Merge pull request #92 from vue-leaflet/crs-by-name

Allow Leaflet CRSs to be specified by name
parents d2086316 0e1fcc53
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -95,11 +95,14 @@ export default {
      default: false,
    },
    /**
     * The crs option for the map
     * @values CRS.EPSG3857
     * The CRS to use for the map. Can be an object that defines a coordinate reference
     * system for projecting geographical points into screen coordinates and back
     * (see https://leafletjs.com/reference-1.7.1.html#crs-l-crs-base), or a string
     * name identifying one of Leaflet's defined CRSs, such as "EPSG4326".
     */
    crs: {
      type: Object,
      type: [String, Object],
      default: "EPSG3857",
    },
    maxBoundsViscosity: {
      type: Number,
@@ -214,7 +217,10 @@ export default {
        "leaflet/dist/leaflet-src.esm"
      );
      await resetWebpackIcon(Icon);
      options.crs = options.crs || CRS.EPSG3857;

      const optionsCrs =
        typeof options.crs == "string" ? CRS[options.crs] : options.crs;
      options.crs = optionsCrs || CRS.EPSG3857;

      const methods = {
        addLayer(layer) {