criação de novas patterns de composição nos projetos

This commit is contained in:
JotaChina committed 2025-12-27 18:50:36 -03:00
1 parent f80d6511a4
commit 2d40bf747f
3 files changed
+118 -23

No files matched your search

+20 -1
View File
@@ -213,8 +213,27 @@ document.addEventListener("DOMContentLoaded", () => {
}
});
//Seleção de pattern
// --- Criar/Remover Pattern (toolbar) ---
const addPatternBtn = document.getElementById("add-pattern-btn");
const removePatternBtn = document.getElementById("remove-pattern-btn");
addPatternBtn?.addEventListener("click", () => {
const refTrack = (appState.pattern.tracks || []).find(t => t.type !== "bassline");
const nextIndex = refTrack?.patterns?.length ?? 0;
const defaultName = `Pattern ${nextIndex + 1}`;
const name = (prompt("Nome do novo pattern:", defaultName) || defaultName).trim();
// cria e já seleciona
sendAction({ type: "ADD_PATTERN", patternIndex: nextIndex, name, select: true });
});
// opcional (se quiser implementar remover depois)
removePatternBtn?.addEventListener("click", () => {
sendAction({ type: "REMOVE_LAST_PATTERN" });
});
//Seleção de pattern
const globalPatternSelector = document.getElementById(
"global-pattern-selector"
);