From 1151db50912cb17491937e84459454fbb369576f Mon Sep 17 00:00:00 2001 From: BlastBrothers Date: Fri, 8 Apr 2022 10:23:51 -0400 Subject: [PATCH] Sample preview has maximum y height relative to x --- src/gui/sampleEdit.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/sampleEdit.cpp b/src/gui/sampleEdit.cpp index cd9f76b7e..f4c1e8bbc 100644 --- a/src/gui/sampleEdit.cpp +++ b/src/gui/sampleEdit.cpp @@ -554,8 +554,14 @@ void FurnaceGUI::drawSampleEdit() { ImGui::Separator(); - ImVec2 avail=ImGui::GetContentRegionAvail(); + ImVec2 avail=ImGui::GetContentRegionAvail(); // graph size determined here + if (ImGui::GetContentRegionAvail().y > (ImGui::GetContentRegionAvail().x / 2.0f)) { + avail=ImVec2(ImGui::GetContentRegionAvail().x,ImGui::GetContentRegionAvail().x / 2.0f); + } avail.y-=ImGui::GetFontSize()+ImGui::GetStyle().ItemSpacing.y+ImGui::GetStyle().ScrollbarSize; + if (avail.y < 1.0){ //Prevents crash + avail.y = 1.0; + } int availX=avail.x; int availY=avail.y;