view client/src/zoom/zoom.vue @ 1075:c1989ebe1d8a

feat: invert fairwayprofile scale
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 26 Oct 2018 13:21:17 +0200
parents ca1c178456e5
children 595654ad3f66
line wrap: on
line source

<template>
    <div class="d-flex flex-column buttoncontainer align-content-between">
        <button class="zoomButton shadow ui-element" @click="zoomIn">+</button>
        <button class="zoomButton shadow ui-element" @click="zoomOut">-</button>
    </div>
</template>
<style lang="scss" scoped>
.buttoncontainer {
  width: $icon-width;
  height: $zoombutton-container-height;
  margin-top: $sidebar-height;
  margin-left: $offset;
}
.zoomButton {
  position: relative;
  background-color: white;
  border-radius: $border-radius;
  min-height: $icon-width;
  min-width: $icon-width;
  margin-right: $offset;
  margin-bottom: auto;
  z-index: 2;
  outline: none;
  border: 0px;
}
</style>
<script>
import { mapState } from "vuex";

export default {
  name: "zoom",
  computed: {
    ...mapState("mapstore", ["openLayersMap"]),
    zoomLevel: {
      get() {
        return this.openLayersMap.getView().getZoom();
      },
      set(value) {
        this.openLayersMap.getView().animate({ zoom: value }, 700);
      }
    }
  },
  methods: {
    zoomIn() {
      this.zoomLevel = this.zoomLevel + 1;
    },
    zoomOut() {
      this.zoomLevel = this.zoomLevel - 1;
    }
  }
};
</script>