parent
0196e92c3d
commit
7722b040e7
@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<div class="depth_selector__container">
|
||||
<va-slider class="mr-5" v-model="rangeValue" vertical range pins :step="5" track-label-visible color="success"
|
||||
@update:model-value="applyFilter">
|
||||
<template #trackLabel="{ value, order }">
|
||||
<va-chip size="small" :color="order === 0 ? 'danger' : 'success' ">
|
||||
{{ computeDepth(value) }}
|
||||
</va-chip>
|
||||
</template>
|
||||
</va-slider>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "depth-filter",
|
||||
data() {
|
||||
return {
|
||||
rangeValue: [0,80]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
computeDepth(sliderValue){
|
||||
return (3000 - sliderValue*30)
|
||||
},
|
||||
applyFilter() {
|
||||
// range values are inverted inthe model,
|
||||
// so invert them back and compute depth values
|
||||
const depthValue = [ 3000-this.rangeValue[1]*30, 3000-this.rangeValue[0]*30 ]
|
||||
console.log(depthValue);
|
||||
const filter = { "depth": depthValue }
|
||||
this.$emit('filter', filter, this.name)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="css">
|
||||
.depth_selector__container {
|
||||
height: 200px;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue