diff --git a/src/gui/editControls.cpp b/src/gui/editControls.cpp old mode 100644 new mode 100755 index 05c5d4c9..89f1ecab --- a/src/gui/editControls.cpp +++ b/src/gui/editControls.cpp @@ -48,12 +48,36 @@ void FurnaceGUI::drawMobileControls() { } } } + if (dragMobileEditButton) { + mobileEditButtonPos.x=((ImGui::GetMousePos().x/canvasW)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasW); + mobileEditButtonPos.y=((ImGui::GetMousePos().y/canvasH)-((portrait?0.16*canvasW:0.16*canvasH)/2)/canvasH); + } + if (mobileEditButtonPos.x<0) mobileEditButtonPos.x=0; + if (mobileEditButtonPos.x>1) mobileEditButtonPos.x=1; + if (mobileEditButtonPos.y<0) mobileEditButtonPos.y=0; + if (mobileEditButtonPos.y>1) mobileEditButtonPos.y=1; + ImGui::SetNextWindowPos(ImVec2(mobileEditButtonPos.x*canvasW, mobileEditButtonPos.y*canvasH)); + ImGui::SetNextWindowSize(portrait?ImVec2(0.16*canvasW,0.16*canvasW):ImVec2(0.16*canvasH,0.16*canvasH)); + if (ImGui::Begin("MobileEdit",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoBackground|ImGuiWindowFlags_NoDecoration|globalWinFlags)) { + float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x; + mobileEditButtonSize=ImVec2(avail,avail); + if (ImGui::Button("Edit", mobileEditButtonSize)) { + //click + } + if (ImGui::IsItemActive()) { + if (CHECK_BUTTON_LONG_HOLD) { + //drag + if (!dragMobileEditButton) dragMobileEditButton=!dragMobileEditButton; + } + } + } + ImGui::End(); + ImGui::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*canvasH)-(0.16*canvasW)):ImVec2(0.5*canvasW*mobileMenuPos,0.0f)); ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.16*canvasW):ImVec2(0.16*canvasH,canvasH)); if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) { float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x; ImVec2 buttonSize=ImVec2(avail,avail); - const char* mobButtonName=ICON_FA_CHEVRON_RIGHT "##MobileMenu"; if (portrait) mobButtonName=ICON_FA_CHEVRON_UP "##MobileMenu"; if (mobileMenuOpen) { diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp old mode 100644 new mode 100755 index c5ebced5..22d40807 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -2939,6 +2939,9 @@ void FurnaceGUI::pointUp(int x, int y, int button) { mobileMenuOpen=(mobileMenuPos>=0.15f); } } + if (dragMobileEditButton) { + dragMobileEditButton=false; + } if (selecting) { if (!selectingFull) cursor=selEnd; finishSelection(); @@ -5663,6 +5666,8 @@ FurnaceGUI::FurnaceGUI(): waveEditStyle(0), displayInsTypeListMakeInsSample(-1), mobileMenuPos(0.0f), + mobileEditButtonPos(0.0f,0.0f), + mobileEditButtonSize(0.0f,0.0f), autoButtonSize(0.0f), curSysSection(NULL), pendingRawSampleDepth(8), @@ -5794,12 +5799,14 @@ FurnaceGUI::FurnaceGUI(): orderScrollLocked(false), orderScrollTolerance(false), dragMobileMenu(false), + dragMobileEditButton(false), curWindow(GUI_WINDOW_NOTHING), nextWindow(GUI_WINDOW_NOTHING), curWindowLast(GUI_WINDOW_NOTHING), curWindowThreadSafe(GUI_WINDOW_NOTHING), lastPatternWidth(0.0f), longThreshold(0.48f), + buttonLongThreshold(0.20f), latchNote(-1), latchIns(-2), latchVol(-1), diff --git a/src/gui/gui.h b/src/gui/gui.h old mode 100644 new mode 100755 index a7b6c74b..f54f3a22 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -54,7 +54,7 @@ } #define CHECK_LONG_HOLD (mobileUI && ImGui::GetIO().MouseDown[ImGuiMouseButton_Left] && ImGui::GetIO().MouseDownDuration[ImGuiMouseButton_Left]>=longThreshold && ImGui::GetIO().MouseDownDurationPrev[ImGuiMouseButton_Left]=buttonLongThreshold && ImGui::GetIO().MouseDownDurationPrev[ImGuiMouseButton_Left] curWindowThreadSafe; float peak[2]; float patChanX[DIV_MAX_CHANS+1]; float patChanSlideY[DIV_MAX_CHANS+1]; float lastPatternWidth, longThreshold; + float buttonLongThreshold; String nextDesc; String nextDescName;