view client/src/linetool/Linetool.vue @ 975:3da707172772

refac: removed technical debt Cleaned up mapstore to adhere more to Single Repsonsibility Principle (SRP)
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 18 Oct 2018 16:47:17 +0200
parents d7f34791b18d
children ca628dce90dd
line wrap: on
line source

<template>
    <div @click="drawLine" class="ui-element d-flex shadow drawtool">
        <i :class="icon"></i>
    </div>
</template>

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

.inverted {
  color: #0077ff;
}
</style>

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

export default {
  name: "linetool",
  methods: {
    drawLine() {
      this.$store.commit("application/toggleDrawModeLine");
    }
  },
  computed: {
    ...mapGetters("application", ["drawMode"]),
    ...mapState("identifystore", ["identifiedFeatures", "selectedMorph"]),
    ...mapState("morphstore", ["selectedMorph"]),
    icon() {
      return {
        fa: true,
        "fa-pencil": !this.selectedMorph,
        "fa-pencil inverted": !this.selectedMorph && this.drawMode,
        "fa-cut": this.selectedMorph,
        "fa-cut inverted": this.selectedMorph && this.drawMode
      };
    }
  }
};
</script>