<template>
  <div
    class="base-element-cloudCoach"
    :style="{
      top: elementInfo.top + 'px',
      left: elementInfo.left + 'px',
      width: elementInfo.width + 'px',
      height: elementInfo.height + 'px'
    }"
  >
    <div class="rotate-wrapper" :style="{ transform: `rotate(${elementInfo.rotate}deg)` }">
      <div class="element-content">
        <div class="title" :style="{ fontSize: 14 / scale + 'px' }">{{ elementInfo.title || "乐谱" }}</div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import type { PPTCloudCoachElement } from "@/types/slides"
import { ref, inject } from "vue"
import { injectKeySlideScale } from "@/types/injectKey"

defineProps<{
  elementInfo: PPTCloudCoachElement
}>()

const scale = inject(injectKeySlideScale) || ref(1)
</script>

<style lang="scss" scoped>
.base-element-cloudCoach {
  position: absolute;
}
.rotate-wrapper {
  width: 100%;
  height: 100%;
}
.element-content {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: url("./cloudCoachList/imgs/musicBg.png") no-repeat;
  background-size: 100% 100%;
  .title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 40px;
    color: #fff;
  }
}
</style>
