Add leaflet-fullscreen

This commit is contained in:
Starbeamrainbowlabs 2019-01-17 14:07:31 +00:00
parent a65f5f619f
commit 542f0afcb0
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 18 additions and 3 deletions

View file

@ -1,4 +1,5 @@
@import "../../node_modules/leaflet/dist/leaflet.css"; @import "../../node_modules/leaflet/dist/leaflet.css";
@import "../../node_modules/leaflet-fullscreen/dist/leaflet.fullscreen.css";
main { main {
position: absolute; position: absolute;

View file

@ -1,6 +1,8 @@
"use strict"; "use strict";
import Leaflet from 'leaflet'; // Import leaflet, but some plugins require it to have the variable name 'L' :-/
import L from 'leaflet';
import 'leaflet-fullscreen';
import Config from './Config.mjs'; import Config from './Config.mjs';
@ -10,10 +12,12 @@ class Map {
} }
setup() { setup() {
this.map = Leaflet.map("map"); this.map = L.map("map", {
fullscreenControl: true
});
this.map.setView(Config.default_location, Config.default_zoom); this.map.setView(Config.default_location, Config.default_zoom);
this.layer_openstreet = Leaflet.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { this.layer_openstreet = L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
id: "openstreetmap", id: "openstreetmap",
maxZoom: 19, maxZoom: 19,
attribution: "&copy; <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap contributors</a>" attribution: "&copy; <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap contributors</a>"

9
package-lock.json generated
View file

@ -25,6 +25,15 @@
"@types/geojson": "*" "@types/geojson": "*"
} }
}, },
"@types/leaflet-fullscreen": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@types/leaflet-fullscreen/-/leaflet-fullscreen-1.0.4.tgz",
"integrity": "sha512-53z8+QALEkgVmsEp14EY89WqgAI/h9U2buJXOg/J5OtlV6PtpyO8+r0m44hSM9+HUCwUpSf1cZjLs76orZT1Tg==",
"dev": true,
"requires": {
"@types/leaflet": "*"
}
},
"@types/node": { "@types/node": {
"version": "10.12.18", "version": "10.12.18",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz",

View file

@ -24,6 +24,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/leaflet": "^1.2.14", "@types/leaflet": "^1.2.14",
"@types/leaflet-fullscreen": "^1.0.4",
"postcss-import": "^12.0.1", "postcss-import": "^12.0.1",
"postcss-url": "^8.0.0", "postcss-url": "^8.0.0",
"rollup": "^1.1.0", "rollup": "^1.1.0",