@sitewerk-ag/react-shapediver-viewer
v1.1.0
Published
Install it via:
Readme
react-shapediver-viewer
Install
Install it via:
npm install --save @sitewerk/react-shapediver-viewerGuide
Imperative mode
To escape reacts rendering and acess the raw shapediver instance you can attach a react ref to it.
import { SdvViewer } from '@sitewerk/react-shapediver-viewer'
function MyComponent () {
const viewerRef = useRef<SdvViewer>()
useEffect(() => {
viewerRef.current.scene.render()
}, [])
return (
<ShapediverViewer ref={viewerRef} parameters={{}} />
)
}
Note: The viewerRef is not guaranteed to be instantiated when using it in conjunction with useEffect. But one can assume, it's instantiated when interacting with the UI. Otherwise you'll have to attach a local state that tracks the viewer state. You can get the current state via
onStateUpdate
