feat: cleaned up mouse behaviour and saving

This commit is contained in:
Daniel Ledda
2023-03-12 15:46:18 +01:00
parent e05c95a673
commit e312eedbdc
9 changed files with 309 additions and 199 deletions

View File

@@ -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<UITool>('track-unit-type');
const selectedTool = ref<UITool>("track-unit-type");
const activeTrackUnitType = ref(0);
const activeStickingType = ref(1);
const unitMouseStart = ref<string | null>(null);
const selectingUnits = ref(false);
const deselectingUnits = ref(false);
@@ -18,13 +19,14 @@ export function createAppStateStore() {
selectedTool,
activeTrackUnitType,
activeStickingType,
unitMouseStart,
};
}
export type AppStateStore = ReturnType<typeof createAppStateStore>;
export const AppStateStoreKey = Symbol('AppStateStore') as InjectionKey<AppStateStore>;
export const AppStateStoreKey = Symbol("AppStateStore") as InjectionKey<AppStateStore>;
export function useAppStateStore(): AppStateStore {
return inject(AppStateStoreKey, createAppStateStore, true);