adicionando instrumentos no editor de patterns
This commit is contained in:
1 parent
1b83beab11
commit
a985798206
1 file changed
+37
-2
@@ -67,6 +67,19 @@ export function renderPatternEditor() {
|
|||||||
title.innerHTML = `<i class="fa-solid ${titleIcon}" style="margin-right:8px"></i> <strong>${contextName}</strong>`;
|
title.innerHTML = `<i class="fa-solid ${titleIcon}" style="margin-right:8px"></i> <strong>${contextName}</strong>`;
|
||||||
navHeader.appendChild(title);
|
navHeader.appendChild(title);
|
||||||
|
|
||||||
|
// não visualizar tracks nem instrumentos sem pattern selecionada
|
||||||
|
const hasSelection = Number.isInteger(appState.pattern.activePatternIndex);
|
||||||
|
if (!isFocusedMode && !hasSelection) {
|
||||||
|
const msg = document.createElement("div");
|
||||||
|
msg.style.padding = "12px";
|
||||||
|
msg.style.color = "#bbb";
|
||||||
|
msg.textContent = "Selecione uma pattern para visualizar/editar.";
|
||||||
|
trackContainer.appendChild(msg);
|
||||||
|
|
||||||
|
updateGlobalPatternSelector();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Botão Voltar (Aparece apenas se estiver dentro de uma Bassline)
|
// Botão Voltar (Aparece apenas se estiver dentro de uma Bassline)
|
||||||
if (isFocusedMode) {
|
if (isFocusedMode) {
|
||||||
const backBtn = document.createElement("button");
|
const backBtn = document.createElement("button");
|
||||||
@@ -183,9 +196,31 @@ export function redrawSequencer() {
|
|||||||
if (!trackData || !trackData.patterns || trackData.patterns.length === 0) return;
|
if (!trackData || !trackData.patterns || trackData.patterns.length === 0) return;
|
||||||
|
|
||||||
const isFocused = !!appState.pattern.focusedBasslineId;
|
const isFocused = !!appState.pattern.focusedBasslineId;
|
||||||
|
const globalIdx = appState.pattern.activePatternIndex;
|
||||||
|
|
||||||
|
// ✅ Song Editor sem pattern selecionada: não mostra composição
|
||||||
|
if (!isFocused && !Number.isInteger(globalIdx)) {
|
||||||
|
// opcional: desenha uma grade "apagada" pra manter o layout
|
||||||
|
for (let i = 0; i < totalGridSteps; i++) {
|
||||||
|
const stepWrapper = document.createElement("div");
|
||||||
|
stepWrapper.className = "step-wrapper";
|
||||||
|
|
||||||
|
const stepElement = document.createElement("div");
|
||||||
|
stepElement.className = "step"; // sem .active
|
||||||
|
stepElement.style.opacity = "0.25";
|
||||||
|
stepElement.style.pointerEvents = "none";
|
||||||
|
|
||||||
|
stepWrapper.appendChild(stepElement);
|
||||||
|
sequencerContainer.appendChild(stepWrapper);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ em foco: se não tiver globalIdx válido, cai no 0 (porque foco sempre edita algo)
|
||||||
const activePatternIndex = isFocused
|
const activePatternIndex = isFocused
|
||||||
? (appState.pattern.activePatternIndex || 0)
|
? (Number.isInteger(globalIdx) ? globalIdx : 0)
|
||||||
: (trackData.activePatternIndex || 0);
|
: globalIdx;
|
||||||
|
|
||||||
|
|
||||||
const activePattern = trackData.patterns[activePatternIndex];
|
const activePattern = trackData.patterns[activePatternIndex];
|
||||||
if (!activePattern) return;
|
if (!activePattern) return;
|
||||||
|
|||||||
Reference in new issue
Block a user