Skip to content

Commit

Permalink
svelte: map stuff and observatorypage
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnuesslein committed Mar 22, 2022
1 parent 72dbaca commit 0f5c42b
Show file tree
Hide file tree
Showing 22 changed files with 2,830 additions and 178 deletions.
194 changes: 194 additions & 0 deletions newfront/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions newfront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "next",
"@types/js-cookie": "^3.0.1",
"@types/leaflet": "^1.7.8",
"@types/leaflet.markercluster": "^1.4.6",
"@types/svelte-leafletjs": "^0.8.0",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"autoprefixer": "^10.4.2",
Expand All @@ -26,6 +29,9 @@
"graphql": "^16.3.0",
"graphql-request": "^4.0.0",
"js-cookie": "^3.0.1",
"leaflet": "^1.7.1",
"leaflet-gesture-handling": "^1.2.2",
"leaflet.markercluster": "^1.5.3",
"postcss": "^8.4.5",
"postcss-load-config": "^3.1.1",
"prettier": "^2.5.1",
Expand Down
60 changes: 60 additions & 0 deletions newfront/src/components/Map/BigMap.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<script lang="ts">
import { createEventDispatcher } from "svelte";
import LeafletMap from "$components/Map/LeafletMap.svelte";
import { baseLayers } from "$components/Map/layers";
import { TileLayer } from "leaflet";
// import iconRetinaUrl from "static/images/marker-icon-2x.png";
// import iconUrl from "$static/images/marker-icon.png";
// import shadowUrl from "$static/images/marker-shadow.png";
const dispatch = createEventDispatcher();
let lmap;
function mapReady(map) {
lmap = map.detail;
dispatch("ready", lmap);
console.log(lmap);
baseLayers.forEach((lay) => {
new TileLayer(lay.url, {
attribution: lay.attribution,
}).addTo(lmap);
});
}
// import { Icon, Map } from "leaflet";
// import { GestureHandling } from "leaflet-gesture-handling";
// import "leaflet-gesture-handling/dist/leaflet-gesture-handling.css";
// import "leaflet/dist/leaflet.css";
// Map.addInitHook("addHandler", "gestureHandling", GestureHandling);
// @ts-ignore
// delete Icon.Default.prototype._getIconUrl;
// let shadowSize = [0, 0];
// Icon.Default.mergeOptions({ iconRetinaUrl, iconUrl, shadowUrl, shadowSize });
export let options = {};
export let containerClass = "";
export let hideLayerSwitcher = false;
let LMap;
// computed: {
// visibleLayer() {
// return this.$store.state.visibleLayer;
// },
let mapOptions = {
zoomSnap: 0.5,
minZoom: 1,
zoom: 3,
zoomControl: true,
gestureHandling: true,
...options,
};
</script>

<div class="mx-auto relative {containerClass}">
<LeafletMap options={mapOptions} on:ready={mapReady} />
<!-- <BigMapStandaloneLayerSwitcher v-if="!hideLayerSwitcher" />-->
</div>
Loading

0 comments on commit 0f5c42b

Please sign in to comment.