fix: minor updated the region lasso selection behavior

This commit is contained in:
Xiaohan-Tian
2026-05-04 18:34:29 -07:00
parent f323f1a6b5
commit a2f12ca961
3 changed files with 51 additions and 3 deletions
+11
View File
@@ -94,6 +94,7 @@ const MainContent: React.FC<MainContentProps> = ({
// Refs to track pending updates for verification
const pendingUpdates = useRef<Map<string, { trackId: string, regionId: string, startBeat: number, length: number }>>(new Map());
const preventEmptyMainContentDeselectRef = useRef(false);
// Refs for auto-scroll during playback
const mainContentRef = useRef<HTMLDivElement | null>(null);
@@ -632,9 +633,18 @@ const MainContent: React.FC<MainContentProps> = ({
return;
}
if (preventEmptyMainContentDeselectRef.current) {
preventEmptyMainContentDeselectRef.current = false;
return;
}
handleRegionLassoSelection([], { shiftKey: false });
};
const handleRegionLassoCommit = () => {
preventEmptyMainContentDeselectRef.current = true;
};
// Handle region single click: selection only (no piano roll opening)
const handleRegionClick = (regionId: string, options: RegionClickOptions = { shiftKey: false }) => {
if (DEBUG_MODE.MAIN_CONTENT) {
@@ -990,6 +1000,7 @@ const MainContent: React.FC<MainContentProps> = ({
onRegionUpdated={handleRegionUpdated}
onRegionClick={handleRegionClick}
onRegionLassoSelection={handleRegionLassoSelection}
onRegionLassoCommit={handleRegionLassoCommit}
onOpenPianoRoll={handleOpenPianoRoll}
onOpenSpectrogram={handleOpenSpectrogram}
showHybridButtonForAudio={showHybridButtonForAudio}