Component({
  behaviors: [require('../common/share-behavior').default],
  properties: {},
  data: {
    loadedSaoMiao:false,
    loaded: false,
    arReady: false,
    loaded2:false,
    position2:[0,0,0],
    rot:0,
    str:"1",
  
  },
  lifetimes: {
    async attached() {
      console.log('data', this.data);
    }
  },
  methods: {
    handleReady: function ({detail}) {
      const xrScene = this.scene = detail.value;
      console.log('xr-scene', xrScene);
    },
    handleAssetsProgress: function({detail}) {
      this.triggerEvent('assetsProgress', detail.value);
    },
    handleAssetsLoaded: function ({detail}) {
      console.log('assets loaded', detail.value);
      this.triggerEvent('assetsLoaded', detail.value);
      this.setData({
        loaded: true
      });
    },handleGltfLoaded2: function() {
      
    },handleGltfLoaded: function() {
      
    },
    handleTrackerSwitch: function ({detail}) {


      const active = detail.value;
      if(active)
      {
        this.setData({
          loaded2: true
        });
      }
    },handleARTrackerState({detail}) {
      // 事件的值即为`ARTracker`实例
      const tracker = detail.value;
      // 获取当前状态和错误信息
      const {state, errorMessage} = tracker;

      const element = detail.el;


      if( state==2)
      {

        this.triggerEvent('assetsstr',"state"  + state);
        
/*
        this.triggerEvent('assetsstr',"x:"  + (180/Math.PI* element.scene.getNodeById("Marker").rotation.x) +"\ny:"  +  (180/Math.PI*element.scene.getNodeById("Marker").rotation.y)+"\nz:"  +  (180/Math.PI*element.scene.getNodeById("Marker").rotation.z));*/
      
      }


    },
    handleAnimationStop: function() {
      console.log('animation Stop');
    }
  }
})