Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DWO-509 Make WMS time selector floating for map views #196

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,17 @@ html, body {
outline-offset: -1px;
}

/* Hacky way to get the Mapbox logo and attribution control to not be hidden behind the floating
date/time slider for the Data View and Spatial Display. */
.mapboxgl-ctrl-logo {
position: relative;
left: 8px;
bottom: 70px;
}

.mapboxgl-ctrl-attrib {
position: relative;
bottom: 70px;
right: 15px;
}
</style>
34 changes: 30 additions & 4 deletions src/components/DateTimeSlider.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div>
<div
class="time-slider-container"
:class="[themeClass, floatingClass]"
>
<v-slider v-model="index" :max="max" step="1" tick-size="6" tabindex="0" @input="onInput" hide-details
height="0">
</v-slider>
Expand Down Expand Up @@ -47,12 +50,13 @@
@Prop({ default: () => { return [new Date(1970)] } }) private dates!: Date[]
@Prop({ default: false, type: Boolean }) private loading!: boolean
@Prop({ default: false, type: Boolean }) private now!: boolean
@Prop({ default: false, type: Boolean }) private floating!: boolean

index: number = 0
currentDate!: Date
useNow: boolean = true
isPlaying: boolean = false
intervalTimer: any = 0

Check warning on line 59 in src/components/DateTimeSlider.vue

View workflow job for this annotation

GitHub Actions / build (16)

Unexpected any. Specify a different type

Check warning on line 59 in src/components/DateTimeSlider.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type

Check warning on line 59 in src/components/DateTimeSlider.vue

View workflow job for this annotation

GitHub Actions / build (18.3)

Unexpected any. Specify a different type
hideLabel = true

mounted (): void {
Expand All @@ -77,6 +81,14 @@
return this.isPlaying ? 'orange' : ''
}

get themeClass (): string {
return this.$vuetify.theme.dark ? 'dark' : 'light'
}

get floatingClass (): string {
return this.floating ? 'floating' : 'non-floating'
}

togglePlay (): void {
if (this.isPlaying) {
this.isPlaying = false
Expand Down Expand Up @@ -183,8 +195,22 @@
}
</script>
<style scoped>
.time-slider-container {
height: 104px;
z-index: 100;
.time-slider-container.non-floating {
height: 48px;
}

.time-slider-container.floating {
height: 63px;
background-clip: content-box;
padding: 0 15px 15px;
filter: drop-shadow(3px 3px 3px #888);
}

.time-slider-container.dark {
background-color: black;
}

.time-slider-container.light {
background-color: white;
}
</style>
45 changes: 27 additions & 18 deletions src/views/DataView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</portal>
<div class="grid-root" :class="layoutClass">
<div class="grid-map" v-show="showMap">
<div class="map-container" style="height: calc(100% - 48px); position: relative;">
<div class="map-container">
<MapComponent>
<MapboxLayer v-if="showLayer" :layer="layerOptions"></MapboxLayer>
<v-mapbox-layer v-if="showLocationsLayer" :options="locationsLayer" clickable @click="onLocationClick"></v-mapbox-layer>
Expand All @@ -61,9 +61,15 @@
<LocationsLayerControl v-model="showLocationsLayer"/>
</v-chip-group>
</div>
<DateTimeSlider class="date-time-slider" v-model="currentTime" :dates="times" @update:now="setCurrentTime"
@input="debouncedSetLayerOptions" @timeupdate="updateTime">
</DateTimeSlider>
<DateTimeSlider
class="date-time-slider"
v-model="currentTime"
:dates="times"
@update:now="setCurrentTime"
@input="debouncedSetLayerOptions"
@timeupdate="updateTime"
floating
/>
</div>
<div class="grid-charts" ref="grid-charts" v-if="hasSelectedLocation && !$vuetify.breakpoint.mobile">
<v-toolbar class="toolbar-charts" dense flat>
Expand Down Expand Up @@ -543,6 +549,7 @@ export default class DataView extends Mixins(WMSMixin, TimeSeriesMixin, PiReques
}

.grid-map {
position: relative;
display: flex;
flex-basis: 400px;
flex: 1 1 auto;
Expand Down Expand Up @@ -643,26 +650,28 @@ export default class DataView extends Mixins(WMSMixin, TimeSeriesMixin, PiReques
}

.map-container {
display: flex;
flex: 1 1;
width: 100%;
height: 100%;
}

.datetime-control-container {
flex-grow: 0;
z-index: 1000;
.date-time-slider {
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
z-index: 100;
}

.v-list-item--dense, .v-list--dense .v-list-item {
min-height: 28px !important;
}
.v-list-item--dense, .v-list--dense .v-list-item {
min-height: 28px !important;
}

.v-treeview--dense .v-treeview-node__root {
min-height: 28px !important;
}
.v-treeview--dense .v-treeview-node__root {
min-height: 28px !important;
}

.v-treeview-node__level {
width: 12px !important;
}
.v-treeview-node__level {
width: 12px !important;
}

</style>
29 changes: 24 additions & 5 deletions src/views/SpatialDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@
:open.sync="open"
/>
</portal>
<div style="height: calc(100% - 48px); position: relative">
<div class="map-container">
<MapComponent>
<MapboxLayer :layer="layerOptions" />
</MapComponent>
<div class="colourbar">
<ColourBar v-model="legend" v-if="legend.length > 0"/>
</div>
</div>
<DateTimeSlider class="date-time-slider" v-model="currentTime" :dates="times" @update:now="setCurrentTime"
@input="debouncedSetLayerOptions" @timeupdate="updateTime">
</DateTimeSlider>
<DateTimeSlider
class="date-time-slider"
v-model="currentTime"
:dates="times"
@update:now="setCurrentTime"
@input="debouncedSetLayerOptions"
@timeupdate="updateTime"
floating
/>
</div>
</template>

Expand Down Expand Up @@ -220,6 +226,19 @@ export default class SpatialDisplay extends Mixins(WMSMixin) {
width: 500px;
height: 100px;
position: absolute;
bottom: 10px;
bottom: 85px;
}

.map-container {
width: 100%;
height: 100%;
}

.date-time-slider {
position: absolute;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 100;
}
</style>
Loading