UX improvements
* SequenceLengthIndicator has a cleaner look * It displays the time in the basic format now
This commit is contained in:
parent
314e46c6cf
commit
6d52d5d485
3 changed files with 65 additions and 25 deletions
|
@ -293,6 +293,7 @@ export interface ISequencePositionFormatter {
|
||||||
formatSubUnitForGrid(posInUnitSpace: number): string
|
formatSubUnitForGrid(posInUnitSpace: number): string
|
||||||
formatFullUnitForGrid(posInUnitSpace: number): string
|
formatFullUnitForGrid(posInUnitSpace: number): string
|
||||||
formatForPlayhead(posInUnitSpace: number): string
|
formatForPlayhead(posInUnitSpace: number): string
|
||||||
|
formatBasic(posInUnitSpace: number): string
|
||||||
}
|
}
|
||||||
|
|
||||||
class TimeBasedPositionFormatter implements ISequencePositionFormatter {
|
class TimeBasedPositionFormatter implements ISequencePositionFormatter {
|
||||||
|
@ -382,6 +383,10 @@ class TimeBasedPositionFormatter implements ISequencePositionFormatter {
|
||||||
|
|
||||||
return s.length === 0 ? '00s00f' : s
|
return s.length === 0 ? '00s00f' : s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
formatBasic(posInUnitSpace: number): string {
|
||||||
|
return posInUnitSpace.toFixed(2) + 's'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const second = 1
|
const second = 1
|
||||||
|
|
|
@ -66,7 +66,6 @@ const Dot: React.FC<IProps> = (props) => {
|
||||||
<>
|
<>
|
||||||
<HitZone
|
<HitZone
|
||||||
ref={ref}
|
ref={ref}
|
||||||
title={props.keyframe.position.toFixed(8)}
|
|
||||||
data-pos={props.keyframe.position.toFixed(3)}
|
data-pos={props.keyframe.position.toFixed(3)}
|
||||||
{...{
|
{...{
|
||||||
[attributeNameThatLocksFramestamp]:
|
[attributeNameThatLocksFramestamp]:
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {
|
||||||
attributeNameThatLocksFramestamp,
|
attributeNameThatLocksFramestamp,
|
||||||
useLockFrameStampPosition,
|
useLockFrameStampPosition,
|
||||||
} from '@theatre/studio/panels/SequenceEditorPanel/FrameStampPositionProvider'
|
} from '@theatre/studio/panels/SequenceEditorPanel/FrameStampPositionProvider'
|
||||||
|
import {GoChevronLeft, GoChevronRight} from 'react-icons/all'
|
||||||
|
|
||||||
const coverWidth = 1000
|
const coverWidth = 1000
|
||||||
|
|
||||||
|
@ -50,23 +51,61 @@ const Strip = styled.div`
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const Bulge = styled.div`
|
const ThumbContainer = styled.div`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: ${topStripHeight + 4}px;
|
top: ${topStripHeight - 15}px;
|
||||||
|
width: 100px;
|
||||||
|
left: -50px;
|
||||||
|
pointer-events: none;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 1;
|
||||||
|
`
|
||||||
|
|
||||||
|
const Tooltip = styled.div`
|
||||||
|
margin-top: 8px;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
left: 0px;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding: 2px 8px 2px 8px;
|
padding: 1px 8px;
|
||||||
border-radius: 0 2px 2px 0;
|
border-radius: 0 2px 2px 0;
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
cursor: ew-resize;
|
cursor: ew-resize;
|
||||||
color: #555;
|
|
||||||
color: #464646;
|
color: #464646;
|
||||||
background-color: #0000004d;
|
background-color: #0000004d;
|
||||||
|
display: none;
|
||||||
|
|
||||||
|
${Strip}:hover &, ${Strip}.dragging & {
|
||||||
|
display: block;
|
||||||
|
color: white;
|
||||||
|
background-color: ${colors.stripActive};
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const Tumb = styled.div`
|
||||||
|
font-size: 10px;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding: 1px 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
pointer-events: auto;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
cursor: ew-resize;
|
||||||
|
color: #5d5d5d;
|
||||||
|
background-color: #191919;
|
||||||
|
|
||||||
${Strip}:hover &, ${Strip}.dragging & {
|
${Strip}:hover &, ${Strip}.dragging & {
|
||||||
color: white;
|
color: white;
|
||||||
background-color: ${colors.stripActive};
|
background-color: ${colors.stripActive};
|
||||||
|
|
||||||
|
& > svg:first-child {
|
||||||
|
margin-right: -1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& > svg:first-child {
|
||||||
|
margin-right: -4px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -121,34 +160,31 @@ const LengthIndicator: React.FC<IProps> = ({layoutP}) => {
|
||||||
<>
|
<>
|
||||||
{popoverNode}
|
{popoverNode}
|
||||||
<Strip
|
<Strip
|
||||||
title="Change Sequence Length"
|
|
||||||
style={{
|
style={{
|
||||||
height: height + 'px',
|
height: height + 'px',
|
||||||
transform: `translateX(${translateX === 0 ? -1000 : translateX}px)`,
|
transform: `translateX(${translateX === 0 ? -1000 : translateX}px)`,
|
||||||
}}
|
}}
|
||||||
className={val(isDraggingD) ? 'dragging' : ''}
|
className={val(isDraggingD) ? 'dragging' : ''}
|
||||||
>
|
>
|
||||||
<Bulge
|
<ThumbContainer>
|
||||||
|
<Tumb
|
||||||
ref={nodeRef}
|
ref={nodeRef}
|
||||||
title="Length of the sequence (sequence.length)"
|
title="Length of the sequence. Drag or click to change."
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
openPopover(e, node!)
|
openPopover(e, node!)
|
||||||
}}
|
}}
|
||||||
{...{[attributeNameThatLocksFramestamp]: 'hide'}}
|
{...{[attributeNameThatLocksFramestamp]: 'hide'}}
|
||||||
>
|
>
|
||||||
{sequence.positionFormatter.formatForPlayhead(sequenceLength)}
|
<GoChevronLeft />
|
||||||
</Bulge>
|
<GoChevronRight />
|
||||||
|
</Tumb>
|
||||||
|
<Tooltip>
|
||||||
|
{sequence.positionFormatter.formatBasic(sequenceLength)}
|
||||||
|
</Tooltip>
|
||||||
|
</ThumbContainer>
|
||||||
</Strip>
|
</Strip>
|
||||||
<Cover
|
<Cover
|
||||||
title="Length"
|
title="Length"
|
||||||
// onClick={() => {
|
|
||||||
// getStudio()!.transaction(({stateEditors}) => {
|
|
||||||
// stateEditors.coreByProject.historic.sheetsById.sequence.setLength({
|
|
||||||
// ...sheet.address,
|
|
||||||
// length: 10,
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// }}
|
|
||||||
style={{
|
style={{
|
||||||
height: height + 'px',
|
height: height + 'px',
|
||||||
transform: `translateX(${translateX}px) scale(${scaleX}, 1)`,
|
transform: `translateX(${translateX}px) scale(${scaleX}, 1)`,
|
||||||
|
|
Loading…
Reference in a new issue