-
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
Showing
26 changed files
with
847 additions
and
488 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,4 +65,3 @@ defineProps<AddContentPanelProps>(); | |
const appState = appStateStore(); | ||
</script> | ||
|
125 changes: 68 additions & 57 deletions
125
service/src/main/frontend/src/components/BasemapItem.vue
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 |
---|---|---|
@@ -1,69 +1,80 @@ | ||
<template> | ||
<q-item class="q-pa-sm" clickable v-ripple @click="itemClick"> | ||
<q-item-section avatar dense> | ||
<q-radio ref="radio" v-model="selection" :val="basemap.title" @click="enableBasemap" /> | ||
</q-item-section> | ||
<q-item-section> | ||
<q-item-label lines="1"> | ||
{{ displayLabel }} | ||
</q-item-label> | ||
<q-item-label caption lines="3"> | ||
<div v-html="caption" /> | ||
</q-item-label> | ||
</q-item-section> | ||
<q-item-section side> | ||
<div style="width: 64px; height: 64px; overflow: hidden;"> | ||
<img :src="thumbnailUrl" /> | ||
</div> | ||
</q-item-section> | ||
</q-item> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, Ref } from 'vue'; | ||
import { basemapsStore, Basemap } from 'stores/basemaps-store' | ||
import { simpleMapStore } from 'stores/simple-map-store' | ||
import { QRadio } from 'quasar'; | ||
<q-item class="q-pa-sm" clickable v-ripple @click="itemClick"> | ||
<q-item-section avatar dense> | ||
<q-radio | ||
ref="radio" | ||
v-model="selection" | ||
:val="basemap.title" | ||
@click="enableBasemap" | ||
/> | ||
</q-item-section> | ||
<q-item-section> | ||
<q-item-label lines="1"> | ||
{{ displayLabel }} | ||
</q-item-label> | ||
<q-item-label caption lines="3"> | ||
<div v-html="caption" /> | ||
</q-item-label> | ||
</q-item-section> | ||
<q-item-section side> | ||
<div style="width: 64px; height: 64px; overflow: hidden"> | ||
<img :src="thumbnailUrl" /> | ||
</div> | ||
</q-item-section> | ||
</q-item> | ||
</template> | ||
|
||
interface BasemapItem { | ||
basemap: Basemap; | ||
selection: Ref<string>; | ||
} | ||
<script setup lang="ts"> | ||
import { ref, Ref } from 'vue'; | ||
import { basemapsStore, Basemap } from 'stores/basemaps-store'; | ||
import { simpleMapStore } from 'stores/simple-map-store'; | ||
import { QRadio } from 'quasar'; | ||
const radio = ref<QRadio>(); | ||
interface BasemapItem { | ||
basemap: Basemap; | ||
selection: Ref<string>; | ||
} | ||
const leafletMap = simpleMapStore; | ||
const basemaps = basemapsStore(); | ||
const radio = ref<QRadio>(); | ||
const props = defineProps<BasemapItem>(); | ||
const basemap = props.basemap; | ||
const selection = props.selection; | ||
const leafletMap = simpleMapStore; | ||
const basemaps = basemapsStore(); | ||
const displayLabel = ref(props.basemap.title); | ||
const caption = ref((props.basemap.tileLayer.getAttribution) ? props.basemap.tileLayer.getAttribution() : ''); | ||
const props = defineProps<BasemapItem>(); | ||
const thumbnailUrl = createThumbnailUrl(); | ||
const basemap = props.basemap; | ||
const selection = props.selection; | ||
function createThumbnailUrl() { | ||
let url = basemap.urlTemplate.replace('{x}', '18').replace('{y}', '24').replace('{z}', '6'); | ||
if (!url.endsWith('.png')) { | ||
url += '.png'; | ||
} | ||
return url; | ||
} | ||
const displayLabel = ref(props.basemap.title); | ||
const caption = ref( | ||
props.basemap.tileLayer.getAttribution | ||
? props.basemap.tileLayer.getAttribution() | ||
: '' | ||
); | ||
function itemClick() { | ||
radio.value?.set(); | ||
enableBasemap(); | ||
} | ||
const thumbnailUrl = createThumbnailUrl(); | ||
function enableBasemap() { | ||
// if we aren't currently selected then set the basemap, otherwise do nothing | ||
if (basemaps.getBasemap.title != basemap.title) { | ||
basemaps.setBasemap(basemap); | ||
leafletMap.setBasemap(basemap); | ||
} | ||
function createThumbnailUrl() { | ||
let url = basemap.urlTemplate | ||
.replace('{x}', '18') | ||
.replace('{y}', '24') | ||
.replace('{z}', '6'); | ||
if (!url.endsWith('.png')) { | ||
url += '.png'; | ||
} | ||
return url; | ||
} | ||
</script> | ||
function itemClick() { | ||
radio.value?.set(); | ||
enableBasemap(); | ||
} | ||
function enableBasemap() { | ||
// if we aren't currently selected then set the basemap, otherwise do nothing | ||
if (basemaps.getBasemap.title != basemap.title) { | ||
basemaps.setBasemap(basemap); | ||
leafletMap.setBasemap(basemap); | ||
} | ||
} | ||
</script> |
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
Oops, something went wrong.