view client/src/layers/Layers.vue @ 1139:2fda33d55d81

scoped css
author Markus Kottlaender <markus@intevation.de>
date Wed, 07 Nov 2018 15:26:46 +0100
parents d9e6a1f6f394
children 1ae93a0438df
line wrap: on
line source

<template>
    <div class="layerselectmenu">
        <div @click="$store.commit('application/showLayers', !showLayers)" class="d-flex flex-column ui-element minimizer">
            <div>
                <i class="fa fa-th-list"></i>
            </div>
        </div>
        <div :class="layerSelectStyle">
            <div v-if="showLayers" 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 layersForLegend" :key="layer.name" :isVisible="layer.isVisible" @visibilityToggled="visibilityToggled"></Layerselect>
                </div>
            </div>
        </div>
    </div>
</template>

<style lang="scss" scoped>
.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>
/*
 * 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": true,
        card: true,
        layerselection: true,
        shadow: true,
        layerselectionexpanded: this.showLayers,
        layerselectioncollapsed: !this.showLayers
      };
    }
  },
  methods: {
    visibilityToggled(layer) {
      this.$store.commit("map/toggleVisibility", layer);
    }
  }
};
</script>