view client/src/layers/Layers.vue @ 1217:ba8cd80d68b6

made more use of bootstrap classes instead of custom css
author Markus Kottlaender <markus@intevation.de>
date Mon, 19 Nov 2018 15:20:22 +0100
parents 9d93968db2cd
children c14353e2cdb9
line wrap: on
line source

<template>
    <div class="position-relative ml-auto">
        <div @click="$store.commit('application/showLayers', !showLayers)" class="d-flex flex-column ui-element minimizer position-absolute mt-1">
            <div>
                <i class="fa fa-th-list"></i>
            </div>
        </div>
        <div :class="layerSelectStyle">
            <div v-if="showLayers" class="p-3 border-0 layers">
                <div class="headline">
                    <h4>Layers</h4>
                </div>
                <hr>
                <div class="d-flex flex-column">
                    <Layerselect :layerindex="index" :layername="layer.name" v-for="(layer, index) in layersForLegend" :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: $icon-height
  width: $icon-width
  transition: $transition-fast

.layerselectionexpanded
  min-height: $layerselect-height
  width: $layerselect-width

.minimizer
  z-index: 2
  right: 0
  height: $icon-width
  width: $icon-height
</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"]),
    layerSelectStyle() {
      return [
        "ui-element rounded layerselection bg-white shadow",
        {
          layerselectionexpanded: this.showLayers,
          layerselectioncollapsed: !this.showLayers
        }
      ];
    }
  },
  methods: {
    visibilityToggled(layer) {
      this.$store.commit("map/toggleVisibility", layer);
    }
  }
};
</script>