feat: implemented editable automation lane in piano roll window

This commit is contained in:
Xiaohan-Tian
2026-05-08 14:39:45 -07:00
parent eead27dbd8
commit 6e5d9466f4
7 changed files with 1010 additions and 179 deletions
+20 -1
View File
@@ -41,6 +41,19 @@ export const useNoteSelection = ({
// Get KGCore instance
const core = KGCore.instance();
const deselectAutomationEvents = () => {
if (!activeRegion) return;
activeRegion.getPitchBends().forEach(pitchBend => {
pitchBend.deselect();
});
activeRegion.getControllerEventsByType().forEach(events => {
events.forEach(controllerEvent => {
controllerEvent.deselect();
});
});
};
// Handle note click for selection
const handleNoteClick = (noteId: string, e: React.MouseEvent) => {
@@ -58,6 +71,8 @@ export const useNoteSelection = ({
if (DEBUG_MODE.PIANO_ROLL) {
console.log(`NOTE CLICKED: noteId=${noteId}, shift key: ${e.shiftKey}`);
}
deselectAutomationEvents();
// Create a new Set for selected note IDs
let newSelectedNoteIds: Set<string>;
@@ -110,6 +125,7 @@ export const useNoteSelection = ({
// Clear KGCore selection using store method
clearAllSelections();
deselectAutomationEvents();
// Create new selection with only this note
newSelectedNoteIds = new Set([noteId]);
@@ -191,6 +207,8 @@ export const useNoteSelection = ({
if (DEBUG_MODE.PIANO_ROLL) {
console.log('Starting box selection');
}
deselectAutomationEvents();
// Store shift key state for box selection
isShiftKeyPressedRef.current = e.shiftKey;
@@ -295,6 +313,7 @@ export const useNoteSelection = ({
// Clear KGCore selection using store method
clearAllSelections();
deselectAutomationEvents();
// Start with empty selection
newSelectedNoteIds = new Set<string>();
@@ -444,4 +463,4 @@ export const useNoteSelection = ({
handleBackgroundMouseDown,
cleanupSelectionListeners
};
};
};