GUI: add "cursor follows wheel" option

needs testing
This commit is contained in:
tildearrow 2023-07-21 17:25:49 -05:00
parent 2f0f30f2f4
commit d411c9caba
3 changed files with 19 additions and 2 deletions

View file

@ -412,7 +412,7 @@ void FurnaceGUI::drawPattern() {
ImGui::SetNextWindowPos(patWindowPos);
ImGui::SetNextWindowSize(patWindowSize);
}
if (ImGui::Begin("Pattern",&patternOpen,globalWinFlags|(settings.avoidRaisingPattern?ImGuiWindowFlags_NoBringToFrontOnFocus:0))) {
if (ImGui::Begin("Pattern",&patternOpen,globalWinFlags|(settings.avoidRaisingPattern?ImGuiWindowFlags_NoBringToFrontOnFocus:0)|(settings.cursorFollowsWheel?ImGuiWindowFlags_NoScrollWithMouse:0))) {
if (!mobileUI) {
patWindowPos=ImGui::GetWindowPos();
patWindowSize=ImGui::GetWindowSize();
@ -951,9 +951,16 @@ void FurnaceGUI::drawPattern() {
demandScrollX=false;
}
// cursor follows wheel
if (settings.cursorFollowsWheel && (!e->isPlaying() || !followPattern) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) {
if (wheelX!=0 || wheelY!=0) {
moveCursor(wheelX,wheelY,false);
}
}
// overflow changes order
// TODO: this is very unreliable and sometimes it can warp you out of the song
if (settings.scrollChangesOrder && (!e->isPlaying() || !followPattern) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows)) {
if (settings.scrollChangesOrder && (!e->isPlaying() || !followPattern) && ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows) && !settings.cursorFollowsWheel) {
if (wheelY!=0) {
if (wheelY>0) {
if (ImGui::GetScrollY()<=0) {