RegisterEvent.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /**
  2. * 说明:注册事件
  3. */
  4. function registerEvent() {
  5. var _this = this;
  6. $('#83849').on('click', function () {
  7. stopRotate();
  8. console.log("......................")
  9. restarRotate();
  10. });
  11. // 楼层横向展开按钮的点击事件,楼层展开只在建筑有2层或2层以上的楼层才会生效
  12. $('#horizontalExpansion').on('click', function () {
  13. // if (sidebar.expandBuilding == true) {
  14. // sidebar.expandBuilding = false
  15. // }
  16. stopRotate();
  17. checkBtnActives(['#mapBg', '#sceneSetting']);
  18. let expandState = building.getAttribute('expandState');
  19. if ($(this).hasClass('active')) {
  20. // 楼层横向展开关闭
  21. if (expandState == 'horizontal') {
  22. $(this).removeClass('active');
  23. horizontalExpand(building, 'close');
  24. }
  25. } else {
  26. // 楼层横向展开前应判断楼层是否处于垂直展开状态,是,则应先关闭垂直展开,然后横向展开
  27. if (expandState != 'moving') {
  28. $(this).addClass('active');
  29. $('#verticalExpansion').removeClass('active');
  30. if (expandState == 'vertical') {
  31. verticalToHorizontal(building);
  32. } else {
  33. horizontalExpand(building, 'horizontal');
  34. }
  35. }
  36. }
  37. restarRotate();
  38. });
  39. // 楼层垂直展开按钮的点击事件,楼层展开只在建筑有2层或2层以上的楼层才会生效
  40. $('#verticalExpansion').on('click', function () {
  41. // if (sidebar.expandBuilding == true) {
  42. // sidebar.expandBuilding = false
  43. // }
  44. stopRotate();
  45. checkBtnActives(['#mapBg', '#sceneSetting']);
  46. let expandState = building.getAttribute('expandState');
  47. if ($(this).hasClass('active')) {
  48. // 楼层垂直展开关闭
  49. if (expandState == 'vertical') {
  50. $(this).removeClass('active');
  51. verticalExpand(building, 'close');
  52. }
  53. } else {
  54. // 楼层垂直展开前应判断楼层是否处于横向展开状态,是,则应先关闭横向展开,然后垂直展开
  55. if (expandState != 'moving') {
  56. $(this).addClass('active');
  57. $('#horizontalExpansion').removeClass('active');
  58. if (expandState == 'horizontal') {
  59. horizontalToVertical(building);
  60. } else {
  61. verticalExpand(building, 'vertical');
  62. }
  63. }
  64. }
  65. restarRotate();
  66. });
  67. // 设置按钮点击事件,按钮的tip与功能面板的互相切换
  68. $('#sceneSetting').on('click', function () {
  69. checkBtnActives(['#mapBg']);
  70. if ($(this).hasClass('active')) {
  71. $(this).removeClass('active');
  72. $(this).children('.control-menu').removeClass('actives');
  73. $(this).find('.tooltiptext').css({ "visibility": "visible" });
  74. } else {
  75. $(this).addClass('active');
  76. $(this).children('.control-menu').addClass('actives');
  77. $(this).find('.tooltiptext').css({ "visibility": "hidden" });
  78. }
  79. }).hover(function () {
  80. if (!$(this).hasClass('active')) {
  81. $(this).find('.tooltiptext').css({ "visibility": "visible" });
  82. }
  83. }, function () {
  84. $(this).find('.tooltiptext').css({ "visibility": "hidden" });
  85. });
  86. // 设置li标签添加点击事件
  87. $('#sceneSetting .control-menu-pane li').on('click', function (ev) {
  88. //ev.stopPropagation();
  89. if ($(this).hasClass('selected')) {
  90. stopRotate();
  91. $(this).removeClass('selected');
  92. } else {
  93. $(this).addClass('selected');
  94. restarRotate();
  95. }
  96. });
  97. // 小地图的开启/关闭按钮的鼠标点击事件
  98. $('#miniMap').on('click', function () {
  99. if ($(this).hasClass('active')) {
  100. $(this).removeClass('active');
  101. destoryMiniMap();
  102. } else {
  103. $(this).addClass('active');
  104. createMiniMap();
  105. }
  106. checkBtnActives(['#mapBg', '#sceneSetting']);
  107. });
  108. // 地图背景的开启/关闭按钮的鼠标点击事件,按钮的tip与功能面板的互相切换
  109. $('#mapBg').on('click', function () {
  110. checkBtnActives(['#sceneSetting']);
  111. if ($(this).hasClass('active')) {
  112. $(this).removeClass('active');
  113. $(this).children('.control-menu').removeClass('actives');
  114. $(this).find('.tooltiptext').css({ "visibility": "visible" });
  115. } else {
  116. $(this).addClass('active');
  117. $(this).children('.control-menu').addClass('actives');
  118. $(this).find('.tooltiptext').css({ "visibility": "hidden" });
  119. }
  120. }).hover(function () {
  121. if (!$(this).hasClass('active')) {
  122. $(this).find('.tooltiptext').css({ "visibility": "visible" });
  123. }
  124. }, function () {
  125. $(this).find('.tooltiptext').css({ "visibility": "hidden" });
  126. });
  127. // 进入层级事件
  128. app.on(THING.EventType.EnterLevel, function (ev) {
  129. app.skyBox = null;
  130. var visible = true;
  131. var car = app.query(new_name)[0]
  132. app.background = '/uploads/wechat/163607/file/广西东盟项目/Image/op0.png';
  133. stopRotate();
  134. mainPanle.addButton(ev.object.type);//创建设备选择器
  135. // 进入建筑层级
  136. let name = ev.object.name;
  137. //判断行走小人是否显示隐藏
  138. car.visible = name != "十三楼" ? false : true;
  139. //判断多选面板是否显示隐藏
  140. if(ev.object.type != 'Floor' && panel_ != undefined){
  141. delete_ui();//销毁面板
  142. panel_.destroy()
  143. sidebar.equipment = false
  144. sidebar.device_add = false
  145. delete_dome();//删除设备选择器
  146. }
  147. if (ev.object.type == 'Building') {
  148. //销毁面板
  149. let floors = ev.object.floors;
  150. if (floors.length > 1) {
  151. // reset();//销毁已创建的物品
  152. building = ev.object;
  153. addFloorPos(building);
  154. let expandState = building.getAttribute('expandState');
  155. if (expandState == null) {
  156. building.setAttribute('expandState', 'close');
  157. }
  158. $('#horizontalExpansion').css({ 'display': 'block' });
  159. $('#verticalExpansion').css({ 'display': 'block' });
  160. }
  161. }else if(ev.object.type == 'Floor'){
  162. floorID = ev.object.id;
  163. select_device();
  164. click_userData();
  165. } else {
  166. $('#horizontalExpansion').css({ 'display': 'none' });
  167. $('#verticalExpansion').css({ 'display': 'none' });
  168. // 进入园区层级
  169. if (ev.object.type == 'Campus') {
  170. showAllPanels()
  171. if (building != null) {
  172. exitBuildingCloseFloor(building);
  173. $('#horizontalExpansion').removeClass('active');
  174. $('#verticalExpansion').removeClass('active');
  175. building = null;
  176. }
  177. } else{
  178. }
  179. }
  180. if (skyBox != null) {
  181. app.skyBox = skyBox;
  182. }
  183. // 重新创建小地图
  184. if ($('#miniMap').hasClass('active')) {
  185. destoryMiniMap();
  186. createMiniMap();
  187. }
  188. });
  189. // 行走按钮的鼠标点击事件
  190. $('#moveByFps').on('click', function () {
  191. stopRotate();
  192. if ($(this).hasClass('active')) {
  193. $(this).removeClass('active');
  194. if (box != null) {
  195. // 恢复默认双击进入层级事件
  196. app.resumeEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
  197. // 恢复默认右键退出层级事件
  198. app.resumeEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
  199. box.destroy();
  200. box = null;
  201. }
  202. if (fpsCtrl != null) {
  203. exitFps();
  204. }
  205. } else {
  206. $(this).addClass('active');
  207. // 禁用默认双击进入层级事件
  208. app.pauseEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
  209. // 禁用默认右键退出层级事件
  210. app.pauseEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
  211. // 记录摄像机当前位置
  212. cameraInitPos = [app.camera.position, app.camera.target];
  213. createBox();
  214. }
  215. checkBtnActives(['#mapBg', '#sceneSetting']);
  216. });
  217. // 全屏按钮的鼠标抬起事件
  218. $('#fullScreen').mouseup(function () {
  219. if (!fullScreenState) {
  220. $('.btn-full-screen').css('display', 'none');
  221. $('.btn-narrow').css('display', 'block');
  222. $('#fullScreen span').text('退出全屏');
  223. fullScreen();
  224. fullScreenState = true;
  225. } else {
  226. $('.btn-full-screen').css('display', 'block');
  227. $('.btn-narrow').css('display', 'none');
  228. $('#fullScreen span').text('全屏');
  229. exitFullScreen();
  230. fullScreenState = false;
  231. if ($('#mapBg').hasClass('active')) {
  232. destoryMiniMap();
  233. createMiniMap();
  234. }
  235. }
  236. checkBtnActives(['#mapBg', '#sceneSetting']);
  237. });
  238. // 鼠标键按下事件,功能按钮隐藏
  239. app.on(THING.EventType.MouseDown, function (ev) {
  240. if (ev.picked) {
  241. if (ev.object.type === "Thing") {
  242. var obj = ev.object
  243. // 设置物体可拖拽
  244. obj.draggable = true;
  245. /* drag dragstart dragend 事件参数:
  246. {Number} ev.x 鼠标拾取处的屏幕横坐标
  247. {Number} ev.y 鼠标拾取处的屏幕纵坐标
  248. {THING.BaseObject} ev.object 拖拽的物体
  249. {Array} ev.pickedPosition 鼠标拾取 3D 场景中的世界坐标
  250. {Boolean} ev.altKey 拖拽时是否按下 Alt 键
  251. {Boolean} ev.ctrlKey 拖拽时是否按下 Ctrl 键
  252. {Boolean} ev.shiftKey 拖拽时是否按下 Shift 键
  253. */
  254. // 开始拖拽
  255. obj.on('dragstart', function(ev) {
  256. console.log('开始拖拽');
  257. });
  258. // 拖拽中
  259. obj.on('drag', function(ev) {
  260. if (position == undefined) {
  261. position = ev.object.position[1]
  262. }
  263. ev.pickedPosition[1] = 0
  264. //创建设备编辑器
  265. add_dome(ev);
  266. });
  267. // 拖拽结束
  268. obj.on('dragend',function(ev) {
  269. console.log('结束拖拽');
  270. });
  271. }
  272. }
  273. app.pauseEvent(THING.EventType.CameraZoom, null, '摄像机前后滚动,功能图片隐藏');
  274. if (showControlTimer != null) {
  275. clearTimeout(showControlTimer);
  276. showControlTimer = null;
  277. }
  278. stopRotate();
  279. if (hiddenControlTimer == null) {
  280. clearTimeout(showControlTimer);
  281. hiddenControlTimer = setTimeout(function () {
  282. $('#all-controls').css('display', 'none');
  283. clearTimeout(hiddenControlTimer);
  284. hiddenControlTimer = null;
  285. }, 300);
  286. }
  287. // app.camera.enablePan = false; // 禁用平移
  288. });
  289. // 鼠标键抬起事件,功能按钮显示
  290. app.on(THING.EventType.MouseUp, function () {
  291. app.resumeEvent(THING.EventType.CameraZoom, null, '摄像机前后滚动,功能图片隐藏');
  292. if (hiddenControlTimer != null) {
  293. clearTimeout(hiddenControlTimer);
  294. hiddenControlTimer = null;
  295. }
  296. if (showControlTimer == null) {
  297. showControlTimer = setTimeout(function () {
  298. $('#all-controls').css('display', 'block');
  299. clearTimeout(showControlTimer);
  300. showControlTimer = null;
  301. restarRotate();
  302. }, 300);
  303. }
  304. });
  305. let count = 0;
  306. // 鼠标滑轮滚动
  307. app.on(THING.EventType.CameraZoom, function () {
  308. if (showControlTimer != null) {
  309. count = 0;
  310. return;
  311. }
  312. stopRotate();
  313. if (showControlTimer == null) {
  314. $('#all-controls').css('display', 'none');
  315. showControlTimer = setInterval(function () {
  316. count++;
  317. if (count >= 2) {
  318. $('#all-controls').css('display', 'block');
  319. restarRotate();
  320. clearInterval(showControlTimer);
  321. showControlTimer = null;
  322. }
  323. }, 300);
  324. }
  325. }, '摄像机前后滚动,功能图片隐藏');
  326. // 鼠标移动事件,已创建的红色胶囊跟随鼠标移动
  327. app.on(THING.EventType.MouseMove, function (ev) {
  328. if (box != null) {
  329. if (ev.picked) {
  330. box.position = ev.pickedPosition;
  331. }
  332. }
  333. if(device != null){
  334. if (ev.picked) {
  335. device.position = ev.pickedPosition;
  336. }
  337. }
  338. });
  339. // 摄像机位置改变结束事件,记录当前摄像机位置与目标点x,y,z的差
  340. app.on(THING.EventType.CameraChangeEnd, function () {
  341. if (cameraDistace.length > 0) {
  342. let caPos = app.camera.position;
  343. let scePos = app.root.defaultCampus.position;
  344. cameraDistace = [caPos[0] - scePos[0], caPos[1] - scePos[1], caPos[2] - scePos[2]];
  345. }
  346. restarRotate();
  347. });
  348. // 点击事件,放置红色胶囊,进入第一人称行走
  349. app.on(THING.EventType.Click, function (ev) {
  350. stopRotate();
  351. if (ev.button == 0 && box != null) {
  352. let pos = box.position;
  353. box.destroy();
  354. box = null;
  355. app.camera.flyTo(pos);
  356. enterFps([pos[0], pos[1] + 2, pos[2]]);
  357. }
  358. //创建设备
  359. if (device != null) {
  360. device = null;
  361. }
  362. checkBtnActives(['#mapBg', '#sceneSetting']);
  363. });
  364. // 进入层级事件,退出第一人称行走
  365. app.on(THING.EventType.EnterLevel, function () {
  366. if (fpsCtrl != null) {
  367. exitFps();
  368. }
  369. });
  370. // 离开层级事件,停止旋转
  371. app.on(THING.EventType.LeaveLevel, function () {
  372. stopRotate();
  373. })
  374. // 鼠标滑轮事件,停止旋转
  375. app.on(THING.EventType.MouseWheel, function () {
  376. app.camera.distanceLimited = [30, 200]; // 设置摄像机距离范围
  377. stopRotate();
  378. })
  379. // 场景添加键盘按下事件,当进入第一人称行走时,按下esc键退出第一人称行走
  380. app.on(THING.EventType.KeyDown, function (ev) {
  381. if (ev.code == 'Escape') {
  382. if (box != null) {
  383. app.resumeEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
  384. app.resumeEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
  385. box.destroy();
  386. box = null;
  387. $('#moveByFps').removeClass('active');
  388. restarRotate();
  389. }
  390. if (fpsCtrl != null) {
  391. exitFps();
  392. restarRotate();
  393. }
  394. checkBtnActives(['#mapBg', '#sceneSetting']);
  395. }
  396. });
  397. window.onresize = function () {
  398. if (!checkFull()) {
  399. //要执行的动作
  400. if (fullScreenState == true) {
  401. $('.btn-full-screen').css('display', 'block');
  402. $('.btn-narrow').css('display', 'none');
  403. $('#fullScreen span').text('全屏');
  404. fullScreenState = false;
  405. }
  406. }
  407. }
  408. }
  409. /**
  410. * 说明:检测菜单项是否已打开
  411. */
  412. function checkBtnActives(arr) {
  413. for (let i = 0; i < arr.length; i++) {
  414. let temp = arr[i];
  415. if ($(temp).hasClass('active')) {
  416. $(temp).removeClass('active');
  417. $(temp).find('.control-menu').removeClass('actives');
  418. }
  419. }
  420. }
  421. /**
  422. * 说明:判断是否全屏
  423. */
  424. function checkFull() {
  425. var isFull =
  426. document.fullscreenElement ||
  427. document.mozFullScreenElement ||
  428. document.webkitFullscreenElement;
  429. //to fix : false || undefined == undefined
  430. if (isFull === undefined) isFull = false;
  431. return isFull;
  432. }
  433. /**
  434. * 说明:创建胶囊
  435. */
  436. function createBox() {
  437. if (box == null) {
  438. box = app.create({
  439. type: 'Thing',
  440. url: 'https://model.3dmomoda.com/models/9CD08ED91F5C4E0ABB6B0833C86F2942/0/gltf/',
  441. position: [0, 0, 0],
  442. angle: 180,
  443. scale: [1.7, 1.7, 1.7],
  444. style: {
  445. color: '#FF0000'
  446. }
  447. });
  448. }
  449. }
  450. /**
  451. * 说明:第一人称行走
  452. */
  453. function enterFps(pos) {
  454. if (fpsCtrl == null) {
  455. app.pauseEvent(THING.EventType.Pick, '*', THING.EventTag.LevelPickOperation);
  456. app.pauseEvent(THING.EventType.KeyUp, null, '空格键切换视角');
  457. app.camera.position = pos; // 起始位置为鼠标点击时的位置
  458. // 添加第一人称行走控件
  459. fpsCtrl = app.addControl(
  460. new THING.WalkControl({ // 参数可以动态修改
  461. walkSpeed: 0.02, // 行走速度
  462. turnSpeed: 0.25, // 右键旋转速度
  463. gravity: 26, // 物体重量
  464. eyeHeight: 1.6, // 人高度
  465. jumpSpeed: 10, // 按空格键 跳跃的速度
  466. enableKeyRotate: false, // 默认不开启键盘控制旋转
  467. useCollision: true, // 默认不开启碰撞检测
  468. useGravity: true, // 默认开启重力
  469. groundObjects: [app.scene], // 把整个场景都添加,可把楼层或其他需要检测的添加进入碰撞体系里 | 默认值 园区地板,如果园区过大,可取消提升性能
  470. collisionObjects: [app.scene] // 把整个场景都添加,可把楼层或其他需要检测的添加进入碰撞体系里 | 默认值 园区地板,如果园区过大,可取消提升性能
  471. })
  472. );
  473. }
  474. }
  475. /**
  476. * 说明:退出第一人称行走
  477. */
  478. function exitFps() {
  479. app.removeControl(fpsCtrl);
  480. fpsCtrl = null;
  481. cameraFly(cameraInitPos[0], cameraInitPos[1]);
  482. // 恢复默认双击事件
  483. app.resumeEvent(THING.EventType.DBLClick, '*', THING.EventTag.LevelEnterOperation);
  484. // 恢复默认点击事件
  485. app.resumeEvent(THING.EventType.Click, '*', THING.EventTag.LevelBackOperation);
  486. // 恢复默认拾取事件
  487. app.resumeEvent(THING.EventType.Pick, '*', THING.EventTag.LevelPickOperation);
  488. // 恢复默认键盘键抬起事件
  489. app.resumeEvent(THING.EventType.KeyUp, null, '空格键切换视角');
  490. $('#moveByFps').removeClass('active');
  491. }
  492. /**
  493. * 说明:开启小地图
  494. */
  495. function createMiniMap() {
  496. if (miniMapCtrl == null) {
  497. // 添加小地图控件
  498. miniMapCtrl = app.addControl(new THING.MiniMapControl({
  499. width: 200,
  500. height: 200,
  501. position: THING.CornerType.LeftBottom,
  502. opacity: 0.8,
  503. scale: 1,
  504. angle: 0,
  505. mousewheel: true,
  506. cameraViewImg: 'https://www.thingjs.com/static/images/minimap1.png',
  507. cameraCenterImg: 'https://www.thingjs.com/static/images/minimap0.png'
  508. }));
  509. $('.minimap').css('border', '1px solid rgba(255, 255, 255, 0.8)');
  510. $('.minimap').css('left', '3px');
  511. $('.minimap').css('bottom', '3px');
  512. } else {
  513. destoryMiniMap();
  514. createMiniMap();
  515. }
  516. }
  517. /**
  518. * 说明:关闭小地图
  519. */
  520. function destoryMiniMap() {
  521. if (miniMapCtrl != null) {
  522. app.removeControl(miniMapCtrl);
  523. miniMapCtrl = null;
  524. }
  525. }
  526. /**
  527. * 说明:全屏显示
  528. */
  529. function fullScreen() {
  530. let el = document.documentElement;
  531. let rfs = el.requestFullScreen || el.webkitRequestFullScreen;
  532. if (typeof rfs != "undefined" && rfs) {
  533. rfs.call(el);
  534. } else if (typeof window.ActiveXObject != "undefined") {
  535. let wscript = new ActiveXObject("WScript.Shell");
  536. if (wscript != null) {
  537. wscript.SendKeys("{F11}");
  538. }
  539. }
  540. }
  541. /**
  542. * 说明:退出全屏
  543. */
  544. function exitFullScreen() {
  545. let el = document;
  546. let cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.exitFullScreen;
  547. if (typeof cfs != "undefined" && cfs) {
  548. cfs.call(el);
  549. } else if (typeof window.ActiveXObject != "undefined") {
  550. let wscript = new ActiveXObject("WScript.Shell");
  551. if (wscript != null) {
  552. wscript.SendKeys("{F11}");
  553. }
  554. }
  555. }
  556. /**
  557. * 说明:摄像机飞行
  558. */
  559. function cameraFly(position, target) {
  560. // 摄像机飞行到某位置
  561. app.camera.flyTo({
  562. 'position': position,
  563. 'target': target,
  564. 'time': 1000,
  565. 'complete': function () {
  566. }
  567. });
  568. }
  569. /**
  570. * 说明:自动旋转
  571. */
  572. function startRotate() {
  573. app.camera.enableRotate = false; // 关闭默认的旋转操作
  574. app.camera.enablePan = false; // 关闭默认的平移操作
  575. app.camera.enableZoom = false; // 关闭默认的缩放操作
  576. // 绕摄像机当前目标点旋转
  577. app.camera.rotateAround({
  578. target: app.camera.target, // 围绕摄像机当前目标点
  579. // object: obj, // 环绕的物体 (object 与 target 的设置互斥)
  580. speed: 4, // 环绕飞行的时间(3min)
  581. yRotateAngle: 360, // 环绕y轴飞行的旋转角度
  582. loopType: THING.LoopType.Repeat // 设置循环类型
  583. });
  584. }
  585. /**
  586. * 说明:停止自动旋转
  587. */
  588. function stopRotate() {
  589. app.camera.enableRotate = true; // 开启默认的旋转操作
  590. app.camera.enablePan = true; // 开启默认的平移操作
  591. app.camera.enableZoom = true; // 开启默认的缩放操作
  592. app.camera.stopRotateAround();
  593. if (rotateTimer) {
  594. clearTimeout(rotateTimer);
  595. rotateTimer = null;
  596. }
  597. }
  598. /**
  599. * 说明:重新开始转动,未进行任何操作5s后开始自动旋转
  600. */
  601. function restarRotate() {
  602. if (fpsCtrl != null || !$('#sceneSetting .control-menu-pane li.autoRotate').hasClass('selected')) {
  603. return;
  604. }
  605. if (rotateTimer == null) {
  606. rotateTimer = setTimeout(function () {
  607. startRotate();
  608. }, restartTime);
  609. } else {
  610. clearTimeout(rotateTimer);
  611. rotateTimer = null;
  612. restarRotate();
  613. }
  614. }