melhorando a leitura de projetos no mmpCreator
This commit is contained in:
1 parent
55e9aa868d
commit
d87b5ea07a
7 files changed
+386967
-370721
No files matched your search
@@ -19,14 +19,24 @@ export function renderPatternEditor() {
|
||||
let contextName = "Song Editor"; // Nome da visualização atual
|
||||
|
||||
if (appState.pattern.focusedBasslineId) {
|
||||
isFocusedMode = true;
|
||||
// Mostra apenas os filhos da Bassline selecionada
|
||||
tracksToRender = appState.pattern.tracks.filter(t => t.parentBasslineId === appState.pattern.focusedBasslineId);
|
||||
|
||||
// Busca o nome para exibir no título
|
||||
const basslineTrack = appState.pattern.tracks.find(t => t.id === appState.pattern.focusedBasslineId);
|
||||
if (basslineTrack) contextName = basslineTrack.name;
|
||||
} else {
|
||||
isFocusedMode = true;
|
||||
|
||||
// 1) acha o container (Caixa/Kick/...) focado
|
||||
const basslineTrack = appState.pattern.tracks.find(
|
||||
t => t.id === appState.pattern.focusedBasslineId && t.type === "bassline"
|
||||
);
|
||||
|
||||
// 2) usa o rack real como "pai" (fallback: id do próprio container)
|
||||
const srcId = basslineTrack?.instrumentSourceId || appState.pattern.focusedBasslineId;
|
||||
|
||||
// 3) mostra somente instrumentos pertencentes ao rack
|
||||
tracksToRender = appState.pattern.tracks.filter(
|
||||
t => t.type !== "bassline" && t.parentBasslineId === srcId
|
||||
);
|
||||
|
||||
// Nome no header
|
||||
if (basslineTrack) contextName = basslineTrack.name;
|
||||
} else {
|
||||
// Modo Padrão: Mostra trilhas da raiz (sem pai) e que NÃO são containers de bassline
|
||||
tracksToRender = appState.pattern.tracks.filter(t => t.type !== 'bassline' && t.parentBasslineId === null);
|
||||
|
||||
@@ -170,7 +180,11 @@ export function redrawSequencer() {
|
||||
|
||||
if (!trackData || !trackData.patterns || trackData.patterns.length === 0) return;
|
||||
|
||||
const activePatternIndex = trackData.activePatternIndex || 0;
|
||||
const isFocused = !!appState.pattern.focusedBasslineId;
|
||||
const activePatternIndex = isFocused
|
||||
? (appState.pattern.activePatternIndex || 0)
|
||||
: (trackData.activePatternIndex || 0);
|
||||
|
||||
const activePattern = trackData.patterns[activePatternIndex];
|
||||
if (!activePattern) return;
|
||||
|
||||
@@ -299,7 +313,10 @@ export function updateGlobalPatternSelector() {
|
||||
const activeTrack = appState.pattern.tracks.find(t => t.id === activeTrackId);
|
||||
|
||||
// Tenta pegar a track ativa ou a primeira visível como referência de patterns
|
||||
const referenceTrack = activeTrack || appState.pattern.tracks.find(t => !t.isMuted && t.type !== 'bassline');
|
||||
const isFocused = !!appState.pattern.focusedBasslineId;
|
||||
const referenceTrack = isFocused
|
||||
? appState.pattern.tracks.find(t => t.type !== "bassline" && t.parentBasslineId !== null)
|
||||
: (activeTrack || appState.pattern.tracks.find(t => !t.isMuted && t.type !== "bassline"));
|
||||
|
||||
globalPatternSelector.innerHTML = '';
|
||||
|
||||
@@ -311,10 +328,12 @@ export function updateGlobalPatternSelector() {
|
||||
globalPatternSelector.appendChild(option);
|
||||
});
|
||||
|
||||
if (activeTrack) {
|
||||
globalPatternSelector.value = activeTrack.activePatternIndex || 0;
|
||||
if (isFocused) {
|
||||
globalPatternSelector.value = appState.pattern.activePatternIndex || 0;
|
||||
} else if (activeTrack) {
|
||||
globalPatternSelector.value = activeTrack.activePatternIndex || 0;
|
||||
} else {
|
||||
globalPatternSelector.value = 0;
|
||||
globalPatternSelector.value = 0;
|
||||
}
|
||||
globalPatternSelector.disabled = false;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user