]> git.openstreetmap.org Git - rails.git/blob - app/assets/javascripts/leaflet.shortbread.js
Switch to shortbread style with absolute URLs
[rails.git] / app / assets / javascripts / leaflet.shortbread.js
1 //= require leaflet.maplibre
2
3 L.OSM.Shortbread = L.OSM.MaplibreGL.extend({
4   onAdd: function (map) {
5     L.OSM.MaplibreGL.prototype.onAdd.call(this, map);
6     const styleURL = "https://vector.openstreetmap.org/styles/shortbread/" + this.options.styleName;
7     this.getMaplibreMap().setStyle(styleURL);
8   },
9   onRemove: function (map) {
10     L.OSM.MaplibreGL.prototype.onRemove.call(this, map);
11   }
12 });
13
14 L.OSM.ShortbreadColorful = L.OSM.Shortbread.extend({
15   options: {
16     styleName: "colorful.json"
17   }
18 });
19
20 L.OSM.ShortbreadEclipse = L.OSM.Shortbread.extend({
21   options: {
22     styleName: "eclipse.json"
23   }
24 });