From 05e2816aecbfdbcff73c599f3cf4e64ae3bea333 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 25 Jul 2021 19:25:35 +0200 Subject: more slide settings --- components/slideprops.tsx | 72 ++++++++++++++++++++++++++++++++++++++--------- components/timeinput.tsx | 2 ++ 2 files changed, 60 insertions(+), 14 deletions(-) (limited to 'components') diff --git a/components/slideprops.tsx b/components/slideprops.tsx index aa118e8..747a1b2 100644 --- a/components/slideprops.tsx +++ b/components/slideprops.tsx @@ -1,22 +1,47 @@ import { State } from '@hookstate/core'; +import InputAdornment from '@material-ui/core/InputAdornment'; import TextField from '@material-ui/core/TextField'; import TimecodeInput from '../components/timeinput'; import { globalState } from '../pages/editor'; import { TimedVideoPlayer } from '../pages/present'; -import { anySlide, loopSlide } from '../timeline'; +import { anySlide, delaySlide, loopSlide, slide, speedChangeSlide } from '../timeline'; + +function SlideTimestamp(props: { + slide: State; + global: State; + player: TimedVideoPlayer; +}) { + return { + props.slide.frame.set(newValue); + props.global.update.refreshLiveTimeline.value(); + }} + player={props.player} + />; +} export default function SlideProperties(props: { slide: State; global: State; player: TimedVideoPlayer; }) { - if (props.slide.value.type == 'default') return null; + function updateProp(key: keyof slideType) { + return (newValue: any) => { // TODO: better typing here + props.slide[key as keyof State].set(newValue); + props.global.update.refreshLiveTimeline.value(); + }; + } return
Properties {{ + 'default': <> + + , 'loop': <> ).frame.get() - (props.slide as State).beginFrame.get()} /> +
).beginFrame.get()} - update={newValue => { - (props.slide as State).frame.set(newValue); - props.global.update.refreshLiveTimeline.value(); - }} + update={updateProp('beginFrame')} player={props.player} /> ).frame.get()} - update={newValue => { - (props.slide as State).frame.set(newValue); - props.global.update.refreshLiveTimeline.value(); - }} + update={updateProp('frame')} player={props.player} /> - , 'delay': <> - + +
+ }} + InputLabelProps={{ shrink: true }} + value={(props.slide as State).delay.get() / 1000} + onChange={event => updateProp('delay')(Number(event.target.value) * 1000)} + /> , 'speedChange': <> - - + +
+ }} + value={(props.slide as State).delay.get()} + onChange={event => updateProp('delay')(Number(event.target.value))} + /> +
+ , }[props.slide.value.type]}
; diff --git a/components/timeinput.tsx b/components/timeinput.tsx index 7232494..f1f3233 100644 --- a/components/timeinput.tsx +++ b/components/timeinput.tsx @@ -6,8 +6,10 @@ export default function TimecodeInput(props: { update: (newValue: number) => void; player: TimedVideoPlayer; label: string; + className?: string; }) { return