File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed
packages/abstract-3d/src/renderers/react Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -31,20 +31,6 @@ export type ControlsHelper = (Viewcube | Viewport) & { readonly props: Pick<Gizm
3131type Viewcube = { readonly type : "Viewcube" ; readonly viewcubeProps : GenericProps } ;
3232type Viewport = { readonly type : "Viewport" ; readonly viewportProps : GizmoViewportProps } ;
3333
34- const ControlsWrapper = (
35- props : OrbitControlsProps & { readonly setControls : ( r : React . MutableRefObject < any > ) => void }
36- ) : React . JSX . Element => {
37- const ref = useRef < any > ( undefined ! ) ;
38-
39- useEffect ( ( ) => {
40- if ( ! ref . current ) {
41- return ;
42- }
43- props . setControls ( ref . current ) ;
44- } , [ ref . current ] ) ;
45- return < OrbitControls { ...props } makeDefault ref = { ref } /> ;
46- } ;
47-
4834export function ReactCamera ( {
4935 useAnimations,
5036 camera,
@@ -198,6 +184,20 @@ export function ReactCamera({
198184 ) ;
199185}
200186
187+ const ControlsWrapper = (
188+ props : OrbitControlsProps & { readonly setControls : ( r : React . MutableRefObject < any > ) => void }
189+ ) : React . JSX . Element => {
190+ const ref = useRef < any > ( undefined ! ) ;
191+
192+ useLayoutEffect ( ( ) => {
193+ if ( ! ref . current ) {
194+ return ;
195+ }
196+ props . setControls ( ref . current ) ;
197+ } , [ ref . current ] ) ;
198+ return < OrbitControls { ...props } makeDefault ref = { ref } /> ;
199+ } ;
200+
201201type GizmoViewportProps = React . JSX . IntrinsicElements [ "group" ] & {
202202 readonly axisColors ?: readonly [ string , string , string ] ;
203203 readonly axisScale ?: readonly [ number , number , number ] ;
You can’t perform that action at this time.
0 commit comments