<template>
  <div>
    <FloorSwitch />
    <tours />
  </div>
</template>
<script setup>
import { computed } from 'vue'
import { useStore } from 'vuex'
import { ref } from 'vue'
import { useApp, getApp } from '@/app'
import FloorSwitch from './FloorSwitch'
import tours from './tours.mobile'

const store = useStore()
const show = ref(false)
const isHidden = ref(false)
const bottom = computed(() => {
    return store.getters.controlsBottom
})
useApp().then(app => {
    app.Scene.on('loaded', () => (show.value = true))
})


</script>
<style lang="scss" scoped>
.disable {
  opacity: 1;
}
.toolbar {
  position: absolute;
  left: -1px;
  right: auto;
  bottom: 44px;
  height: 36px;
  padding-right: 1.31579rem;
  background-color: rgba(0, 0, 0, 0.5);
  border-top-right-radius: 18px;
  border-bottom-right-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
  transition: all 0.3s;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  &.show {
    display: block;
  }
  &.collapse {
    transform: translateX(calc(-100% + 1.26316rem));
    // left: calc(-100% + 1.6rem);
    background-color: rgba(0, 0, 0, 0.2);
    .switch {
      //opacity: 0.5;
      i {
        transform: rotate(180deg);
      }
    }
  }

  i {
    font-size: 0.45rem;
  }
  .tour-control {
    margin-left: 0.4267rem;
    padding-right: 0.2667rem;
    position: relative;
    ::-webkit-scrollbar {
      display: none;
    }
    &.only {
      padding-right: 0.5333rem;
      border-right: 1px solid rgba(255, 255, 255, 0.16);
    }
    .btn-box {
      display: flex;
      align-items: center;
      justify-content: center;
      > i {
        margin-right: 0.2667rem;
      }
      span {
        margin-left: 0.10526rem;
        white-space: nowrap;
        margin-right: 0.1333rem;
      }
      .btn-text {
        display: flex;
        align-items: center;
        justify-content: center;
        .pull-icon {
          font-size: 0.24rem;
          transition: transform 0.3s;
          display: block;
          &.up {
            transform: rotate(-180deg);
          }
        }
      }
    }

    .part-content {
      // position: fixed;
      position: absolute;
      max-width: calc(100vw - 0.8533rem);
      height: 1.8667rem;
      background: rgba(0, 0, 0, 0.5);
      // border: 1px solid rgba(255, 255, 255, 0.1);
      // bottom: 2.9867rem;
      bottom: 1.4867rem;
      // left: 3%;
      left: 0;
      // left: 50%;
      // transform: translateX(-50%);
      border-radius: 0.1333rem;

      pointer-events: all;
      padding: 0 0.1333rem;
      display: flex;
      align-items: center;
      &.ban {
        pointer-events: none;
      }
      &::before {
        position: absolute;
        content: "";
        // left: 1.4rem;
        left: 0.5rem;
        bottom: -8px;
        width: 0;
        height: 0;
        border-left: 12px solid transparent;
        border-right: 12px solid transparent;
        border-top: 8px solid rgba(0, 0, 0, 0.5);
      }
      .slide-box {
        width: 100%;
        border-radius: 0.08rem;
        overflow: hidden;
      }
      .tour-list {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;

        .tour-item {
          width: 2.4rem;
          height: 1.6rem;
          border-radius: 0.1067rem;
          background: #fff;
          margin-right: 0.1333rem;
          float: left;
          box-sizing: border-box;
          overflow: hidden;
          position: relative;
          background-repeat: no-repeat;
          background-size: cover;
          background-position: center center;
          &:last-of-type {
            margin-right: 0;
          }
          .mask-item {
            width: 100%;
            height: 0.5333rem;
            background: linear-gradient(180deg, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.5) 100%);
            position: absolute;
            bottom: 0;
            left: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            span {
              font-size: 0.32rem;
              position: relative;
              z-index: 2;
            }
            .precent {
              width: 10%;
              height: 0.5333rem;
              position: absolute;
              bottom: 0;
              left: 0;
              background: #00c8af;
              opacity: 0.4;
              z-index: 1;
              transition: width 0.1s;
            }
          }
        }
      }
    }
  }
}
.switch {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  width: 1rem;
  height: 100%;
  align-items: center;
  i {
    margin-left: 0.2rem;
    font-size: 0.28rem;
  }
}
.guide {
  display: flex;
  height: 100%;
  width: calc(100vw - 2rem);
  flex-shrink: 0;
  &.flex {
    width: auto;
  }
  > div {
    height: 100%;
    width: 100%;
    &.play {
      display: none;
    }
    &.play {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 0.8rem;
      margin: 0 0.3rem;
      &::after {
        content: "";
        position: absolute;
        top: 50%;
        right: -0.3rem;
        width: 1px;
        height: 35%;
        transform: translateY(-50%);
        background-color: rgba(255, 255, 255, 0.6);
        box-shadow: 1px 0px 1px 0px rgba(0, 0, 0, 0.2);
      }
    }

    &.rooms {
      flex: 1;
      width: 100%;
      overflow: hidden;
      padding: 4px 0;
      margin-left: 0.3rem;
    }
  }
}
.ctrls {
  display: flex;
  height: 100%;
  flex-shrink: 0;
  align-items: center;
  &.notzh {
    &.noguide {
      > div {
        &:first-child {
          span {
            left: 10px;
            transform: translateX(0);
            &::after {
              left: 5px;
              transform: translateX(0) rotate(-180deg);
            }
          }
        }
      }
    }
    > div {
      padding: 0.3rem 0.3rem;
      &.play {
        span {
          display: flex;
          left: auto;
          bottom: auto;
          width: 1rem;
          background: transparent;
          transform: none;
          margin-bottom: 0;
          &::after {
            display: none;
          }
          em {
            display: none;
          }
          i {
            font-size: 12px;
          }
        }
      }
      &.rooms {
        &::after {
          left: 1rem;
        }
      }
      span {
        display: none;
        margin: 0;
        margin-bottom: 0.5rem;
        padding: 5px 4px;
        position: absolute;
        left: 50%;
        bottom: 100%;
        border-radius: 4px;
        background-color: rgba(0, 0, 0, 0.7);
        transform: translateX(-50%);
        z-index: 1000;
        &::after {
          content: "";
          position: absolute;
          bottom: -6px;
          left: 50%;
          width: 0;
          height: 0;
          border-width: 0 7px 6px;
          border-style: solid;
          border-color: transparent transparent rgba(0, 0, 0, 0.7);
          transform: translateX(-50%) rotate(-180deg);
        }
        &.show {
          display: block;
        }
      }
    }
  }
  &.flex {
    > div {
      &.rooms {
        right: auto;
      }
    }
  }
  > div {
    position: relative;
    padding: 0.3rem 0.18rem;
    margin-left: 0.15rem;
    display: flex;
    align-items: center;
    height: 0.89474rem;
    border-radius: 5px;
    margin-right: 0.1rem;
    opacity: 0.5;
    &.active {
      opacity: 1;
    }
    &.play {
      padding: 0.3rem 0;
      opacity: 1;
      b,
      span {
        height: 0.89474rem;
      }

      b {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 0.8rem;
      }
      span {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        em {
          font-style: normal;
        }
        i {
          font-size: 12px;
          transform: scale(0.6) rotate(-180deg);
          &.down {
            transform: scale(0.6) rotate(0);
          }
        }
      }
    }

    &.rooms {
      opacity: 0;
      position: fixed;
      margin: 0;
      padding: 4px;
      left: 15px;
      right: 15px;
      bottom: 2.7rem;
      height: 1.31579rem;
      background-color: rgba(0, 0, 0, 0.5);
      border-radius: 0.17789rem;
      pointer-events: none;
      visibility: hidden;
      transition: all 0.3s;
      transform-origin: 1.5rem 100%;
      &.init {
        transform: scale(0);
      }
      &.show {
        visibility: visible;
        pointer-events: all;
        transform: scale(1);
        opacity: 1;
      }
      &.hide {
        visibility: hidden;
        transition: none;
      }
      &::after {
        content: "";
        position: absolute;
        bottom: -9px;
        left: 1.45rem;
        width: 0;
        height: 0;
        transform: translateY(-50%) rotate(180deg);
        border-width: 0 6px 6px;
        border-style: solid;
        border-color: transparent transparent rgba(0, 0, 0, 0.5);
      }
    }
    span {
      margin-left: 0.10526rem;
      white-space: nowrap;
    }
  }
}
@media (orientation: landscape) {
  .toolbar {
    padding-left: 0.5rem;
    bottom: 0.5rem;
    height: 0.8rem;
    font-size: 0.25rem;
    i {
      font-size: 0.25rem;
    }
  }
  .guide {
    width: calc(100vw - 4rem);
  }
  .ctrls {
    > div {
      height: 0.6rem;
      &.play {
        padding: 0.3rem 0;
        b,
        span {
          height: 0.8rem;
        }
      }
      &.rooms {
        left: 1rem;
        right: 1rem;
        bottom: 1.6rem;
        height: 0.8rem;
        transform-origin: 1.2rem 100%;
        &::after {
          left: 1.12rem;
        }
      }
    }
  }
  .switch {
    i {
      font-size: 0.2rem;
    }
  }
}
</style>
