From 7e0e06fd24802401f0402a6c5ad224708a6bbac3 Mon Sep 17 00:00:00 2001 From: tillvit Date: Mon, 14 Oct 2024 13:27:44 -0400 Subject: [PATCH] Add toggle Edit/Add Timing keybinds --- app/src/data/KeybindData.ts | 144 ++++++------------------------------ 1 file changed, 24 insertions(+), 120 deletions(-) diff --git a/app/src/data/KeybindData.ts b/app/src/data/KeybindData.ts index 1d461426..71764e0f 100644 --- a/app/src/data/KeybindData.ts +++ b/app/src/data/KeybindData.ts @@ -1058,126 +1058,6 @@ export const KEYBIND_DATA: { [key: string]: Keybind } = { }) }, }, - // quantize4th: { - // label: "4ths", - // bindLabel: "Quantize to 4ths", - // combos: [], - // disabled: app => - // app.chartManager.selection.notes.length == 0 || - // app.chartManager.getMode() != EditMode.Edit, - // callback: app => { - // app.chartManager.modifySelection(note => { - // note.beat = app.chartManager.getClosestTick(note.beat, 4) - // note.beat = Math.round(note.beat * 48) / 48 - // return note - // }) - // }, - // }, - // quantize8th: { - // label: "8ths", - // bindLabel: "Quantize to 8ths", - // combos: [], - // disabled: app => - // app.chartManager.selection.notes.length == 0 || - // app.chartManager.getMode() != EditMode.Edit, - // callback: app => { - // app.chartManager.modifySelection(note => { - // note.beat = app.chartManager.getClosestTick(note.beat, 8) - // note.beat = Math.round(note.beat * 48) / 48 - // return note - // }) - // }, - // }, - // quantize12th: { - // label: "12ths", - // bindLabel: "Quantize to 12ths", - // combos: [], - // disabled: app => - // app.chartManager.selection.notes.length == 0 || - // app.chartManager.getMode() != EditMode.Edit, - // callback: app => { - // app.chartManager.modifySelection(note => { - // note.beat = app.chartManager.getClosestTick(note.beat, 12) - // note.beat = Math.round(note.beat * 48) / 48 - // return note - // }) - // }, - // }, - // quantize16th: { - // label: "16ths", - // bindLabel: "Quantize to 16ths", - // combos: [], - // disabled: app => - // app.chartManager.selection.notes.length == 0 || - // app.chartManager.getMode() != EditMode.Edit, - // callback: app => { - // app.chartManager.modifySelection(note => { - // note.beat = app.chartManager.getClosestTick(note.beat, 16) - // note.beat = Math.round(note.beat * 48) / 48 - // return note - // }) - // }, - // }, - // quantize24th: { - // label: "24ths", - // bindLabel: "Quantize to 24ths", - // combos: [], - // disabled: app => - // app.chartManager.selection.notes.length == 0 || - // app.chartManager.getMode() != EditMode.Edit, - // callback: app => { - // app.chartManager.modifySelection(note => { - // note.beat = app.chartManager.getClosestTick(note.beat, 24) - // note.beat = Math.round(note.beat * 48) / 48 - // return note - // }) - // }, - // }, - // quantize32nd: { - // label: "32nds", - // bindLabel: "Quantize to 32nds", - // combos: [], - // disabled: app => - // app.chartManager.selection.notes.length == 0 || - // app.chartManager.getMode() != EditMode.Edit, - // callback: app => { - // app.chartManager.modifySelection(note => { - // note.beat = app.chartManager.getClosestTick(note.beat, 32) - // note.beat = Math.round(note.beat * 48) / 48 - // return note - // }) - // }, - // }, - // quantize48th: { - // label: "48ths", - // bindLabel: "Quantize to 48ths", - // combos: [], - // disabled: app => - // app.chartManager.selection.notes.length == 0 || - // app.chartManager.getMode() != EditMode.Edit, - // callback: app => { - // app.chartManager.modifySelection(note => { - // note.beat = app.chartManager.getClosestTick(note.beat, 48) - // note.beat = Math.round(note.beat * 48) / 48 - // return note - // }) - // }, - // }, - // quantize96th: { - // label: "96ths", - // bindLabel: "Quantize to 96ths", - // combos: [], - // disabled: app => - // app.chartManager.selection.notes.length == 0 || - // app.chartManager.getMode() != EditMode.Edit, - // callback: app => { - // app.chartManager.modifySelection(note => { - // note.beat = app.chartManager.getClosestTick(note.beat, 96) - // note.beat = Math.round(note.beat * 48) / 48 - // return note - // }) - // }, - // }, delete: { label: "Delete", combos: [ @@ -1397,6 +1277,30 @@ export const KEYBIND_DATA: { [key: string]: Keybind } = { } }, }, + toggleEditTiming: { + label: "Toggle Edit Timing", + combos: [{ key: "T", mods: [] }], + disabled: app => !app.chartManager.chartView, + callback: app => { + if (app.chartManager.editTimingMode != EditTimingMode.Off) { + app.chartManager.editTimingMode = EditTimingMode.Off + } else { + app.chartManager.editTimingMode = EditTimingMode.Edit + } + }, + }, + toggleAddTiming: { + label: "Toggle Add Timing", + combos: [{ key: "T", mods: [Modifier.ALT] }], + disabled: app => !app.chartManager.chartView, + callback: app => { + if (app.chartManager.editTimingMode != EditTimingMode.Add) { + app.chartManager.editTimingMode = EditTimingMode.Add + } else { + app.chartManager.editTimingMode = EditTimingMode.Edit + } + }, + }, } // Dynamically add keybinds