view client/src/zoom/zoom.vue @ 1191:b23622905a3f

switched entirely to sass instead of scss for cleaner code/less lines, just removed all ; and {}
author Markus Kottlaender <markus@intevation.de>
date Fri, 16 Nov 2018 14:37:07 +0100
parents 7acd24889f1d
children ba8cd80d68b6
line wrap: on
line source

<template>
    <div class="d-flex buttoncontainer shadow" :style="showSplitscreen ? 'margin-bottom: 51vh' : ''">
        <button class="zoomButton rounded-left ui-element border-right" @click="zoomIn">
            <i class="fa fa-plus"></i>
        </button>
        <button class="zoomButton rounded-right ui-element" @click="zoomOut">
            <i class="fa fa-minus"></i>
        </button>
    </div>
</template>

<style lang="sass" scoped>
.buttoncontainer
  position: absolute
  bottom: 0
  left: 50%
  margin-left: -$icon-width
  margin-bottom: $offset

.zoomButton
  background-color: white
  min-height: $icon-width
  min-width: $icon-width
  margin-bottom: auto
  z-index: 2
  outline: none
  border: 0px
</style>
<script>
import { mapState } from "vuex";

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