feat: add keyboard-based mouse action helper with Zustand integration
- Implemented `mouseActionHelper.ts` to track modifier keys (e.g. CONTROL, SHIFT) - Dynamically constructs mouse+modifier combos (e.g. left+CONTROL) - Updates Zustand store (`useMouseNoteStore`) with appropriate notes - Supports multi-key combinations and cleans up listeners on unmount
This commit is contained in:
@@ -24,3 +24,30 @@ export const usePlayerStore = create<PlayerState>((set) => ({
|
||||
hidePlayer: false, // initial state
|
||||
setHidePlayer: (hide) => set({ hidePlayer: hide }), // state updater
|
||||
}));
|
||||
|
||||
interface MouseNoteState {
|
||||
Leftnote: string;
|
||||
Middlenote: string;
|
||||
Rightnote: string;
|
||||
setNotes: (notes: {
|
||||
Leftnote: string;
|
||||
Middlenote: string;
|
||||
Rightnote: string;
|
||||
}) => void;
|
||||
setLeftnote: (note: string) => void;
|
||||
setMiddlenote: (note: string) => void;
|
||||
setRightnote: (note: string) => void;
|
||||
resetNotes: () => void;
|
||||
}
|
||||
|
||||
export const useMouseNoteStore = create<MouseNoteState>((set) => ({
|
||||
Leftnote: '',
|
||||
Middlenote: '',
|
||||
Rightnote: '',
|
||||
setNotes: (notes) => set(notes),
|
||||
setLeftnote: (note) => set({ Leftnote: note }),
|
||||
setMiddlenote: (note) => set({ Middlenote: note }),
|
||||
setRightnote: (note) => set({ Rightnote: note }),
|
||||
resetNotes: () =>
|
||||
set({ Leftnote: '', Middlenote: '', Rightnote: '' }),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user