|  | @@ -206,3 +206,196 @@ function registerEvent() {
 | 
	
		
			
				|  |  |          checkBtnActives(['#mapBg', '#sceneSetting']);
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |      // 地图背景的开启/关闭按钮的鼠标点击事件,按钮的tip与功能面板的互相切换
 | 
	
		
			
				|  |  | +    $('#mapBg').on('click', function () {
 | 
	
		
			
				|  |  | +        checkBtnActives(['#sceneSetting']);
 | 
	
		
			
				|  |  | +        if ($(this).hasClass('active')) {
 | 
	
		
			
				|  |  | +            $(this).removeClass('active');
 | 
	
		
			
				|  |  | +            $(this).children('.control-menu').removeClass('actives');
 | 
	
		
			
				|  |  | +            $(this).find('.tooltiptext').css({ "visibility": "visible" });
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            $(this).addClass('active');
 | 
	
		
			
				|  |  | +            $(this).children('.control-menu').addClass('actives');
 | 
	
		
			
				|  |  | +            $(this).find('.tooltiptext').css({ "visibility": "hidden" });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }).hover(function () {
 | 
	
		
			
				|  |  | +        if (!$(this).hasClass('active')) {
 | 
	
		
			
				|  |  | +            $(this).find('.tooltiptext').css({ "visibility": "visible" });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }, function () {
 | 
	
		
			
				|  |  | +        $(this).find('.tooltiptext').css({ "visibility": "hidden" });
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    // 进入层级事件
 | 
	
		
			
				|  |  | +    app.on(THING.EventType.EnterLevel, function (ev) {
 | 
	
		
			
				|  |  | +        stopRotate();
 | 
	
		
			
				|  |  | +        // 进入建筑层级
 | 
	
		
			
				|  |  | +        if (ev.object.type == 'Building') {
 | 
	
		
			
				|  |  | +            //清除设备列表和面板
 | 
	
		
			
				|  |  | +            _this.delMydiv();
 | 
	
		
			
				|  |  | +            _this.destroy_ui();
 | 
	
		
			
				|  |  | +            let floors = ev.object.floors;
 | 
	
		
			
				|  |  | +            if (floors.length > 1) {
 | 
	
		
			
				|  |  | +                building = ev.object;
 | 
	
		
			
				|  |  | +                addFloorPos(building);
 | 
	
		
			
				|  |  | +                let expandState = building.getAttribute('expandState');
 | 
	
		
			
				|  |  | +                if (expandState == null) {
 | 
	
		
			
				|  |  | +                    building.setAttribute('expandState', 'close');
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                $('#horizontalExpansion').css({ 'display': 'block' });
 | 
	
		
			
				|  |  | +                $('#verticalExpansion').css({ 'display': 'block' });
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            $('#horizontalExpansion').css({ 'display': 'none' });
 | 
	
		
			
				|  |  | +            $('#verticalExpansion').css({ 'display': 'none' });
 | 
	
		
			
				|  |  | +            // 进入园区层级
 | 
	
		
			
				|  |  | +            if (ev.object.type == 'Campus') {
 | 
	
		
			
				|  |  | +                if (building != null) {
 | 
	
		
			
				|  |  | +                    exitBuildingCloseFloor(building);
 | 
	
		
			
				|  |  | +                    $('#horizontalExpansion').removeClass('active');
 | 
	
		
			
				|  |  | +                    $('#verticalExpansion').removeClass('active');
 | 
	
		
			
				|  |  | +                    building = null;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (skyBox != null) {
 | 
	
		
			
				|  |  | +            app.skyBox = skyBox;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        // 重新创建小地图
 | 
	
		
			
				|  |  | +        if ($('#miniMap').hasClass('active')) {
 | 
	
		
			
				|  |  | +            destoryMiniMap();
 | 
	
		
			
				|  |  | +            createMiniMap();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    // 行走按钮的鼠标点击事件
 | 
	
		
			
				|  |  | +    $('#moveByFps').on('click', function () {
 | 
	
		
			
				|  |  | +        stopRotate();
 | 
	
		
			
				|  |  | +        if ($(this).hasClass('active')) {
 | 
	
		
			
				|  |  | +            $(this).removeClass('active');
 | 
	
		
			
				|  |  | +            if (box != null) {
 | 
	
		
			
				|  |  | +                // 恢复默认双击进入层级事件
 | 
	
		
			
				|  |  | +                app.resumeEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
 | 
	
		
			
				|  |  | +                // 恢复默认右键退出层级事件
 | 
	
		
			
				|  |  | +                app.resumeEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
 | 
	
		
			
				|  |  | +                box.destroy();
 | 
	
		
			
				|  |  | +                box = null;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (fpsCtrl != null) {
 | 
	
		
			
				|  |  | +                exitFps();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            $(this).addClass('active');
 | 
	
		
			
				|  |  | +            // 禁用默认双击进入层级事件
 | 
	
		
			
				|  |  | +            app.pauseEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
 | 
	
		
			
				|  |  | +            // 禁用默认右键退出层级事件
 | 
	
		
			
				|  |  | +            app.pauseEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
 | 
	
		
			
				|  |  | +            // 记录摄像机当前位置
 | 
	
		
			
				|  |  | +            cameraInitPos = [app.camera.position, app.camera.target];
 | 
	
		
			
				|  |  | +            createBox();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        checkBtnActives(['#mapBg', '#sceneSetting']);
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    // 全屏按钮的鼠标抬起事件
 | 
	
		
			
				|  |  | +    $('#fullScreen').mouseup(function () {
 | 
	
		
			
				|  |  | +        if (!fullScreenState) {
 | 
	
		
			
				|  |  | +            $('.btn-full-screen').css('display', 'none');
 | 
	
		
			
				|  |  | +            $('.btn-narrow').css('display', 'block');
 | 
	
		
			
				|  |  | +            $('#fullScreen span').text('退出全屏');
 | 
	
		
			
				|  |  | +            fullScreen();
 | 
	
		
			
				|  |  | +            fullScreenState = true;
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            $('.btn-full-screen').css('display', 'block');
 | 
	
		
			
				|  |  | +            $('.btn-narrow').css('display', 'none');
 | 
	
		
			
				|  |  | +            $('#fullScreen span').text('全屏');
 | 
	
		
			
				|  |  | +            exitFullScreen();
 | 
	
		
			
				|  |  | +            fullScreenState = false;
 | 
	
		
			
				|  |  | +            if ($('#mapBg').hasClass('active')) {
 | 
	
		
			
				|  |  | +                destoryMiniMap();
 | 
	
		
			
				|  |  | +                createMiniMap();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        checkBtnActives(['#mapBg', '#sceneSetting']);
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    // 鼠标键按下事件,功能按钮隐藏
 | 
	
		
			
				|  |  | +    app.on(THING.EventType.MouseDown, function () {
 | 
	
		
			
				|  |  | +        app.pauseEvent(THING.EventType.CameraZoom, null, '摄像机前后滚动,功能图片隐藏');
 | 
	
		
			
				|  |  | +        if (showControlTimer != null) {
 | 
	
		
			
				|  |  | +            clearTimeout(showControlTimer);
 | 
	
		
			
				|  |  | +            showControlTimer = null;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        stopRotate();
 | 
	
		
			
				|  |  | +        if (hiddenControlTimer == null) {
 | 
	
		
			
				|  |  | +            clearTimeout(showControlTimer);
 | 
	
		
			
				|  |  | +            hiddenControlTimer = setTimeout(function () {
 | 
	
		
			
				|  |  | +                $('#all-controls').css('display', 'none');
 | 
	
		
			
				|  |  | +                clearTimeout(hiddenControlTimer);
 | 
	
		
			
				|  |  | +                hiddenControlTimer = null;
 | 
	
		
			
				|  |  | +            }, 300);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    // 鼠标键抬起事件,功能按钮显示
 | 
	
		
			
				|  |  | +    app.on(THING.EventType.MouseUp, function () {
 | 
	
		
			
				|  |  | +        app.resumeEvent(THING.EventType.CameraZoom, null, '摄像机前后滚动,功能图片隐藏');
 | 
	
		
			
				|  |  | +        if (hiddenControlTimer != null) {
 | 
	
		
			
				|  |  | +            clearTimeout(hiddenControlTimer);
 | 
	
		
			
				|  |  | +            hiddenControlTimer = null;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (showControlTimer == null) {
 | 
	
		
			
				|  |  | +            showControlTimer = setTimeout(function () {
 | 
	
		
			
				|  |  | +                $('#all-controls').css('display', 'block');
 | 
	
		
			
				|  |  | +                clearTimeout(showControlTimer);
 | 
	
		
			
				|  |  | +                showControlTimer = null;
 | 
	
		
			
				|  |  | +                restarRotate();
 | 
	
		
			
				|  |  | +            }, 300);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    let count = 0;
 | 
	
		
			
				|  |  | +    // 鼠标滑轮滚动
 | 
	
		
			
				|  |  | +    app.on(THING.EventType.CameraZoom, function () {
 | 
	
		
			
				|  |  | +        if (showControlTimer != null) {
 | 
	
		
			
				|  |  | +            count = 0;
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        stopRotate();
 | 
	
		
			
				|  |  | +        if (showControlTimer == null) {
 | 
	
		
			
				|  |  | +            $('#all-controls').css('display', 'none');
 | 
	
		
			
				|  |  | +            showControlTimer = setInterval(function () {
 | 
	
		
			
				|  |  | +                count++;
 | 
	
		
			
				|  |  | +                if (count >= 2) {
 | 
	
		
			
				|  |  | +                    $('#all-controls').css('display', 'block');
 | 
	
		
			
				|  |  | +                    restarRotate();
 | 
	
		
			
				|  |  | +                    clearInterval(showControlTimer);
 | 
	
		
			
				|  |  | +                    showControlTimer = null;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }, 300);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }, '摄像机前后滚动,功能图片隐藏');
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    // 鼠标移动事件,已创建的红色胶囊跟随鼠标移动
 | 
	
		
			
				|  |  | +    app.on(THING.EventType.MouseMove, function (ev) {
 | 
	
		
			
				|  |  | +        if (box != null) {
 | 
	
		
			
				|  |  | +            if (ev.picked) {
 | 
	
		
			
				|  |  | +                box.position = ev.pickedPosition;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    // 摄像机位置改变结束事件,记录当前摄像机位置与目标点x,y,z的差
 | 
	
		
			
				|  |  | +    app.on(THING.EventType.CameraChangeEnd, function () {
 | 
	
		
			
				|  |  | +        if (cameraDistace.length > 0) {
 | 
	
		
			
				|  |  | +            let caPos = app.camera.position;
 | 
	
		
			
				|  |  | +            let scePos = app.root.defaultCampus.position;
 | 
	
		
			
				|  |  | +            cameraDistace = [caPos[0] - scePos[0], caPos[1] - scePos[1], caPos[2] - scePos[2]];
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        restarRotate();
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    // 点击事件,放置红色胶囊,进入第一人称行走
 | 
	
		
			
				|  |  | +    app.on(THING.EventType.Click, function (ev) {
 | 
	
		
			
				|  |  | +        stopRotate();
 | 
	
		
			
				|  |  | +        if (ev.button == 0 && box != null) {
 | 
	
		
			
				|  |  | +            let pos = box.position;
 | 
	
		
			
				|  |  | +            box.destroy();
 | 
	
		
			
				|  |  | +            box = null;
 | 
	
		
			
				|  |  | +            app.camera.flyTo(pos);
 | 
	
		
			
				|  |  | +            enterFps([pos[0], pos[1] + 2, pos[2]]);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        checkBtnActives(['#mapBg', '#sceneSetting']);
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    // 进入层级事件,退出第一人称行走
 |