diff --git a/packages/plugin-r3f/src/components/UI.tsx b/packages/plugin-r3f/src/components/UI.tsx index 554ab65..a63516f 100644 --- a/packages/plugin-r3f/src/components/UI.tsx +++ b/packages/plugin-r3f/src/components/UI.tsx @@ -13,6 +13,7 @@ import ViewportSettings from './ViewportSettings' import type {$FixMe} from '@theatre/shared/utils/types' import studio from '@theatre/studio' import {getSelected} from './useSelected' +import {useVal} from '@theatre/dataverse-react' const UI: VFC = () => { const [ @@ -20,7 +21,6 @@ const UI: VFC = () => { transformControlsMode, transformControlsSpace, viewportShading, - referenceWindowSize, setTransformControlsMode, setTransformControlsSpace, setViewportShading, @@ -30,7 +30,6 @@ const UI: VFC = () => { state.transformControlsMode, state.transformControlsSpace, state.viewportShading, - state.referenceWindowSize, state.setTransformControlsMode, state.setTransformControlsSpace, state.setViewportShading, @@ -38,6 +37,9 @@ const UI: VFC = () => { shallow, ) + const referenceWindowSize = + useVal(editorObject?.props.referenceWindowSize) ?? 120 + if (!editorObject) return <>> return ( diff --git a/packages/plugin-r3f/src/components/ViewportSettings.tsx b/packages/plugin-r3f/src/components/ViewportSettings.tsx index e969273..f4f92c7 100644 --- a/packages/plugin-r3f/src/components/ViewportSettings.tsx +++ b/packages/plugin-r3f/src/components/ViewportSettings.tsx @@ -8,19 +8,16 @@ import {useVal} from '@theatre/dataverse-react' import studio from '@theatre/studio' const ViewportShadingSettings: VFC = () => { - const [editorObject, referenceWindowSize, setReferenceWindowSize] = - useEditorStore( - (state) => [ - state.editorObject, - state.referenceWindowSize, - state.setReferenceWindowSize, - ], - shallow, - ) + const [editorObject] = useEditorStore( + (state) => [state.editorObject], + shallow, + ) const showAxes = useVal(editorObject?.props.showAxes) ?? true const showGrid = useVal(editorObject?.props.showGrid) ?? true const showOverlayIcons = useVal(editorObject?.props.showOverlayIcons) ?? false + const referenceWindowSize = + useVal(editorObject?.props.referenceWindowSize) ?? 120 return (