r3f fixes (#222)
* Minify r3f extension bundle, because it is expected by the React dead code elimination check, since we bundle React in it * Add children to props, since it is required by React 18 types * Fix getting context attributes for gl in ReferenceWindow * Don't bundle threejs in extension * Fix editor not responding to scene initialization * Fix SnapshotEditor css
This commit is contained in:
parent
16e255fd57
commit
262d7d61d3
5 changed files with 59 additions and 44 deletions
|
@ -1,3 +1,4 @@
|
|||
import type {ReactNode} from 'react'
|
||||
import React, {
|
||||
createContext,
|
||||
useContext,
|
||||
|
@ -26,6 +27,7 @@ export const useCurrentSheet = (): ISheet | undefined => {
|
|||
|
||||
const SheetProvider: React.FC<{
|
||||
sheet: ISheet
|
||||
children: ReactNode
|
||||
}> = ({sheet, children}) => {
|
||||
const {scene, gl} = useThree((s) => ({scene: s.scene, gl: s.gl}))
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ export type EditorStore = {
|
|||
) => void
|
||||
}
|
||||
|
||||
const config: StateCreator<EditorStore> = (set) => {
|
||||
const config: StateCreator<EditorStore> = (set, get) => {
|
||||
return {
|
||||
sheet: null,
|
||||
editorObject: null,
|
||||
|
@ -70,6 +70,10 @@ const config: StateCreator<EditorStore> = (set) => {
|
|||
scene,
|
||||
gl,
|
||||
})
|
||||
|
||||
// Create a snapshot, so that if the editor is already open, it gets refreshed
|
||||
// when the scene is initialized
|
||||
get().createSnapshot()
|
||||
},
|
||||
|
||||
addEditable: (uniqueName, editable) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue