view client/src/layers/Layers.vue @ 881:55fb73a3ebf7

fix: layerselection layout
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 01 Oct 2018 16:47:36 +0200
parents 3e2eeb215d0e
children c2b03f4755b6
line wrap: on
line source

<template>
    <div class="layerselectmenu">
        <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 layers">
                <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">
.layerselectmenu {
  position: relative;
  margin-right: $offset;
}
.layerselection {
  background-color: white;
  margin-left: $small-offset;
  opacity: $slight-transparent;
}

.layerselectioncollapsed {
  min-height: $icon-height;
  width: $icon-width;
  transition: $transition-fast;
}

.layerselectionexpanded {
  min-height: $layerselect-height;
  width: $layerselect-width;
}

.minimizer {
  position: absolute;
  z-index: 2;
  right: 0;
  margin-top: $x-small-offset;
  border-radius: $border-radius;
  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>