Better toggle for the graph editor
This commit is contained in:
parent
6558514852
commit
aec53b25d1
1 changed files with 28 additions and 2 deletions
|
@ -5,6 +5,7 @@ import getStudio from '@theatre/studio/getStudio'
|
||||||
import React, {useCallback} from 'react'
|
import React, {useCallback} from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import type {SequenceEditorPanelLayout} from '@theatre/studio/panels/SequenceEditorPanel/layout/layout'
|
import type {SequenceEditorPanelLayout} from '@theatre/studio/panels/SequenceEditorPanel/layout/layout'
|
||||||
|
import {VscTriangleUp} from 'react-icons/all'
|
||||||
|
|
||||||
const Container = styled.button`
|
const Container = styled.button`
|
||||||
outline: none;
|
outline: none;
|
||||||
|
@ -17,7 +18,7 @@ const Container = styled.button`
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
padding: 0 8px;
|
padding: 4px 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
color: #656d77;
|
color: #656d77;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
|
@ -26,6 +27,23 @@ const Container = styled.button`
|
||||||
&:hover {
|
&:hover {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& > svg {
|
||||||
|
transition: transform 0.3s;
|
||||||
|
transform: rotateZ(0deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover > svg {
|
||||||
|
transform: rotateZ(-20deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.open > svg {
|
||||||
|
transform: rotateZ(-180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.open:hover > svg {
|
||||||
|
transform: rotateZ(-160deg);
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const GraphEditorToggle: React.FC<{
|
const GraphEditorToggle: React.FC<{
|
||||||
|
@ -41,7 +59,15 @@ const GraphEditorToggle: React.FC<{
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}, [layoutP])
|
}, [layoutP])
|
||||||
return <Container onClick={toggle}>Graph Editor</Container>
|
return (
|
||||||
|
<Container
|
||||||
|
onClick={toggle}
|
||||||
|
title={'Toggle graph editor'}
|
||||||
|
className={isOpen ? 'open' : ''}
|
||||||
|
>
|
||||||
|
<VscTriangleUp />
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GraphEditorToggle
|
export default GraphEditorToggle
|
||||||
|
|
Loading…
Reference in a new issue