export function handleDBLClick(targetPoint) {
  if (!targetPoint.hasDevice) return;
  this.clearTagsObj();
  this._saveState();
  const worldP = targetPoint.getWorldPosition(new this.THREE.Vector3());
  const viewAng = viewAngle(targetPoint.name);
  this.dblIntoTween = new this.TWEEN.Tween({
    x: this.camera.position.x,
    y: this.camera.position.y,
    z: this.camera.position.z,
    targetX: this.orbitControls.target.x,
    targetY: this.orbitControls.target.y,
    targetZ: this.orbitControls.target.z,
  });
  this.dblIntoTween.to(
    {
      x: worldP.x + viewAng.x,
      y: worldP.y + viewAng.y,
      z: worldP.z + viewAng.z,
      targetX: worldP.x,
      targetY: worldP.y,
      targetZ: worldP.z,
    },
    500
  );
  this.dblIntoTween.start();
  this.dblIntoTween.onUpdate((obj) => {
    this.camera.position.set(obj.x, obj.y, obj.z);
    this.camera.lookAt(obj.targetX, obj.targetY, obj.targetZ);
    this.orbitControls.target.set(obj.targetX, obj.targetY, obj.targetZ);
  });
}
function viewAngle(targetPointName) {
  if (/tr$/.test(targetPointName)) {
    return { x: 5, y: -1, z: 1 };
  } else if (/tl$/.test(targetPointName)) {
    return { x: -5, y: -1, z: 1 };
  } else if (/tc$/.test(targetPointName)) {
    return { x: -1, y: -1, z: -9 };
  } else if (/br$/.test(targetPointName)) {
    return { x: 5, y: 1, z: 1 };
  } else if (/bl$/.test(targetPointName)) {
    return { x: -5, y: 1, z: 1 };
  }
}
