diff --git a/src/BeatStore.ts b/src/BeatStore.ts index 3b2ec22..2ad1493 100644 --- a/src/BeatStore.ts +++ b/src/BeatStore.ts @@ -20,7 +20,7 @@ export function createBeatStore() { const activeBeatIndex = ref(0); const activeBeat = computed(() => beats.value[activeBeatIndex.value] ?? null); const autoSave = ref(true); - const orientation = ref<'horizontal' | 'vertical' | null>(null); + const orientation = ref<'horizontal' | 'vertical'>('horizontal'); function resetActiveBeat(): void { const current = activeBeat.value; @@ -51,7 +51,7 @@ export function createBeatStore() { localStorage.setItem("drum-slayer-save", JSON.stringify({ beats: serials, activeBeatIndex: activeBeatIndex.value, - orientation: orientation.value, + orientation: orientation.value ?? 'horizontal', })); } } diff --git a/src/Track.ts b/src/Track.ts index 75df630..1d0272a 100644 --- a/src/Track.ts +++ b/src/Track.ts @@ -39,7 +39,7 @@ export function isValidTimeSigRange(sig: number): boolean { } function isTrackSerial(serial: any): serial is TrackSerial { - const correctTypes = typeof serial.name === "string" && + const correctTypes = typeof serial.name === "string" && typeof serial.timeSigUp === "number" && typeof serial.timeSigDown === "number" && typeof serial.units === "object" && @@ -84,7 +84,7 @@ export function createTrack(options: TrackInitOptions) { const scope = effectScope(); return scope.run(() => { const name = ref(options.name ?? 'New Track'); - const timeSig = reactive({ up: 4, down: 4 }); + const timeSig = reactive({ up: options.timeSig?.up ?? 4, down: options.timeSig?.down ?? 4 }); const timeSigUp = computed({ get() { return timeSig.up; @@ -105,7 +105,7 @@ export function createTrack(options: TrackInitOptions) { } }, }); - const unitRecord = shallowRef([]); + const unitRecord = shallowRef(options.units ?? []); const barCount = ref(options.barCount ?? 4); const loopLengthInternal = ref(options?.loopLength ?? timeSigUp.value * barCount.value); const loopLength = computed({ diff --git a/src/ui/Beat/Beat.vue b/src/ui/Beat/Beat.vue index ad94e22..fd39aac 100644 --- a/src/ui/Beat/Beat.vue +++ b/src/ui/Beat/Beat.vue @@ -1,6 +1,6 @@ -"