pulic.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * 说明:检测菜单项是否已打开
  3. */
  4. function checkBtnActives(arr) {
  5. for (let i = 0; i < arr.length; i++) {
  6. let temp = arr[i];
  7. if ($(temp).hasClass('active')) {
  8. $(temp).removeClass('active');
  9. $(temp).find('.control-menu').removeClass('actives');
  10. }
  11. }
  12. }
  13. /**
  14. * 说明:判断是否全屏
  15. */
  16. function checkFull() {
  17. var isFull =
  18. document.fullscreenElement ||
  19. document.mozFullScreenElement ||
  20. document.webkitFullscreenElement;
  21. //to fix : false || undefined == undefined
  22. if (isFull === undefined) isFull = false;
  23. return isFull;
  24. }
  25. /**
  26. * 说明:创建胶囊
  27. */
  28. function createBox() {
  29. if (box == null) {
  30. box = app.create({
  31. type: 'Thing',
  32. url: 'https://model.3dmomoda.com/models/9CD08ED91F5C4E0ABB6B0833C86F2942/0/gltf/',
  33. position: [0, 0, 0],
  34. angle: 180,
  35. scale: [1.7, 1.7, 1.7],
  36. style: {
  37. color: '#FF0000'
  38. }
  39. });
  40. }
  41. }
  42. /**
  43. * 说明:第一人称行走
  44. */
  45. function enterFps(pos) {
  46. if (fpsCtrl == null) {
  47. app.pauseEvent(THING.EventType.Pick, '*', THING.EventTag.LevelPickOperation);
  48. app.pauseEvent(THING.EventType.KeyUp, null, '空格键切换视角');
  49. app.camera.position = pos; // 起始位置为鼠标点击时的位置
  50. // 添加第一人称行走控件
  51. fpsCtrl = app.addControl(