index.ts 1003 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { initialSDK as initialSDKRaw, sdk } from './sdk'
  2. import { setupAssociation } from './association'
  3. import { ref } from 'vue'
  4. //import * as GaussianSplats3D from '@/assets//lib/gaussian/gaussian-splats-3d.module.js'
  5. const presetViewElement = (layout: HTMLDivElement) => {
  6. const style = getComputedStyle(layout)
  7. const allows = ['relative', 'absolute', 'fixed']
  8. if (!allows.includes(style.position)) {
  9. layout.style.position = 'relative'
  10. }
  11. const el = document.createElement('div')
  12. el.style.cssText = `
  13. position: absolute;
  14. left: 0;
  15. right: 0;
  16. top: 0;
  17. bottom: 0;
  18. pointer-events: none;
  19. z-index:101
  20. `
  21. layout.appendChild(el)
  22. return el
  23. }
  24. export const sdkLoaded = ref(false)
  25. export const initialSDK: typeof initialSDKRaw = async (props) => {
  26. const sdk = await initialSDKRaw(props)
  27. setupAssociation(presetViewElement(props.layout), sdk)
  28. sdkLoaded.value = true
  29. return sdk
  30. }
  31. export * from './association'
  32. export * from './sdk'
  33. export default sdk