<template>
  <div class="layersSwitch" :style="{ left: right }">
    <div v-show="false" class="layerIcons">
      <div
        class="item"
        v-for="item of switchOptions"
        :key="item.label"
        :class="{ check: item.check }"
      >
        <img
          alt=""
          :src="require(`../../assets/images/holo/svg/${item.label}.svg`)"
          @click="changeCheck(item)"
          class="img"
        />
      </div>
    </div>
    <div
      class="visibleControl"
      :class="[{ 'expand-i': show }, { 'close-i': !show }]"
      @click="changeVisibel"
    >
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      layerIconsShow: true,
      switchOptions: [
        { label: "first", check: true },
        { label: "second", check: false },
        { label: "third", check: false },
        { label: "fourth", check: false },
      ],
    };
  },
  props: ["right", "show"],
  mounted() {},
  methods: {
    changeVisibel() {
      this.$emit("visibleChange");
    },
    getOptions() {
      return this.switchOptions;
    },
    changeCheck(item) {
      this.switchOptions.forEach((e) => {
        if (e.label === item.label) {
          e.check = !e.check;
        } else {
          e.check = false;
        }
      });
      this.$emit("changeCheck", item);
    },
  },
  computed: {},
  beforeDestroy() {},
};
</script>

<style lang="less" scoped>
.layersSwitch {
  position: absolute;
  z-index: 13;
  top: 50%;
  transform: translateY(-50%);
  .el-icon-document-copy {
    font-size: 20px;
    cursor: pointer;
    color: #aeaeae;
    text-align: right;
  }
  .expand-i {
    background: url("../../assets/images/holo/close.png");
    cursor: pointer;
    background-size: 95% 95%;
    background-repeat: no-repeat;
    background-position: center;
    height: 42px;
    width: 42px;
  }
  .close-i {
    background: url("../../assets/images/holo/expand.png");
    background-size: 95% 95%;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    height: 42px;
    width: 42px;
  }
  .layerIcons {
    width: 42px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    .item {
      width: 42px;
      display: flex;
      align-items: flex-start;
      justify-content: center;
      cursor: pointer;
    }
    .item:nth-child(4) {
      margin-top: 6px;
    }
    img {
      width: 30px;
      rotate: 180deg;
    }
    .check {
      background: url("../../assets/images/holo/check.png");
      background-size: 100%;
      background-repeat: no-repeat;
      background-position-y: 50%;
    }
    .check img {
      filter: drop-shadow(#bedeff 100px 0);
      transform: translateX(-100px);
    }
  }
}
</style>
