GUI: unreliable version of #63

This commit is contained in:
tildearrow 2022-04-13 18:16:55 -05:00
parent 720f046f28
commit d6333af330
3 changed files with 44 additions and 1 deletions

View File

@ -514,11 +514,13 @@ const char* FurnaceGUI::getSystemName(DivSystem which) {
void FurnaceGUI::updateScroll(int amount) {
float lineHeight=(patFont->FontSize+2*dpiScale);
nextScroll=lineHeight*amount;
haveHitBounds=false;
}
void FurnaceGUI::addScroll(int amount) {
float lineHeight=(patFont->FontSize+2*dpiScale);
nextAddScroll=lineHeight*amount;
haveHitBounds=false;
}
void FurnaceGUI::setFileName(String name) {
@ -3618,6 +3620,7 @@ FurnaceGUI::FurnaceGUI():
scaleMax(100.0f),
fadeMode(false),
randomMode(false),
haveHitBounds(false),
oldOrdersLen(0),
sampleZoom(1.0),
prevSampleZoom(1.0),

View File

@ -1009,7 +1009,7 @@ class FurnaceGUI {
int dummyRows, demandX;
int transposeAmount, randomizeMin, randomizeMax, fadeMin, fadeMax;
float scaleMax;
bool fadeMode, randomMode;
bool fadeMode, randomMode, haveHitBounds;
int oldOrdersLen;
DivOrders oldOrders;

View File

@ -17,6 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <imgui.h>
#define _USE_MATH_DEFINES
#include "gui.h"
#include "../ta-log.h"
@ -652,6 +653,45 @@ void FurnaceGUI::drawPattern() {
demandScrollX=false;
}
scrollX=ImGui::GetScrollX();
// overflow changes order
if (!e->isPlaying()) {
if (wheelY!=0) {
if (wheelY>0) {
if (ImGui::GetScrollY()<=0) {
logV("scroll %d",wheelY);
if (haveHitBounds) {
if (e->getOrder()>0) {
e->setOrder(e->getOrder()-1);
ImGui::SetScrollY(ImGui::GetScrollMaxY());
updateScroll(e->song.patLen);
}
haveHitBounds=false;
} else {
haveHitBounds=true;
}
} else {
haveHitBounds=false;
}
} else {
if (ImGui::GetScrollY()>=ImGui::GetScrollMaxY()) {
logV("scroll %d",wheelY);
if (haveHitBounds) {
if (e->getOrder()<e->song.ordersLen) {
e->setOrder(e->getOrder()+1);
ImGui::SetScrollY(0);
updateScroll(0);
}
haveHitBounds=false;
} else {
haveHitBounds=true;
}
} else {
haveHitBounds=false;
}
}
}
}
ImGui::EndTable();
}