index.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { stackFactory, flatStacksValue, strToParams } from '@/utils'
  2. import { ref } from 'vue'
  3. import type { FuseModel, TaggingPosition, View } from '@/store'
  4. export const viewModeStack = stackFactory(ref<'full' | 'auto'>('auto'))
  5. export const showToolbarStack = stackFactory(ref<boolean>(false))
  6. export const showHeadBarStack = stackFactory(ref<boolean>(true))
  7. export const showRightPanoStack = stackFactory(ref<boolean>(true))
  8. export const showLeftPanoStack = stackFactory(ref<boolean>(false))
  9. export const showLeftCtrlPanoStack = stackFactory(ref<boolean>(true))
  10. export const showRightCtrlPanoStack = stackFactory(ref<boolean>(true))
  11. export const showBottomBarStack = stackFactory(ref<boolean>(false), true)
  12. export const bottomBarHeightStack = stackFactory(ref<string>('60px'))
  13. export const showTaggingsStack = stackFactory(ref<boolean>(true))
  14. export const showMeasuresStack = stackFactory(ref<boolean>(true))
  15. export const currentModelStack = stackFactory(ref<FuseModel | null>(null))
  16. export const showModelsMapStack = stackFactory(ref<WeakMap<FuseModel, boolean>>(new WeakMap()), true)
  17. export const modelsChangeStoreStack = stackFactory(ref<boolean>(false))
  18. export const showTaggingPositionsStack = stackFactory(ref<WeakSet<TaggingPosition>>(new WeakSet()))
  19. export const currentViewStack = stackFactory(ref<View>())
  20. export const custom = flatStacksValue({
  21. viewMode: viewModeStack,
  22. showToolbar: showToolbarStack,
  23. showRightPano: showRightPanoStack,
  24. showLeftPano: showLeftPanoStack,
  25. showLeftCtrlPano: showLeftCtrlPanoStack,
  26. shwoRightCtrlPano: showRightCtrlPanoStack,
  27. showTaggings: showTaggingsStack,
  28. showMeasures: showMeasuresStack,
  29. currentModel: currentModelStack,
  30. showModelsMap: showModelsMapStack,
  31. modelsChangeStore: modelsChangeStoreStack,
  32. showTaggingPositions: showTaggingPositionsStack,
  33. showBottomBar: showBottomBarStack,
  34. bottomBarHeight: bottomBarHeightStack,
  35. showHeadBar: showHeadBarStack,
  36. currentView: currentViewStack
  37. })
  38. export const params = strToParams(location.search) as unknown as Params
  39. params.caseId = Number(params.caseId)
  40. params.share = Boolean(Number(params.share))
  41. export type Params = {
  42. caseId: number,
  43. baseURL?: string,
  44. modelId?: string,
  45. m?: string
  46. share: boolean,
  47. token?: string
  48. }
  49. export const baseURL = params.baseURL ? params.baseURL : '/'
  50. export const getResource = (uri: string) => {
  51. if (~uri.indexOf('base64') || ~uri.indexOf('bolb') || ~uri.indexOf('//')) return uri
  52. return `${baseURL}/${uri}`
  53. }