From a353c74f85fbeda5864b3f9cf1d40dc9b5a9601d Mon Sep 17 00:00:00 2001 From: Sig <62321214+sigprogramming@users.noreply.github.com> Date: Wed, 22 Jan 2025 22:20:34 +0900 Subject: [PATCH] =?UTF-8?q?Store=E3=81=8B=E3=82=89Pick=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stateMachine/sequencerStateMachine.ts | 60 +++++++------------ 1 file changed, 21 insertions(+), 39 deletions(-) diff --git a/src/sing/stateMachine/sequencerStateMachine.ts b/src/sing/stateMachine/sequencerStateMachine.ts index 87c4e52b02..f901a15125 100644 --- a/src/sing/stateMachine/sequencerStateMachine.ts +++ b/src/sing/stateMachine/sequencerStateMachine.ts @@ -22,11 +22,12 @@ import { isSelfEventTarget, PREVIEW_SOUND_DURATION, } from "@/sing/viewHelper"; -import { Note, SequencerEditTarget, Track } from "@/store/type"; +import { Note, SequencerEditTarget } from "@/store/type"; import { NoteId, TrackId } from "@/type/preload"; import { getOrThrow } from "@/helpers/mapHelper"; import { isOnCommandOrCtrlKeyDown } from "@/store/utility"; import { getNoteDuration } from "@/sing/domain"; +import { Store } from "@/store"; export type PositionOnSequencer = { readonly x: number; @@ -84,44 +85,25 @@ type Refs = { }; type PartialStore = { - state: { - tpqn: number; - sequencerSnapType: number; - sequencerEditTarget: SequencerEditTarget; - editorFrameRate: number; - }; - getters: { - SELECTED_TRACK_ID: TrackId; - SELECTED_TRACK: Track; - SELECTED_NOTE_IDS: Set; - }; - actions: { - SELECT_NOTES: (payload: { noteIds: NoteId[] }) => Promise; - DESELECT_NOTES: (payload: { noteIds: NoteId[] }) => Promise; - DESELECT_ALL_NOTES: () => Promise; - PLAY_PREVIEW_SOUND: (payload: { - noteNumber: number; - duration?: number; - }) => Promise; - COMMAND_ADD_NOTES: (payload: { - notes: Note[]; - trackId: TrackId; - }) => Promise; - COMMAND_UPDATE_NOTES: (payload: { - notes: Note[]; - trackId: TrackId; - }) => Promise; - COMMAND_SET_PITCH_EDIT_DATA: (payload: { - pitchArray: number[]; - startFrame: number; - trackId: TrackId; - }) => Promise; - COMMAND_ERASE_PITCH_EDIT_DATA: (payload: { - startFrame: number; - frameLength: number; - trackId: TrackId; - }) => Promise; - }; + state: Pick< + Store["state"], + "tpqn" | "sequencerSnapType" | "sequencerEditTarget" | "editorFrameRate" + >; + getters: Pick< + Store["getters"], + "SELECTED_TRACK_ID" | "SELECTED_TRACK" | "SELECTED_NOTE_IDS" + >; + actions: Pick< + Store["actions"], + | "SELECT_NOTES" + | "DESELECT_NOTES" + | "DESELECT_ALL_NOTES" + | "PLAY_PREVIEW_SOUND" + | "COMMAND_ADD_NOTES" + | "COMMAND_UPDATE_NOTES" + | "COMMAND_SET_PITCH_EDIT_DATA" + | "COMMAND_ERASE_PITCH_EDIT_DATA" + >; }; type Context = ComputedRefs & Refs & { readonly store: PartialStore };