-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from Joery-M/35-sl-uisharedtimeline-playback
35 sl uisharedtimeline playback
- Loading branch information
Showing
32 changed files
with
6,317 additions
and
7,734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare const __TEST__: boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,8 @@ export default defineConfig({ | |
name: 'darkroom' | ||
}, | ||
sourcemap: true | ||
}, | ||
define: { | ||
__TEST__: false | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/safelight/src/components/Editor/Timeline/PlaybackControls.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<template> | ||
<template v-if="timeline"> | ||
<Timecode /> | ||
<ButtonGroup> | ||
<Button | ||
severity="secondary" | ||
aria-label="Skip back 1 frame" | ||
@click="if (!timeline.isPlaying.value) timeline.stepPlayback(true);" | ||
> | ||
<template #icon> | ||
<PhSkipBack /> | ||
</template> | ||
</Button> | ||
<Button | ||
severity="secondary" | ||
:aria-label="timeline.isPlaying.value ? 'Stop playback' : 'Start playback'" | ||
@click="playPause" | ||
> | ||
<template #icon> | ||
<PhPause v-if="timeline.isPlaying.value" /> | ||
<PhPlay v-else /> | ||
</template> | ||
</Button> | ||
<Button | ||
severity="secondary" | ||
aria-label="Skip forward 1 frame" | ||
@click="if (!timeline.isPlaying.value) timeline.stepPlayback();" | ||
> | ||
<template #icon> | ||
<PhSkipForward /> | ||
</template> | ||
</Button> | ||
</ButtonGroup> | ||
</template> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import ButtonGroup from 'primevue/buttongroup'; | ||
const { project } = CurrentProject; | ||
const timeline = computed(() => | ||
project.value?.timeline.value?.isSimpleTimeline() ? project.value.timeline.value : undefined | ||
); | ||
function playPause(ev: MouseEvent) { | ||
if (timeline.value) { | ||
if (timeline.value.isPlaying.value) { | ||
timeline.value.stopPlayback(ev.ctrlKey); | ||
} else { | ||
timeline.value.startPlayback(); | ||
} | ||
} | ||
} | ||
</script> |
43 changes: 43 additions & 0 deletions
43
packages/safelight/src/components/Editor/Timeline/Timecode.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template> | ||
<Inplace ref="inplace" closable> | ||
<template #display> | ||
{{ Timecode.toFormattedTimecode(timecodeVal) }} | ||
</template> | ||
<template #content> | ||
<InputMask | ||
v-focustrap | ||
:slot-char="Timecode.toFormattedTimecode(timecodeVal)" | ||
mask="99:99:99.999" | ||
@change="onChange" | ||
/> | ||
</template> | ||
</Inplace> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import Timecode from '@safelight/shared/Timecode'; | ||
import type Inplace from 'primevue/inplace'; | ||
const timeline = CurrentProject.project.value!.timeline; | ||
const timecodeVal = computed(() => | ||
timeline.value | ||
? Timecode.fromFrames(timeline.value.pbPos.value, timeline.value.framerate.value) | ||
: 0 | ||
); | ||
const inplace = ref<Inplace>(); | ||
function onChange(ev: Event) { | ||
const val = (ev.target as HTMLInputElement)?.value; | ||
console.log(val); | ||
if (val) { | ||
const res = Timecode.fromFormattedTimecode(val); | ||
console.log(res); | ||
timeline.value!.pbPos.value = Math.round(res / timeline.value!.framerate.value); | ||
} | ||
if (inplace.value) { | ||
inplace.value.$emit('close', new Event('close')); | ||
inplace.value.$props.active = false; | ||
} | ||
} | ||
</script> |
58 changes: 39 additions & 19 deletions
58
packages/safelight/src/components/Editor/Timeline/Timeline.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.