fix timeline not updating from outside seeks

This commit is contained in:
Robin Appelman 2024-12-02 23:53:31 +01:00
commit 8a651088ff

View file

@ -7,12 +7,15 @@ export interface TimelineProps {
disabled?: boolean; disabled?: boolean;
} }
export const Timeline = ({parser, tick, onSetTick, disabled}) => { export const Timeline = (props: TimelineProps) => {
const parser = props.parser;
const background = <TimeLineBackground parser={parser}/>; const background = <TimeLineBackground parser={parser}/>;
return <div class="timeline"> return <div class="timeline">
<input max={parser.demo.tickCount} value={tick} class="timeline-progress" type="range" min={0} <input max={parser.demo.tickCount} value={props.tick} class="timeline-progress" type="range" min={0}
onChange={(event) => {onSetTick(parseInt(event.target.value, 10))}} onChange={(event) => {
disabled={disabled} props.onSetTick(parseInt(event.target.value, 10))
}}
disabled={props.disabled}
/> />
{background} {background}
</div>; </div>;