Mercurial > gemma
view client/src/layers/Layers.vue @ 638:c2f040dba57f
feat: collapsible layer selection
The layerselection has now a clickable icon, which
allows it to collapse/expand the layerselection.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 13 Sep 2018 10:09:08 +0200 |
parents | 8278b2fb0c33 |
children | 5daee6e32c56 |
line wrap: on
line source
<template> <div> <div @click="collapse" class="d-flex flex-column ui-element minimizer"> <div> <i class="fa fa-th-list"></i> </div> </div> <div :class="layerSelectStyle"> <div v-if="!collapsed" class="card-body"> <div class="headline"> <h4 class="card-title">Layers</h4> </div> <hr> <div class="d-flex flex-column"> <Layerselect :layerindex="index" :layername="layer.name" v-for="(layer, index) in layers" :key="layer.name" :isVisible="layer.isVisible" @visibilityToggled="visibilityToggled"></Layerselect> </div> </div> </div> </div> </template> <style lang="scss"> .layerselection { margin-right: $offset; background-color: white; margin-left: $small-offset; } .layerselectioncollapsed { height: $icon-height; width: $icon-width; transition: $transition-fast; } .layerselectionexpanded { height: $layerselect-height; width: $layerselect-width; } .minimizer { position: absolute; z-index: 2; margin-right: $offset; right: $offset; background-color: white; border-radius: $border-radius; padding-left: $small-offset; padding-right: $small-offset; padding-top: $x-small-offset; margin-left: $offset; height: $icon-width; width: $icon-height; } </style> <script> import Layerselect from "./Layerselect"; import { mapGetters } from "vuex"; export default { name: "layers", data() { return { collapsed: false }; }, components: { Layerselect }, computed: { ...mapGetters("mapstore", ["layers"]), layerSelectStyle() { return { "ui-element": true, card: true, layerselection: true, shadow: true, layerselectionexpanded: !this.collapsed, layerselectioncollapsed: this.collapsed }; } }, methods: { collapse() { this.collapsed = !this.collapsed; }, visibilityToggled(layer) { this.$store.commit("mapstore/toggleVisibility", layer); } } }; </script>