FIX: sửa lỗi phát hiện đã không còn play midi note để PIANO ROLL TAB quay về vị trí 0
This commit is contained in:
@@ -14925,6 +14925,24 @@ const App = () => {
|
||||
|
||||
const [selectionCleared, setSelectionCleared] = useState(false); // LOOP_EDITOR_2.md §4.2
|
||||
|
||||
// Detect MAIN/SECTION play vừa DỪNG (hết notes/projectEnd/stop): nếu đang ở
|
||||
// PIANO ROLL tab (không play tab) → playhead về 0 — user: main play hết →
|
||||
// không còn midi note → piano roll phải về đầu (không giữ local cuối).
|
||||
const prevIsPlayingRef = useRef(false);
|
||||
useEffect(() => {
|
||||
const wasPlaying = prevIsPlayingRef.current;
|
||||
prevIsPlayingRef.current = isPlaying;
|
||||
if (wasPlaying && !isPlaying) {
|
||||
const _tabId = activeTabRef.current;
|
||||
if (_tabId && _tabId.startsWith('midi_')) {
|
||||
const _prSt = subTabsRef.current.find(s => s.id === _tabId);
|
||||
if (_prSt && !_prSt.isPlaying) {
|
||||
setSubTabs(prev => prev.map(s => s.id === _tabId ? { ...s, currentTime: 0 } : s));
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [isPlaying]);
|
||||
|
||||
const midiVuActivityRef = useRef({});
|
||||
const triggerMidiVuActivity = (trackId, velocity) => {
|
||||
if (!trackId) return;
|
||||
|
||||
Reference in New Issue
Block a user