feat: added a hotkey for loop button

This commit is contained in:
Xiaohan-Tian
2026-01-22 19:05:22 -08:00
parent b80e7e84b8
commit 78b798e138
6 changed files with 79 additions and 43 deletions
+7
View File
@@ -12,6 +12,7 @@ import { KGRegion } from '../core/region/KGRegion';
import { AddTrackCommand, RemoveTrackCommand, ReorderTracksCommand, UpdateTrackCommand, type TrackUpdateProperties, PasteRegionsCommand, PasteNotesCommand, ChangeProjectPropertyCommand } from '../core/commands';
import { ConfigManager } from '../core/config/ConfigManager';
import { upgradeProjectToLatest } from '../core/project-upgrader/KGProjectUpgrader';
import { toggleLoop } from '../util/loopUtil';
/**
* Update CSS custom property for time signature numerator
@@ -86,6 +87,7 @@ interface ProjectState {
setPlayheadPosition: (position: number) => void;
startPlaying: () => Promise<void>;
stopPlaying: () => Promise<void>;
toggleLoop: () => void;
setBpm: (bpm: number) => void;
setMaxBars: (maxBars: number) => void;
setTimeSignature: (timeSignature: TimeSignature) => void;
@@ -570,6 +572,11 @@ export const useProjectStore = create<ProjectState>((set, get) => {
set({ isPlaying: false });
},
toggleLoop: () => {
const { isLooping, loopingRange, maxBars } = get();
toggleLoop(isLooping, loopingRange, maxBars);
},
setBpm: (bpm: number) => {
try {
// Create and execute the change project property command