GUI: tap to change order in order bar

This commit is contained in:
tildearrow 2022-11-30 17:37:48 -05:00
parent fa564dbe78
commit 704863533f
3 changed files with 12 additions and 1 deletions

View file

@ -2198,6 +2198,7 @@ void FurnaceGUI::processDrags(int dragX, int dragY) {
} }
} }
if (orderScrollLocked) { if (orderScrollLocked) {
if (fabs(orderScrollRealOrigin.x-dragX)>2.0f*dpiScale || fabs(orderScrollRealOrigin.y-dragY)>2.0f*dpiScale) orderScrollTolerance=false;
orderScroll=(orderScrollSlideOrigin-dragX)/(40.0*dpiScale); orderScroll=(orderScrollSlideOrigin-dragX)/(40.0*dpiScale);
if (orderScroll<0.0f) orderScroll=0.0f; if (orderScroll<0.0f) orderScroll=0.0f;
if (orderScroll>(float)e->curSubSong->ordersLen-1) orderScroll=e->curSubSong->ordersLen-1; if (orderScroll>(float)e->curSubSong->ordersLen-1) orderScroll=e->curSubSong->ordersLen-1;
@ -2913,11 +2914,15 @@ void FurnaceGUI::pointUp(int x, int y, int button) {
sampleDragActive=false; sampleDragActive=false;
if (orderScrollLocked) { if (orderScrollLocked) {
int targetOrder=round(orderScroll); int targetOrder=round(orderScroll);
if (orderScrollTolerance) {
targetOrder=round(orderScroll+(orderScrollRealOrigin.x-(canvasW/2))/(40.0f*dpiScale));
}
if (targetOrder<0) targetOrder=0; if (targetOrder<0) targetOrder=0;
if (targetOrder>e->curSubSong->ordersLen-1) targetOrder=e->curSubSong->ordersLen-1; if (targetOrder>e->curSubSong->ordersLen-1) targetOrder=e->curSubSong->ordersLen-1;
if (curOrder!=targetOrder) setOrder(targetOrder); if (curOrder!=targetOrder) setOrder(targetOrder);
} }
orderScrollLocked=false; orderScrollLocked=false;
orderScrollTolerance=false;
if (selecting) { if (selecting) {
if (!selectingFull) cursor=selEnd; if (!selectingFull) cursor=selEnd;
finishSelection(); finishSelection();
@ -5741,6 +5746,7 @@ FurnaceGUI::FurnaceGUI():
nonLatchNibble(false), nonLatchNibble(false),
keepLoopAlive(false), keepLoopAlive(false),
orderScrollLocked(false), orderScrollLocked(false),
orderScrollTolerance(false),
curWindow(GUI_WINDOW_NOTHING), curWindow(GUI_WINDOW_NOTHING),
nextWindow(GUI_WINDOW_NOTHING), nextWindow(GUI_WINDOW_NOTHING),
curWindowLast(GUI_WINDOW_NOTHING), curWindowLast(GUI_WINDOW_NOTHING),
@ -5831,6 +5837,7 @@ FurnaceGUI::FurnaceGUI():
nextAddScroll(0.0f), nextAddScroll(0.0f),
orderScroll(0.0f), orderScroll(0.0f),
orderScrollSlideOrigin(0.0f), orderScrollSlideOrigin(0.0f),
orderScrollRealOrigin(0.0f,0.0f),
layoutTimeBegin(0), layoutTimeBegin(0),
layoutTimeEnd(0), layoutTimeEnd(0),
layoutTimeDelta(0), layoutTimeDelta(0),

View file

@ -1419,7 +1419,7 @@ class FurnaceGUI {
SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd; SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd;
bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI; bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
bool collapseWindow, demandScrollX, fancyPattern, wantPatName, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble; bool collapseWindow, demandScrollX, fancyPattern, wantPatName, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
bool keepLoopAlive, orderScrollLocked; bool keepLoopAlive, orderScrollLocked, orderScrollTolerance;
FurnaceGUIWindows curWindow, nextWindow, curWindowLast; FurnaceGUIWindows curWindow, nextWindow, curWindowLast;
std::atomic<FurnaceGUIWindows> curWindowThreadSafe; std::atomic<FurnaceGUIWindows> curWindowThreadSafe;
float peak[2]; float peak[2];
@ -1564,6 +1564,8 @@ class FurnaceGUI {
float nextScroll, nextAddScroll, orderScroll, orderScrollSlideOrigin; float nextScroll, nextAddScroll, orderScroll, orderScrollSlideOrigin;
ImVec2 orderScrollRealOrigin;
int layoutTimeBegin, layoutTimeEnd, layoutTimeDelta; int layoutTimeBegin, layoutTimeEnd, layoutTimeDelta;
int renderTimeBegin, renderTimeEnd, renderTimeDelta; int renderTimeBegin, renderTimeEnd, renderTimeDelta;
int eventTimeBegin, eventTimeEnd, eventTimeDelta; int eventTimeBegin, eventTimeEnd, eventTimeDelta;

View file

@ -81,7 +81,9 @@ void FurnaceGUI::drawMobileOrderSel() {
} }
if (ImGui::IsItemClicked()) { if (ImGui::IsItemClicked()) {
orderScrollSlideOrigin=ImGui::GetMousePos().x+orderScroll*40.0f*dpiScale; orderScrollSlideOrigin=ImGui::GetMousePos().x+orderScroll*40.0f*dpiScale;
orderScrollRealOrigin=ImGui::GetMousePos();
orderScrollLocked=true; orderScrollLocked=true;
orderScrollTolerance=true;
} }
} }
ImGui::End(); ImGui::End();