GUI: fix visualizer when things are on

issue #2212
This commit is contained in:
tildearrow 2024-10-17 01:52:06 -05:00
parent 617bdc0f3b
commit 3164f311f5
3 changed files with 8 additions and 2 deletions

View file

@ -8709,6 +8709,7 @@ FurnaceGUI::FurnaceGUI():
fadeMin(0),
fadeMax(255),
collapseAmount(2),
playheadY(0.0f),
scaleMax(100.0f),
fadeMode(false),
randomMode(false),

View file

@ -2528,6 +2528,7 @@ class FurnaceGUI {
SelectionPoint sel1, sel2;
int dummyRows;
int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax, collapseAmount;
float playheadY;
float scaleMax;
bool fadeMode, randomMode, haveHitBounds;
signed char pendingStepUpdate;

View file

@ -75,6 +75,10 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::TableNextRow(0,lineHeight);
ImGui::TableNextColumn();
float cursorPosY=ImGui::GetCursorPos().y-ImGui::GetScrollY();
// store playhead position on the screen
if (ord==playOrder && oldRow==i) {
playheadY=ImGui::GetCursorScreenPos().y;
}
// check if the row is visible
if (cursorPosY<-lineHeight || cursorPosY>ImGui::GetWindowSize().y) {
return;
@ -1483,7 +1487,7 @@ void FurnaceGUI::drawPattern() {
if (fancyPattern) { // visualizer
e->getCommandStream(cmdStream);
ImDrawList* dl=ImGui::GetWindowDrawList();
ImVec2 off=ImVec2(0.0f,ImGui::GetWindowPos().y);
ImVec2 off=ImVec2(0.0f,0.0f);
ImVec2 winMin=ImGui::GetWindowPos();
ImVec2 winMax=ImVec2(
@ -1616,7 +1620,7 @@ void FurnaceGUI::drawPattern() {
for (int j=0; j<num; j++) {
ImVec2 partPos=ImVec2(
off.x+patChanX[i.chan]+fmod(rand(),width),
off.y+(ImGui::GetWindowHeight()*0.5f)+randRange(0,patFont->FontSize)
off.y+(playheadY)+randRange(0,patFont->FontSize)
);
if (partPos.x<winMin.x || partPos.y<winMin.y || partPos.x>winMax.x || partPos.y>winMax.y) continue;