From 3164f311f5aec6dbddff4169894a30f9e59a0d2e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 17 Oct 2024 01:52:06 -0500 Subject: [PATCH] GUI: fix visualizer when things are on issue #2212 --- src/gui/gui.cpp | 1 + src/gui/gui.h | 1 + src/gui/pattern.cpp | 8 ++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 34343f63f..271717d70 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -8709,6 +8709,7 @@ FurnaceGUI::FurnaceGUI(): fadeMin(0), fadeMax(255), collapseAmount(2), + playheadY(0.0f), scaleMax(100.0f), fadeMode(false), randomMode(false), diff --git a/src/gui/gui.h b/src/gui/gui.h index 7678cf601..66a135df9 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -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; diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index 0a658a4e2..c0be247be 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -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; jFontSize) + off.y+(playheadY)+randRange(0,patFont->FontSize) ); if (partPos.xwinMax.x || partPos.y>winMax.y) continue;