melhorando a leitura de projetos no mmpCreator

This commit is contained in:
JotaChina committed 2025-12-25 15:47:10 -03:00
1 parent 9381152327
commit b1efb7d51c
3 files changed
+32 -4

No files matched your search

+13
View File
@@ -976,6 +976,19 @@ async function handleActionBroadcast(action) {
track.activePatternIndex = patternIndex;
});
try {
const maxSteps = appState.pattern.tracks
.filter(t => t.type !== "bassline")
.map(t => t.patterns?.[patternIndex]?.steps?.length || 0)
.reduce((a, b) => Math.max(a, b), 0);
const barsEl = document.getElementById("bars-input");
if (barsEl && maxSteps > 0) {
// assumindo 16 steps por compasso (4/4 em 1/16)
barsEl.value = Math.max(1, Math.ceil(maxSteps / 16));
}
} catch {}
// Mostra o toast (só uma vez)
if (!isFromSelf) {
const who = actorOf(action);