index.ts 934 B

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