Chore: Removed file-saver from plugin-r3f

This commit is contained in:
Aria Minaei 2021-06-29 15:00:20 +02:00
parent 14b3207680
commit 040317f53b
2 changed files with 13 additions and 26 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@theatre/plugin-r3f",
"version": "1.0.0-dev",
"version": "1.0.0-dev.1",
"license": "Apache-2.0",
"authors": [
{
@ -30,7 +30,6 @@
"build": "tsc --build ./tsconfig.json"
},
"devDependencies": {
"@types/file-saver": "^2.0.2",
"@types/jest": "^26.0.23",
"@types/lodash-es": "^4.17.4",
"@types/node": "^15.6.2",
@ -43,7 +42,6 @@
"@theatre/core": "workspace:*",
"@theatre/studio": "workspace:*",
"fast-deep-equal": "^3.1.3",
"file-saver": "^2.0.5",
"lodash-es": "^4.17.21",
"prism-react-renderer": "1.2.1",
"react": "^17.0.2",

View file

@ -4,7 +4,6 @@ import TransformControlsModeSelect from './TransformControlsModeSelect'
import {useEditorStore} from '../store'
import shallow from 'zustand/shallow'
import ReferenceWindow from './ReferenceWindow'
import {saveAs} from 'file-saver'
import TransformControlsSpaceSelect from './TransformControlsSpaceSelect'
import ViewportShadingSelect from './ViewportShadingSelect'
import {AiFillEye, GiPocketBow, RiFocus3Line} from 'react-icons/all'
@ -68,14 +67,15 @@ const UI: VFC = () => {
label="Focus on selected"
icon={<RiFocus3Line />}
onClick={() => {
const orbitControls = useEditorStore.getState()
.orbitControlsRef?.current
const orbitControls =
useEditorStore.getState().orbitControlsRef?.current
const selected = useEditorStore.getState().selected
let focusObject
if (selected) {
focusObject = useEditorStore.getState()
.editablesSnapshot![selected].proxyObject
focusObject =
useEditorStore.getState().editablesSnapshot![selected]
.proxyObject
}
if (orbitControls && focusObject) {
@ -92,15 +92,18 @@ const UI: VFC = () => {
label="Align object to view"
icon={<GiPocketBow />}
onClick={() => {
const camera = (useEditorStore.getState().orbitControlsRef
?.current as $FixMe)?.object
const camera = (
useEditorStore.getState().orbitControlsRef
?.current as $FixMe
)?.object
const selected = useEditorStore.getState().selected
let proxyObject
if (selected) {
proxyObject = useEditorStore.getState()
.editablesSnapshot![selected].proxyObject
proxyObject =
useEditorStore.getState().editablesSnapshot![selected]
.proxyObject
if (proxyObject && camera) {
const direction = new Vector3()
@ -142,20 +145,6 @@ const UI: VFC = () => {
>
Close
</Button>
{/* Bottom-right corner */}
<Button
className="absolute right-0 bottom-0 pointer-events-auto"
onClick={() => {
const blob = new Blob(
[JSON.stringify(useEditorStore.getState().serialize())],
{type: 'text/json;charset=utf-8'},
)
saveAs(blob, 'editableState.json')
}}
>
Export
</Button>
</div>
</div>
</div>