forked from theatre-js/theatre
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relax editable TS types to allow creating editable versions of all th…
…e JSX.IntrinsicElements elements. (theatre-js#237) Enable custom editable components through relaxed typescript types
- Loading branch information
1 parent
2d3466e
commit a3d9892
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/playground/src/shared/custom-editable-components/App.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {editable as e, SheetProvider} from '@theatre/r3f' | ||
import {getProject} from '@theatre/core' | ||
import React from 'react' | ||
import {Canvas} from '@react-three/fiber' | ||
|
||
const EditablePoints = e('points', 'mesh') | ||
|
||
function App() { | ||
return ( | ||
<div | ||
style={{ | ||
height: '100vh', | ||
}} | ||
> | ||
<Canvas | ||
dpr={[1.5, 2]} | ||
linear | ||
gl={{preserveDrawingBuffer: true}} | ||
frameloop="demand" | ||
> | ||
<SheetProvider sheet={getProject('Space').sheet('Scene')}> | ||
<ambientLight intensity={0.75} /> | ||
<EditablePoints uniqueName="points"> | ||
<torusKnotGeometry args={[1, 0.3, 128, 64]} /> | ||
<meshNormalMaterial /> | ||
</EditablePoints> | ||
</SheetProvider> | ||
</Canvas> | ||
</div> | ||
) | ||
} | ||
|
||
export default App |
10 changes: 10 additions & 0 deletions
10
packages/playground/src/shared/custom-editable-components/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import App from './App' | ||
import studio from '@theatre/studio' | ||
import extension from '@theatre/r3f/dist/extension' | ||
|
||
studio.extend(extension) | ||
studio.initialize() | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters