view client/src/application/Morphtool.vue @ 823:d7ae7338872d

client: add morphtool again
author Bernhard Reiter <bernhard@intevation.de>
date Thu, 27 Sep 2018 19:26:38 +0200
parents
children 90a601884ff2
line wrap: on
line source

<template>
    <div v-if="selectedBottleneck" @click="clearSelection" class="float-right ui-element d-flex shadow morphtool">
        <i class="fa fa-object-ungroup"></i>
    </div>
</template>

<style lang="scss">
.morphtool {
  position: relative;
  background-color: white;
  padding: $small-offset;
  border-radius: $border-radius;
  margin-left: $offset;
  height: $icon-width;
  width: $icon-height;
  margin-bottom: $offset;
  margin-right: 55px;
  z-index: 2;
}
</style>

<script>
import { mapGetters, mapState } from "vuex";

export default {
  name: "morphtool",
  data() {
    return {
      surveyList: null
    };
  },
  computed: {
    ...mapGetters("application", ["drawMode"]),
    ...mapState("mapstore", ["identifiedFeatures", "selectedMorph"]),
    selectedBottleneck: function() {
      if (this.identifiedFeatures) {
        for (let feature of this.identifiedFeatures) {
          if (feature.getId().replace(/[.][^.]*$/, "") === "bottlenecks") {
            return feature;
          }
        }
      }
      return null;
    }
  },
  watch: {
    selectedBottleneck: function(bottleneck) {
      console.log("now query for", bottleneck);
      this.surveyList = [{ a: "b" }, { c: "d" }];
    }
  },
  methods: {
    clearSelection() {
      this.$store.commit("mapstore/setIdentifiedFeatures", []);
    }
  }
};
</script>