FIX: sửa lỗi khi quét chọn duration để loop và khi bật nút loop thì tự động giãn ra bar 18
This commit is contained in:
+27
-17
@@ -17610,6 +17610,9 @@ const App = () => {
|
||||
setSelectedTrackId(trackId);
|
||||
captureSelectionUndo();
|
||||
clearLocalSelection();
|
||||
// A fresh region selection re-enables selection-looping (a previous
|
||||
// Ctrl+click "clear selection" must not keep blocking the new region).
|
||||
setSelectionCleared(false);
|
||||
localSelectionAnchorRef.current = time;
|
||||
setSelectionMode('local');
|
||||
setLocalSelectionTrackId(trackId);
|
||||
@@ -22525,24 +22528,31 @@ const App = () => {
|
||||
setSubTabs(prev => prev.map(s => s.id === activeTab ? { ...s, selectionStart: 0, selectionEnd: loopEndTime } : s));
|
||||
}
|
||||
} else {
|
||||
// Main timeline: auto-derive loop end from tracks
|
||||
const bpmVal = parseInt(bpm) || 120;
|
||||
const secPerBar = (60.0 / bpmVal) * 4;
|
||||
let maxEnd = 0;
|
||||
activeTracks.forEach(t => {
|
||||
(t.clips || []).forEach(c => {
|
||||
const end = (c.startTime || 0) + (c.duration || 0);
|
||||
if (end > maxEnd) maxEnd = end;
|
||||
// Main timeline / section tab: if the user already selected a loop
|
||||
// region, KEEP it — only auto-derive (0 → content end) when no
|
||||
// selection exists yet. Previously this always overwrote the
|
||||
// selection with 0 → (contentEnd + 2 bars).
|
||||
const hasSel = (selectionMode === 'local' && selLeft !== null && selRight !== null && selRight > selLeft)
|
||||
|| (selectionStart !== null && selectionEnd !== null && selectionEnd > selectionStart);
|
||||
if (!hasSel) {
|
||||
const bpmVal = parseInt(bpm) || 120;
|
||||
const secPerBar = (60.0 / bpmVal) * 4;
|
||||
let maxEnd = 0;
|
||||
activeTracks.forEach(t => {
|
||||
(t.clips || []).forEach(c => {
|
||||
const end = (c.startTime || 0) + (c.duration || 0);
|
||||
if (end > maxEnd) maxEnd = end;
|
||||
});
|
||||
(t.items || []).forEach(it => {
|
||||
const end = (it.start || 0) + (it.duration || 4);
|
||||
if (end > maxEnd) maxEnd = end;
|
||||
});
|
||||
});
|
||||
(t.items || []).forEach(it => {
|
||||
const end = (it.start || 0) + (it.duration || 4);
|
||||
if (end > maxEnd) maxEnd = end;
|
||||
});
|
||||
});
|
||||
if (maxEnd > 0) {
|
||||
const loopEnd = maxEnd + secPerBar * 2;
|
||||
setSelectionStart(0);
|
||||
setSelectionEnd(loopEnd);
|
||||
if (maxEnd > 0) {
|
||||
const loopEnd = maxEnd + secPerBar * 2;
|
||||
setSelectionStart(0);
|
||||
setSelectionEnd(loopEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -24,7 +24,7 @@
|
||||
<script src="/static/js/services/midiExtractor.js?v=202607281052"></script>
|
||||
<script src="/static/js/services/promptTemplateManager.js?v=202607281039"></script>
|
||||
<script src="/static/js/services/undoRedoEngine.js?v=202607290941"></script>
|
||||
<script src="/static/js/app.precompiled.js?v=202608033000" defer></script>
|
||||
<script src="/static/js/app.precompiled.js?v=202608033200" defer></script>
|
||||
<link rel="stylesheet" href="/static/css/styles.css?v=202607271016">
|
||||
<style>
|
||||
:root {
|
||||
|
||||
Reference in New Issue
Block a user