OutlinePanel now autohides
This commit is contained in:
parent
09c9978713
commit
3d26f840ae
7 changed files with 75 additions and 44 deletions
|
@ -13,6 +13,7 @@ import PanelWrapper from './PanelWrapper'
|
||||||
import {ErrorBoundary} from 'react-error-boundary'
|
import {ErrorBoundary} from 'react-error-boundary'
|
||||||
import {IoClose} from 'react-icons/all'
|
import {IoClose} from 'react-icons/all'
|
||||||
import getStudio from '@theatre/studio/getStudio'
|
import getStudio from '@theatre/studio/getStudio'
|
||||||
|
import {panelZIndexes} from '@theatre/studio/panels/panelZIndexes'
|
||||||
|
|
||||||
const defaultPosition: PanelPosition = {
|
const defaultPosition: PanelPosition = {
|
||||||
edges: {
|
edges: {
|
||||||
|
@ -45,6 +46,7 @@ const Container = styled(PanelWrapper)`
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
box-shadow: 2px 2px 0 rgb(0 0 0 / 11%);
|
box-shadow: 2px 2px 0 rgb(0 0 0 / 11%);
|
||||||
|
z-index: ${panelZIndexes.pluginPanes};
|
||||||
`
|
`
|
||||||
|
|
||||||
const Title = styled.div`
|
const Title = styled.div`
|
||||||
|
|
|
@ -11,6 +11,7 @@ import PanelWrapper from '@theatre/studio/panels/BasePanel/PanelWrapper'
|
||||||
import PanelDragZone from '@theatre/studio/panels/BasePanel/PanelDragZone'
|
import PanelDragZone from '@theatre/studio/panels/BasePanel/PanelDragZone'
|
||||||
import {isSheetObject} from '@theatre/shared/instanceTypes'
|
import {isSheetObject} from '@theatre/shared/instanceTypes'
|
||||||
import type SheetObject from '@theatre/core/sheetObjects/SheetObject'
|
import type SheetObject from '@theatre/core/sheetObjects/SheetObject'
|
||||||
|
import {panelZIndexes} from '@theatre/studio/panels/panelZIndexes'
|
||||||
|
|
||||||
const Container = styled(PanelWrapper)`
|
const Container = styled(PanelWrapper)`
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
|
@ -19,6 +20,7 @@ const Container = styled(PanelWrapper)`
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
/* background-color: #282b2ff0; */
|
/* background-color: #282b2ff0; */
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
z-index: ${panelZIndexes.propsPanel};
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -1,42 +1,44 @@
|
||||||
import {usePrism} from '@theatre/dataverse-react'
|
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
import {panelZIndexes} from '@theatre/studio/panels/panelZIndexes'
|
||||||
import ProjectsList from './ProjectsList/ProjectsList'
|
import ProjectsList from './ProjectsList/ProjectsList'
|
||||||
import type {PanelPosition} from '@theatre/studio/store/types'
|
|
||||||
import BasePanel from '@theatre/studio/panels/BasePanel/BasePanel'
|
|
||||||
import PanelWrapper from '@theatre/studio/panels/BasePanel/PanelWrapper'
|
|
||||||
import PanelDragZone from '@theatre/studio/panels/BasePanel/PanelDragZone'
|
|
||||||
|
|
||||||
const defaultPosition: PanelPosition = {
|
const Container = styled.div`
|
||||||
edges: {
|
background-color: transparent;
|
||||||
left: {from: 'screenLeft', distance: 0.2},
|
pointer-events: none;
|
||||||
right: {from: 'screenLeft', distance: 0.4},
|
position: absolute;
|
||||||
top: {from: 'screenTop', distance: 0.2},
|
left: 0;
|
||||||
bottom: {from: 'screenBottom', distance: 0.2},
|
top: 50px;
|
||||||
},
|
bottom: 8px;
|
||||||
|
right: 0;
|
||||||
|
z-index: ${panelZIndexes.outlinePanel};
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
display: block;
|
||||||
|
content: ' ';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 20px;
|
||||||
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
|
`
|
||||||
|
|
||||||
const minDims = {width: 300, height: 300}
|
const Content = styled.div`
|
||||||
|
position: absolute;
|
||||||
const OutlinePanel: React.FC<{}> = (props) => {
|
top: 0;
|
||||||
return (
|
bottom: 0;
|
||||||
<BasePanel
|
left: 0;
|
||||||
panelId="outlinePanel"
|
|
||||||
defaultPosition={defaultPosition}
|
|
||||||
minDims={minDims}
|
|
||||||
>
|
|
||||||
<Content />
|
|
||||||
</BasePanel>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const Container = styled(PanelWrapper)`
|
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: transparent;
|
transform: translateX(-100%);
|
||||||
box-shadow: none;
|
pointer-events: auto;
|
||||||
pointer-events: none;
|
|
||||||
|
${Container}:hover & {
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const Title = styled.div`
|
const Title = styled.div`
|
||||||
|
@ -53,21 +55,19 @@ const F2 = styled.div`
|
||||||
padding: 0;
|
padding: 0;
|
||||||
`
|
`
|
||||||
|
|
||||||
const Content: React.FC = () => {
|
const OutlinePanel: React.FC<{}> = (props) => {
|
||||||
return usePrism(() => {
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<PanelDragZone>
|
<Content>
|
||||||
<Header>
|
<Header>
|
||||||
<Title>Outline</Title>
|
<Title>Outline</Title>
|
||||||
</Header>
|
</Header>
|
||||||
</PanelDragZone>
|
|
||||||
<F2>
|
<F2>
|
||||||
<ProjectsList />
|
<ProjectsList />
|
||||||
</F2>
|
</F2>
|
||||||
|
</Content>
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}, [])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default OutlinePanel
|
export default OutlinePanel
|
||||||
|
|
|
@ -9,6 +9,7 @@ const Container = styled.ul`
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
padding-right: 4px;
|
||||||
`
|
`
|
||||||
|
|
||||||
const ProjectsList: React.FC<{}> = (props) => {
|
const ProjectsList: React.FC<{}> = (props) => {
|
||||||
|
|
|
@ -25,8 +25,11 @@ import type Sheet from '@theatre/core/sheets/Sheet'
|
||||||
import {isSheet, isSheetObject} from '@theatre/shared/instanceTypes'
|
import {isSheet, isSheetObject} from '@theatre/shared/instanceTypes'
|
||||||
import {uniq} from 'lodash-es'
|
import {uniq} from 'lodash-es'
|
||||||
import GraphEditorToggle from './GraphEditorToggle'
|
import GraphEditorToggle from './GraphEditorToggle'
|
||||||
|
import {panelZIndexes} from '@theatre/studio/panels/panelZIndexes'
|
||||||
|
|
||||||
const Container = styled(PanelWrapper)``
|
const Container = styled(PanelWrapper)`
|
||||||
|
z-index: ${panelZIndexes.sequenceEditorPanel};
|
||||||
|
`
|
||||||
|
|
||||||
const LeftBackground = styled.div`
|
const LeftBackground = styled.div`
|
||||||
background-color: #282b2fed;
|
background-color: #282b2fed;
|
||||||
|
|
21
theatre/studio/src/panels/panelZIndexes.tsx
Normal file
21
theatre/studio/src/panels/panelZIndexes.tsx
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
export const panelZIndexes = {
|
||||||
|
get outlinePanel() {
|
||||||
|
return 1
|
||||||
|
},
|
||||||
|
|
||||||
|
get propsPanel() {
|
||||||
|
return panelZIndexes.outlinePanel
|
||||||
|
},
|
||||||
|
|
||||||
|
get sequenceEditorPanel() {
|
||||||
|
return this.outlinePanel - 1
|
||||||
|
},
|
||||||
|
|
||||||
|
get toolbar() {
|
||||||
|
return this.outlinePanel + 1
|
||||||
|
},
|
||||||
|
|
||||||
|
get pluginPanes() {
|
||||||
|
return this.sequenceEditorPanel - 1
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,11 +1,13 @@
|
||||||
import {useVal} from '@theatre/dataverse-react'
|
import {useVal} from '@theatre/dataverse-react'
|
||||||
import getStudio from '@theatre/studio/getStudio'
|
import getStudio from '@theatre/studio/getStudio'
|
||||||
|
import {panelZIndexes} from '@theatre/studio/panels/panelZIndexes'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
const Container = styled.div`
|
const Container = styled.div`
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 50;
|
z-index: ${panelZIndexes.toolbar};
|
||||||
|
|
||||||
top: 12px;
|
top: 12px;
|
||||||
right: 12px;
|
right: 12px;
|
||||||
left: 12px;
|
left: 12px;
|
||||||
|
|
Loading…
Reference in a new issue