<template src="./webgl_rxdz_test_roam.html"></template>
<script>
	
	import {getStorage} from '@/utils/localStorage';
	var requestId = "";
    const util = require('@/utils/util.js').default;
	import viewMask from'@/components/newQCCom/viewMask/viewMask.vue';
	import commonPageMethod from '@/mixins/commonPageMethod.js';
    export default {
		components:{viewMask},
		mixins:[commonPageMethod],
        /**
         * 页面的初始数据
         */
        data() {
            return {
				pvCurPageName: "room_show",
				locusBehaviorName: "房间展示",
				pvCurPageParams: null,
                houseId: "",
				pvId: 'p_2cmina_23080402',
				canvas:null,
				navbar: {
				    showCapsule: 1,
				    title: '客厅',
				    titleColor: '#000',
				    navPadding: 0,
				    navPaddingBg:'transparent',
				    navBarColor: 'transparent',
				    navBackColor: 'transparent',
				    haveCallback: true, // 如果是 true 会接手 navbarBackClk
				    fromShare: false,
				    fromProject: 0,
				    shareToken: "",
				    pageName: this.pvCurPageName,
				},
                id:'',// 户型编号
                spaceId:'',
				isIOS:false,
				defaulIndex:null,	//默认视角的序号
				repeatFlag:false,	//重复点击
				canvasHeight:408,	//canvas视图的高度-计算得出
            }
        },
        mounted(options) {
			var that = this;
			// alert("JavaScript 堆大小限制: "+performance.memory.jsHeapSizeLimit
			// +"\n已使用的 JavaScript 堆大小: "+performance.memory.usedJSHeapSize
			// +"\nJavaScript 堆的总大小: "+performance.memory.totalJSHeapSize);
			console.warn("***webgl_rxdz_roam-options***",this.$route.query)
			this.isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
			// if(this.isIOS){
			// 	this.curHouseObj = JSON.parse(getStorage('curHouseObj'));
			// 	this.wallList = JSON.parse(getStorage('wallList'));
			// }else{
			// 	this.curHouseObj = 	this.$store.state.curHouseObj;
			// 	this.wallList = 	this.$store.state.wallList;
			// }
			// alert("***mounted-webgl_rxdz_roam***"+this.isIOS + this.curHouseObj)
			let screenWidth = window.screen.width;
			let screenHeight = window.screen.height;
			if(window.innerWidth && window.screen.width){
				screenWidth = Math.min(window.innerWidth,window.screen.width)
			}
			if(window.innerHeight && window.screen.height){
				screenHeight = Math.min(window.innerHeight,window.screen.height)
			}
			let unit = screenWidth / 750;//单位rpm 对应 px 的值
			this.canvasHeight = screenHeight - (600 * unit) + (40 * unit);
			this.houseId = this.$route.query.houseId?this.$route.query.houseId:'';
			this.spaceId = this.$route.query.spaceId?this.$route.query.spaceId:'';
			
		},
		// computed: {
		// 	curHouseObj() {
		// 		return this.$store.state.curHouseObj;
		// 	},
		// 	wallList() {
		// 		return this.$store.state.wallList;
		// 	},
		// },
		methods: {
			navbarBackClk() {
				if(!this.$refs.viewMask){
					this.$router.go(-1);
					return false
				}
				if (this.$refs.viewMask.showAIImage) {
					this.$refs.viewMask.showOrHideWebGl();//隐藏显示的AI生图
					// if(this.currentActor.userIndex!=this.defaulIndex){//当前不是默认视角了
						this.switchActor(this.defaulIndex);//切换到默认视角
					// }
				} else {
					this.$router.go(-1);
				}
			},
			clearHandle(){
				// this.clearEvent();
			},
			save(){
				this.$refs.viewMask.save();//下载
			},
        }
    }
</script>
<style lang="scss" scoped>
    @import "./webgl_rxdz_test_roam.scss";
	/* @import "@/common/css/common.css"; */
</style>