@@ -1,4 +1,4 @@
|
||||
import { sceneRegistry } from '@pascal-app/core'
|
||||
import { emitter, sceneRegistry } from '@pascal-app/core'
|
||||
import { useEffect } from 'react'
|
||||
import useViewer from '../../store/use-viewer'
|
||||
|
||||
@@ -14,5 +14,30 @@ export const ScanSystem = () => {
|
||||
}
|
||||
})
|
||||
}, [showScans])
|
||||
|
||||
useEffect(() => {
|
||||
const hideForCapture = () => {
|
||||
const scans = sceneRegistry.byType.scan || new Set()
|
||||
scans.forEach((scanId) => {
|
||||
const node = sceneRegistry.nodes.get(scanId)
|
||||
if (node) node.visible = false
|
||||
})
|
||||
}
|
||||
const restoreAfterCapture = () => {
|
||||
const showScansNow = useViewer.getState().showScans
|
||||
const scans = sceneRegistry.byType.scan || new Set()
|
||||
scans.forEach((scanId) => {
|
||||
const node = sceneRegistry.nodes.get(scanId)
|
||||
if (node) node.visible = showScansNow
|
||||
})
|
||||
}
|
||||
emitter.on('thumbnail:before-capture', hideForCapture)
|
||||
emitter.on('thumbnail:after-capture', restoreAfterCapture)
|
||||
return () => {
|
||||
emitter.off('thumbnail:before-capture', hideForCapture)
|
||||
emitter.off('thumbnail:after-capture', restoreAfterCapture)
|
||||
}
|
||||
}, [])
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user