<template>
  <div class="fp-editor-bottom-bar">
    <i class="iconfont icon--minus" @click="shrink" ></i>
    <span class="scale-num">{{ scale | formatPrcent }}</span>
    <i class="iconfont icon--plus" @click="magnify"></i>
  </div>
</template>

<script>
import {mapState, mapActions} from 'vuex'

export default {
  name: "FpEditorBottomBar",
  computed: {
    ...mapState({
      'scale': state => state.poster.p.scale
    })
  },
  filters: {
    formatPrcent(v) {
      return (Number(v) * 100).toFixed(0) + '%';
    }
  },
  methods: {
    ...mapActions({
      'shrink': 'poster/shrink',
      'magnify': 'poster/magnify',
    })
  }
}
</script>

<style scoped>

.fp-editor-bottom-bar {
  display: flex;
  position: absolute;
  bottom: 26px;
  right: 24px;
  z-index: 2;
  width: 120px;
  justify-content: center;
  /*padding: 2px;*/
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .06);
  height: 36px;
  background: #fff;
  border-radius: 4px;
  color: #333;
  line-height: 36px;
  font-size: 13px;
}

.fp-editor-bottom-bar i {
  width: 36px;
  text-align: center;
  cursor: pointer;
  font-size: 24px;
  color: var(--icon-color);
}

.fp-editor-bottom-bar i:hover {
  color: #070707bb;
}

.fp-editor-bottom-bar .scale-num {
  display: block;
  flex-grow: 1;
  text-align: center;
  user-select: none;
}
</style>