<template>
  <div id="round-view">
    <ul class="screen-list">
      <li v-for="item in roundViewList" :key="item.id" :title="item.name" @click="selectTool(item)">
        <img :src="imgSrc(item)" class="screen-img" />
      </li>
    </ul>
  </div>
</template>

<script>
import {setMapCircleWatchInner, setMapCircleWatch} from "@/units/map/AddLayer";

export default {
  name: "RoundView",
  data(){
    return{
      roundViewList:[
        {
          id:'0001',
          name:'外环视',
          chosen:false,
        },
        {
          id:'0002',
          name:'内环视',
          chosen:false,
        },
      ],
    }
  },
  methods:{
    imgSrc(item){
      if(item.chosen){
        return require('../../../../../assets/imgs/mainPage/'+item.name+'-选中.png')
      }else{
        return require('../../../../../assets/imgs/mainPage/'+item.name+'-未选中.png')
      }
    },
    selectTool(item){
      setMapCircleWatch(false);
      for(let i=0;i<this.roundViewList.length;i++){
        if(item.name ==this.roundViewList[i].name) {
          this.roundViewList[i].chosen = !this.roundViewList[i].chosen;
          if(this.roundViewList[i].chosen){
            switch (this.roundViewList[i].name){
              case "外环视":
                setMapCircleWatch(true)
                break;
              case "内环视":
                setMapCircleWatchInner(true)
                break;
            }
          }else{
            switch (this.roundViewList[i].name){
              case "外环视":
                setMapCircleWatch(false)
                break;
              case "内环视":
                setMapCircleWatchInner(false)
                break;
            }
          }
        }
        else{
          this.roundViewList[i].chosen = false
        }
      }
    }
  }
}
</script>

<style scoped lang="scss">
#round-view{
  position: absolute;
  right:70px;
  top:650px;
  z-index: 1;
  text-align: center;
  background: rgba(0, 31, 112, 0.6);
  border-radius: 4px;
  border: 1px solid #00a1ff;
  color: #fff;
  .screen-list{
    padding: 10px 0px 10px 0px;
    margin: 0;
  }
  .screen-list li{
    list-style: none;
    cursor: pointer;
    padding: 2px 0px 2px 0px;
  }
  .screen-img{
    width: 35px;
    height: 35px;
  }
}
</style>
