view client/src/layers/Layers.vue @ 1247:c14353e2cdb9

repositioning of buttons (issue225)
author Markus Kottlaender <markus@intevation.de>
date Wed, 21 Nov 2018 08:15:28 +0100
parents ba8cd80d68b6
children 104d41ea7c15
line wrap: on
line source

<template>
    <div class="position-relative mx-2">
        <div :class="style">
            <div v-if="showLayers" class="p-3">
                <h4 class="pb-3 border-bottom">Layers</h4>
                <div class="d-flex flex-column">
                    <Layerselect
                        v-for="(layer, index) in layersForLegend"
                        :layerindex="index"
                        :layername="layer.name"
                        :key="layer.name"
                        :isVisible="layer.isVisible"
                        @visibilityToggled="visibilityToggled"
                    ></Layerselect>
                </div>
            </div>
        </div>
    </div>
</template>

<style lang="sass" scoped>
.layerselection
  opacity: $slight-transparent

.layerselectioncollapsed
  min-height: 0
  width: 0
  transition: $transition-fast

.layerselectionexpanded
  min-height: $layerselect-height
  width: $layerselect-width
</style>

<script>
/*
 * This is Free Software under GNU Affero General Public License v >= 3.0
 * without warranty, see README.md and license for details.
 * 
 * SPDX-License-Identifier: AGPL-3.0-or-later
 * License-Filename: LICENSES/AGPL-3.0.txt
 * 
 * Copyright (C) 2018 by via donau 
 *   – Österreichische Wasserstraßen-Gesellschaft mbH
 * Software engineering by Intevation GmbH
 * 
 * Author(s):
 * Thomas Junk <thomas.junk@intevation.de>
 */
import Layerselect from "./Layerselect";
import { mapGetters, mapState } from "vuex";
export default {
  name: "layers",
  components: {
    Layerselect
  },
  computed: {
    ...mapGetters("map", ["layersForLegend"]),
    ...mapState("application", ["showLayers"]),
    style() {
      return [
        "ui-element rounded layerselection bg-white shadow",
        {
          layerselectionexpanded: this.showLayers,
          layerselectioncollapsed: !this.showLayers
        }
      ];
    }
  },
  methods: {
    visibilityToggled(layer) {
      this.$store.commit("map/toggleVisibility", layer);
    }
  }
};
</script>