-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3e1dd2
commit 2671f58
Showing
9 changed files
with
447 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<template> | ||
<div> | ||
<l-map | ||
ref="lmap" | ||
style="min-height: 500px" | ||
:zoom="zoom" | ||
:center="center" | ||
@ready="onMapReady" | ||
> | ||
<LTileLayer | ||
ref="layer1" | ||
url="https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png" | ||
attribution='&copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors' | ||
layer-type="base" | ||
name="OpenStreetMap" | ||
/> | ||
<LTileLayer | ||
ref="layer2" | ||
url="https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png" | ||
/> | ||
</l-map> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type L from 'leaflet' | ||
import { LMap, LTileLayer } from '@vue-leaflet/vue-leaflet' | ||
import type { PointExpression } from 'leaflet' | ||
import { ref } from 'vue' | ||
// Map references | ||
const lmap = ref<any>(null) | ||
const zoom = ref(15) | ||
const center = ref([47.21322, -1.559482] as PointExpression) | ||
const { $SplitMap } = useNuxtApp() | ||
const splitControl = ref<L.Control | null>(null) | ||
const layer1 = ref(null) | ||
const layer2 = ref(null) | ||
const controlOptions = ref({ thumbSize: 42, padding: 0 }) | ||
const onMapReady = () => { | ||
afterMapReady() | ||
} | ||
const afterMapReady = () => { | ||
try { | ||
if ($SplitMap && lmap.value?.leafletObject) { | ||
splitControl.value = $SplitMap( | ||
layer1.value.leafletObject, | ||
layer2.value.leafletObject, | ||
controlOptions.value | ||
) | ||
splitControl.value?.addTo(lmap.value.leafletObject) | ||
} else { | ||
console.error('$SplitMap or lmap is not available') | ||
} | ||
} catch (error) { | ||
console.error('Error initializing SplitMap control:', error) | ||
} | ||
} | ||
// Hook to run when the component is mounted | ||
</script> | ||
|
||
<style lang="scss"></style> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
.leaflet-sbs-range { | ||
position: absolute; | ||
top: 50%; | ||
width: 100%; | ||
z-index: 999; | ||
} | ||
.leaflet-sbs-divider { | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
left: 50%; | ||
margin-left: -2px; | ||
width: 4px; | ||
background-color: rgb(var(--v-theme-primary)); | ||
pointer-events: none; | ||
z-index: 999; | ||
} | ||
.leaflet-sbs-range { | ||
appearance: none; | ||
display: inline-block !important; | ||
vertical-align: middle; | ||
height: 0; | ||
padding: 0; | ||
margin: 0; | ||
border: 0; | ||
background: rgba(0, 0, 0, 0.25); | ||
min-width: 100px; | ||
cursor: pointer; | ||
pointer-events: none; | ||
z-index: 999; | ||
} | ||
.leaflet-sbs-range::-ms-fill-upper { | ||
background: transparent; | ||
} | ||
.leaflet-sbs-range::-ms-fill-lower { | ||
background: rgba(255, 255, 255, 0.25); | ||
} | ||
/* Browser thingies */ | ||
|
||
.leaflet-sbs-range::-moz-range-track { | ||
opacity: 0; | ||
} | ||
.leaflet-sbs-range::-ms-track { | ||
opacity: 0; | ||
} | ||
.leaflet-sbs-range::-ms-tooltip { | ||
display: none; | ||
} | ||
/* For whatever reason, these need to be defined | ||
* on their own so dont group them */ | ||
|
||
.leaflet-sbs-range::-webkit-slider-thumb { | ||
-webkit-appearance: none; | ||
margin: 0; | ||
padding: 0; | ||
background: rgb(var(--v-theme-primary)); | ||
height: 40px; | ||
width: 40px; | ||
border-radius: 20px; | ||
cursor: ew-resize; | ||
pointer-events: auto; | ||
border: 1px solid rgb(var(--v-theme-primary)); | ||
background-image: url('/icons/compare2.svg'); | ||
background-position: 50% 50%; | ||
background-repeat: no-repeat; | ||
background-size: 40px 40px; | ||
filter: brightness(0) saturate(100%) rgb(var(--v-theme-primary)); | ||
} | ||
|
||
.leaflet-sbs-range::-ms-thumb { | ||
margin: 0; | ||
padding: 0; | ||
background: rgb(var(--v-theme-primary)); | ||
height: 40px; | ||
width: 40px; | ||
border-radius: 20px; | ||
cursor: ew-resize; | ||
pointer-events: auto; | ||
border: 1px solid rgb(var(--v-theme-primary)); | ||
background-image: url('/icons/compare2.svg'); | ||
background-position: 50% 50%; | ||
background-repeat: no-repeat; | ||
background-size: 40px 40px; | ||
filter: brightness(0) saturate(100%) rgb(var(--v-theme-primary)); | ||
} | ||
|
||
.leaflet-sbs-range::-moz-range-thumb { | ||
padding: 0; | ||
right: 0; | ||
background: rgb(var(--v-theme-primary)); | ||
height: 40px; | ||
width: 40px; | ||
border-radius: 20px; | ||
cursor: ew-resize; | ||
pointer-events: auto; | ||
border: 1px solid rgb(var(--v-theme-primary)); | ||
background-image: url('/icons/compare2.svg'); | ||
background-position: 50% 50%; | ||
background-repeat: no-repeat; | ||
background-size: 40px 40px; | ||
filter: brightness(0) saturate(100%) rgb(var(--v-theme-primary)); | ||
} | ||
|
||
.leaflet-sbs-range:disabled::-moz-range-thumb { | ||
cursor: default; | ||
} | ||
.leaflet-sbs-range:disabled::-ms-thumb { | ||
cursor: default; | ||
} | ||
.leaflet-sbs-range:disabled::-webkit-slider-thumb { | ||
cursor: default; | ||
} | ||
.leaflet-sbs-range:disabled { | ||
cursor: default; | ||
} | ||
.leaflet-sbs-range:focus { | ||
outline: none !important; | ||
} | ||
.leaflet-sbs-range::-moz-focus-outer { | ||
border: 0; | ||
} |
Oops, something went wrong.