import * as THREE from "three";
import Label2D from "./Label";

class RoomLabel extends Label2D {
  constructor(o) {
    if (o.position instanceof Array) o.position = new THREE.Vector3().fromArray(o.position)
    o.innerHTML = `<div class="room-label" ><a><p><span>${o.title}</span></p></a></div>`
    o.domElement = window.$("#webgl")[0]
    o.shelterByModel = true, o.autoUpdate = true

    o.clickFun = () => {

    }

    super(o)
    this.setTitle(o.title)
  }

  init() {
    super.init()
    // this.setStyle()
  }

  setStyle(oldMode, mode, duration) {
    this.setVisible(true, 'isPanorama')
  }


  setTitle(title) {
    this.title = title || ''
    this.elem.html(`<a><p><span>window.${this.title}</span></p></a>`)
  }

}

export default RoomLabel
