UX improvements for PlayheadPositionPopover
This commit is contained in:
parent
8495c9c808
commit
6c7da6f653
1 changed files with 6 additions and 2 deletions
|
@ -33,7 +33,7 @@ const PlayheadPositionPopover: React.FC<{
|
||||||
* Called when user hits enter/escape
|
* Called when user hits enter/escape
|
||||||
*/
|
*/
|
||||||
onRequestClose: (reason: string) => void
|
onRequestClose: (reason: string) => void
|
||||||
}> = ({layoutP}) => {
|
}> = ({layoutP, onRequestClose}) => {
|
||||||
const sheet = val(layoutP.sheet)
|
const sheet = val(layoutP.sheet)
|
||||||
const sequence = sheet.getSequence()
|
const sequence = sheet.getSequence()
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ const PlayheadPositionPopover: React.FC<{
|
||||||
if (tempPosition) {
|
if (tempPosition) {
|
||||||
tempPosition = undefined
|
tempPosition = undefined
|
||||||
sequence.position = originalPosition
|
sequence.position = originalPosition
|
||||||
|
onRequestClose('discardTemporaryValue')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
permanentlySetValue(newPosition: number): void {
|
permanentlySetValue(newPosition: number): void {
|
||||||
|
@ -60,6 +61,7 @@ const PlayheadPositionPopover: React.FC<{
|
||||||
tempPosition = undefined
|
tempPosition = undefined
|
||||||
}
|
}
|
||||||
sequence.position = clamp(newPosition, 0, sequence.length)
|
sequence.position = clamp(newPosition, 0, sequence.length)
|
||||||
|
onRequestClose('permanentlySetValue')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}, [layoutP, sequence])
|
}, [layoutP, sequence])
|
||||||
|
@ -72,11 +74,13 @@ const PlayheadPositionPopover: React.FC<{
|
||||||
return usePrism(() => {
|
return usePrism(() => {
|
||||||
const sequence = sheet.getSequence()
|
const sequence = sheet.getSequence()
|
||||||
|
|
||||||
|
const value = Number(val(sequence.pointer.position).toFixed(3))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Label>Sequence position</Label>
|
<Label>Sequence position</Label>
|
||||||
<BasicNumberInput
|
<BasicNumberInput
|
||||||
value={Number(sequence.position.toFixed(3))}
|
value={value}
|
||||||
{...fns}
|
{...fns}
|
||||||
isValid={greaterThanOrEqualToZero}
|
isValid={greaterThanOrEqualToZero}
|
||||||
inputRef={inputRef}
|
inputRef={inputRef}
|
||||||
|
|
Loading…
Reference in a new issue