index.vue 2.3 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 { togetherCallback } from '@/utils'
  32. import Actions from '@/components/actions/index.vue'
  33. import { getSceneModel } from '@/sdk'
  34. import { useViewStack } from '@/hook'
  35. import { showLeftCtrlPanoStack, showLeftPanoStack, showModelsChangeStoreStack, custom } from '@/env'
  36. import { ref } from 'vue'
  37. import type { ActionsProps } from '@/components/actions/index.vue'
  38. const opacityOption = { min: 0.01, max: 1, step: 0.01, }
  39. const bottomOption = { min: 1, max: 100, step: 1, }
  40. const scaleOption = { min: 0.01, max: 1, step: 0.01, }
  41. const actionItems: ActionsProps['items'] = [
  42. {
  43. icon: 'move',
  44. text: '移动',
  45. action: () => {
  46. getSceneModel(custom.currentModel)?.enterMoveMode()
  47. return () => {
  48. console.log(getSceneModel(custom.currentModel), 'leave')
  49. getSceneModel(custom.currentModel)?.leaveTransform()
  50. }
  51. }
  52. },
  53. {
  54. icon: 'flip',
  55. text: '旋转',
  56. action: () => {
  57. getSceneModel(custom.currentModel)?.enterRotateMode()
  58. return () => getSceneModel(custom.currentModel)?.leaveTransform()
  59. }
  60. },
  61. ]
  62. useViewStack(() => togetherCallback([
  63. showLeftCtrlPanoStack.push(ref(false)),
  64. showLeftPanoStack.push(ref(true)),
  65. showModelsChangeStoreStack.push(ref(true))
  66. ]))
  67. useViewStack(autoSaveModels)
  68. </script>