index.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <RightPano v-if="custom.currentModel">
  3. <ui-group>
  4. <template #header>
  5. <Actions class="edit-header" :items="actionItems" />
  6. </template>
  7. <ui-group-option label="等比缩放">
  8. <template #icon>
  9. <a href="">设置比例</a>
  10. </template>
  11. <ui-input type="range" v-model="custom.currentModel.scale" v-bind="scaleOption" width="100%" />
  12. </ui-group-option>
  13. <ui-group-option label="离地高度">
  14. <ui-input type="range" v-model="custom.currentModel.bottom" v-bind="bottomOption" width="100%" />
  15. </ui-group-option>
  16. <ui-group-option label="模型不透明度">
  17. <ui-input type="range" v-model="custom.currentModel.opacity" v-bind="opacityOption" width="100%" />
  18. </ui-group-option>
  19. <ui-group-option>
  20. <ui-button>配准</ui-button>
  21. </ui-group-option>
  22. <ui-group-option>
  23. <ui-button>恢复默认</ui-button>
  24. </ui-group-option>
  25. </ui-group>
  26. </RightPano>
  27. </template>
  28. <script lang="ts" setup>
  29. import { RightPano } from '@/layout'
  30. import { autoSaveModels } from '@/store'
  31. import Actions from '@/components/actions/index.vue'
  32. import { getSceneModel } from '@/sdk'
  33. import { useViewStack } from '@/hook'
  34. import { showLeftCtrlPanoStack, showLeftPanoStack, custom } from '@/env'
  35. import { ref } from 'vue'
  36. import type { ActionsProps } from '@/components/actions/index.vue'
  37. const opacityOption = { min: 0.01, max: 1, step: 0.01, }
  38. const bottomOption = { min: 1, max: 100, step: 1, }
  39. const scaleOption = { min: 0.01, max: 1, step: 0.01, }
  40. const actionItems: ActionsProps['items'] = [
  41. {
  42. icon: 'move',
  43. text: '移动',
  44. action: () => {
  45. getSceneModel(custom.currentModel)?.enterMoveMode()
  46. return () => getSceneModel(custom.currentModel)?.leaveMoveMode()
  47. }
  48. },
  49. {
  50. icon: 'flip',
  51. text: '旋转',
  52. action: () => {
  53. getSceneModel(custom.currentModel)?.enterRotateMode()
  54. return () => getSceneModel(custom.currentModel)?.leaveRotateMode()
  55. }
  56. },
  57. ]
  58. useViewStack(() => {
  59. const pops = [
  60. showLeftCtrlPanoStack.push(ref(false)),
  61. showLeftPanoStack.push(ref(true))
  62. ]
  63. return () => {
  64. pops.forEach(pop => pop())
  65. }
  66. })
  67. useViewStack(autoSaveModels)
  68. </script>