Chore: r3f only uses Theatre's selections now
This commit is contained in:
parent
160448ec29
commit
d0e9d357e7
3 changed files with 16 additions and 6 deletions
|
@ -12,6 +12,7 @@ import {IconButton, Button, SettingsButton} from './elements'
|
|||
import ViewportSettings from './ViewportSettings'
|
||||
import type {$FixMe} from '@theatre/shared/utils/types'
|
||||
import studio from '@theatre/studio'
|
||||
import {getSelected} from './useSelected'
|
||||
|
||||
const UI: VFC = () => {
|
||||
const [
|
||||
|
@ -70,7 +71,8 @@ const UI: VFC = () => {
|
|||
onClick={() => {
|
||||
const orbitControls =
|
||||
useEditorStore.getState().orbitControlsRef?.current
|
||||
const selected = useEditorStore.getState().selected
|
||||
const selected = getSelected()
|
||||
|
||||
let focusObject
|
||||
|
||||
if (selected) {
|
||||
|
@ -97,7 +99,8 @@ const UI: VFC = () => {
|
|||
useEditorStore.getState().orbitControlsRef
|
||||
?.current as $FixMe
|
||||
)?.object
|
||||
const selected = useEditorStore.getState().selected
|
||||
|
||||
const selected = getSelected()
|
||||
|
||||
let proxyObject
|
||||
|
||||
|
|
|
@ -25,3 +25,14 @@ export function useSelected(): undefined | string {
|
|||
|
||||
return state
|
||||
}
|
||||
|
||||
export function getSelected(): undefined | string {
|
||||
const sheet = useEditorStore.getState().sheet
|
||||
if (!sheet) return undefined
|
||||
const item = studio.selection.find((s) => s.sheet === sheet)
|
||||
if (!item) {
|
||||
return undefined
|
||||
} else {
|
||||
return item.address.objectKey
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue