diff --git a/assets/svgs/download.svg b/assets/svgs/download.svg
new file mode 100644
index 0000000..80a5817
--- /dev/null
+++ b/assets/svgs/download.svg
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/src/AppState.ts b/src/AppState.ts
index df3bc4d..936cbcd 100644
--- a/src/AppState.ts
+++ b/src/AppState.ts
@@ -1,4 +1,4 @@
-import { inject, type InjectionKey, ref } from 'vue';
+import { inject, type InjectionKey, ref } from "vue";
export type UITool =
| "track-unit-type"
@@ -6,9 +6,10 @@ export type UITool =
| "sticking";
export function createAppStateStore() {
- const selectedTool = ref('track-unit-type');
+ const selectedTool = ref("track-unit-type");
const activeTrackUnitType = ref(0);
const activeStickingType = ref(1);
+ const unitMouseStart = ref(null);
const selectingUnits = ref(false);
const deselectingUnits = ref(false);
@@ -18,13 +19,14 @@ export function createAppStateStore() {
selectedTool,
activeTrackUnitType,
activeStickingType,
+ unitMouseStart,
};
}
export type AppStateStore = ReturnType;
-export const AppStateStoreKey = Symbol('AppStateStore') as InjectionKey;
+export const AppStateStoreKey = Symbol("AppStateStore") as InjectionKey;
export function useAppStateStore(): AppStateStore {
return inject(AppStateStoreKey, createAppStateStore, true);
diff --git a/src/Beat.ts b/src/Beat.ts
index db1a38b..102619e 100644
--- a/src/Beat.ts
+++ b/src/Beat.ts
@@ -2,7 +2,12 @@ import { deserialise as deserialiseTrack, type TrackInitOptions, createTrack, is
import { greatestCommonDivisor, isPosInt } from "@/utils";
import { watch, computed, effectScope, ref, shallowRef, triggerRef } from "vue";
+export interface BeatManager {
+ notifyChange(): void;
+}
+
type BeatGroupInitOptions = {
+ manager: BeatManager,
barCount: number;
isLooping: boolean;
timeSigUp: number;
@@ -33,11 +38,12 @@ function isBeatSerial(serial: Record): serial is BeatSerial {
typeof serial.barSettingsLocked === "boolean";
}
-export function deserialise(serial: {}) {
+export function deserialise(serial: {}, manager: BeatManager) {
if (!isBeatSerial(serial)) {
throw new Error("Not a valid beat serial");
}
const newBeat = createBeat({
+ manager,
loopLength: serial.globalLoopLength,
barCount: serial.barCount,
isLooping: serial.globalIsLooping,
@@ -46,7 +52,7 @@ export function deserialise(serial: {}) {
useAutoBeatLength: serial.useAutoBeatLength,
});
serial.tracks.forEach(trackSerial => {
- const track = deserialiseTrack(trackSerial);
+ const track = deserialiseTrack(trackSerial, manager);
if (track) newBeat.tracks.value.push(track);
});
return newBeat;
@@ -55,6 +61,7 @@ export function deserialise(serial: {}) {
export function createBeat(opts: BeatGroupInitOptions) {
const scope = effectScope();
return scope.run(() => {
+ const manager = opts.manager;
const tracks = shallowRef