GUI: fix hidden channels breaking visualizer

This commit is contained in:
tildearrow 2023-07-07 03:15:09 -05:00
parent aececf352f
commit 97fec35b00

View file

@ -133,17 +133,20 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor();
// for each column // for each column
int mustSetXOf=0;
for (int j=0; j<chans; j++) { for (int j=0; j<chans; j++) {
// check if channel is not hidden // check if channel is not hidden
if (!e->curSubSong->chanShow[j]) { if (!e->curSubSong->chanShow[j]) {
patChanX[j]=ImGui::GetCursorScreenPos().x;
continue; continue;
} }
int chanVolMax=e->getMaxVolumeChan(j); int chanVolMax=e->getMaxVolumeChan(j);
if (chanVolMax<1) chanVolMax=1; if (chanVolMax<1) chanVolMax=1;
const DivPattern* pat=patCache[j]; const DivPattern* pat=patCache[j];
ImGui::TableNextColumn(); ImGui::TableNextColumn();
patChanX[j]=ImGui::GetCursorScreenPos().x; for (int k=mustSetXOf; k<=j; k++) {
patChanX[k]=ImGui::GetCursorScreenPos().x;
}
mustSetXOf=j+1;
// selection highlight flags // selection highlight flags
int sel1XSum=sel1.xCoarse*32+sel1.xFine; int sel1XSum=sel1.xCoarse*32+sel1.xFine;
@ -358,7 +361,9 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
patChanX[chans]=ImGui::GetCursorScreenPos().x; for (int k=mustSetXOf; k<=chans; k++) {
patChanX[k]=ImGui::GetCursorScreenPos().x;
}
} }
void FurnaceGUI::drawPattern() { void FurnaceGUI::drawPattern() {
@ -1119,6 +1124,8 @@ void FurnaceGUI::drawPattern() {
break; break;
} }
if (!e->curSubSong->chanShow[i.chan]) continue;
for (int j=0; j<num; j++) { for (int j=0; j<num; j++) {
ImVec2 partPos=ImVec2( ImVec2 partPos=ImVec2(
off.x+patChanX[i.chan]+fmod(rand(),width), off.x+patChanX[i.chan]+fmod(rand(),width),