diff --git a/web/src/components/IdeViewer/IdeViewer.js b/web/src/components/IdeViewer/IdeViewer.js index efc42a7..828af15 100644 --- a/web/src/components/IdeViewer/IdeViewer.js +++ b/web/src/components/IdeViewer/IdeViewer.js @@ -6,7 +6,7 @@ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls' extend({ OrbitControls }) let debounceTimeoutId -function Controls({ onCameraChange }) { +function Controls({ onCameraChange, onDragStart }) { const controls = useRef() const { scene, camera, gl } = useThree() useEffect(() => { @@ -47,7 +47,10 @@ function Controls({ onCameraChange }) { }) }, 400) } - const dragStart = () => clearTimeout(debounceTimeoutId) + const dragStart = () => { + onDragStart() + clearTimeout(debounceTimeoutId) + } controls.current.addEventListener('end', dragCallback) controls.current.addEventListener('start', dragStart) const oldCurrent = controls.current @@ -120,6 +123,7 @@ const IdeViewer = () => { > setIsDragging(true)} onCameraChange={({ position, rotation }) => { dispatch({ type: 'render',