GUI: better inertial scroll inhibit logic
also better pattern editor mute in mobile
This commit is contained in:
parent
e7cfde9a2b
commit
f84469e4fd
|
@ -3451,8 +3451,6 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)
|
||||||
if (g.LastItemData.InFlags & ImGuiItemFlags_NoInertialScroll) {
|
if (g.LastItemData.InFlags & ImGuiItemFlags_NoInertialScroll) {
|
||||||
g.InertialScrollInhibited=true;
|
g.InertialScrollInhibited=true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
g.InertialScrollInhibited=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear declaration of inputs claimed by the widget
|
// Clear declaration of inputs claimed by the widget
|
||||||
|
@ -5102,7 +5100,7 @@ void ImGui::EndFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for inertial scroll inhibit status
|
// Check for inertial scroll inhibit status
|
||||||
if (g.IO.MouseReleased[ImGuiMouseButton_Left]) {
|
if (!g.IO.MouseDown[ImGuiMouseButton_Left]) {
|
||||||
g.InertialScrollInhibited=false;
|
g.InertialScrollInhibited=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6941,25 +6939,32 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||||
if (g.IO.MouseClicked[ImGuiMouseButton_Left]) {
|
if (g.IO.MouseClicked[ImGuiMouseButton_Left]) {
|
||||||
window->InertialScrollSpeed=ImVec2(0.0f,0.0f);
|
window->InertialScrollSpeed=ImVec2(0.0f,0.0f);
|
||||||
window->InertialScroll=false;
|
window->InertialScroll=false;
|
||||||
|
g.InertialScroll=false;
|
||||||
|
g.WasInertialScroll=false;
|
||||||
} else {
|
} else {
|
||||||
if (g.IO.MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]>g.IO.ConfigInertialScrollToleranceSqr) {
|
if (g.IO.MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]>g.IO.ConfigInertialScrollToleranceSqr) {
|
||||||
if (g.IO.MouseReleased[ImGuiMouseButton_Left]) {
|
if (g.IO.MouseReleased[ImGuiMouseButton_Left]) {
|
||||||
window->InertialScrollSpeed=ImVec2(window->ScrollbarX?-g.IO.MouseSpeed.x:0.0f,window->ScrollbarY?-g.IO.MouseSpeed.y:0.0f);
|
window->InertialScrollSpeed=ImVec2(window->ScrollbarX?-g.IO.MouseSpeed.x:0.0f,window->ScrollbarY?-g.IO.MouseSpeed.y:0.0f);
|
||||||
window->InertialScroll=false;
|
window->InertialScroll=false;
|
||||||
|
g.InertialScroll=false;
|
||||||
} else {
|
} else {
|
||||||
window->InertialScrollSpeed=ImVec2(window->ScrollbarX?-g.IO.MouseDelta.x:0.0f,window->ScrollbarY?-g.IO.MouseDelta.y:0.0f);
|
window->InertialScrollSpeed=ImVec2(window->ScrollbarX?-g.IO.MouseDelta.x:0.0f,window->ScrollbarY?-g.IO.MouseDelta.y:0.0f);
|
||||||
if (window->ScrollbarX || window->ScrollbarY) {
|
if (window->ScrollbarX || window->ScrollbarY) {
|
||||||
window->InertialScroll=true;
|
window->InertialScroll=true;
|
||||||
|
g.InertialScroll=true;
|
||||||
|
g.WasInertialScroll=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
window->InertialScrollSpeed=ImVec2(0.0f,0.0f);
|
window->InertialScrollSpeed=ImVec2(0.0f,0.0f);
|
||||||
window->InertialScroll=false;
|
window->InertialScroll=false;
|
||||||
|
g.InertialScroll=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (g.InertialScrollInhibited) {
|
} else if (g.InertialScrollInhibited) {
|
||||||
window->InertialScrollSpeed=ImVec2(0.0f,0.0f);
|
window->InertialScrollSpeed=ImVec2(0.0f,0.0f);
|
||||||
window->InertialScroll=false;
|
window->InertialScroll=false;
|
||||||
|
g.InertialScroll=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6982,6 +6987,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||||
window->InertialScrollSpeed.x=0.0f;
|
window->InertialScrollSpeed.x=0.0f;
|
||||||
window->InertialScrollSpeed.y=0.0f;
|
window->InertialScrollSpeed.y=0.0f;
|
||||||
window->InertialScroll=false;
|
window->InertialScroll=false;
|
||||||
|
g.InertialScroll=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g.IO.MouseDown[ImGuiMouseButton_Left]) {
|
if (g.IO.MouseDown[ImGuiMouseButton_Left]) {
|
||||||
|
@ -7556,11 +7562,22 @@ void ImGui::EndDisabled()
|
||||||
|
|
||||||
bool ImGui::IsInertialScroll()
|
bool ImGui::IsInertialScroll()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window==NULL) return false;
|
if (window==NULL) return false;
|
||||||
return window->InertialScroll;
|
return window->InertialScroll;
|
||||||
|
*/
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
return g.InertialScroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WasInertialScroll()
|
||||||
|
|
||||||
|
bool ImGui::WasInertialScroll()
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
return g.WasInertialScroll;
|
||||||
|
}
|
||||||
|
|
||||||
// InhibitInertialScroll()
|
// InhibitInertialScroll()
|
||||||
|
|
||||||
|
|
|
@ -840,6 +840,7 @@ namespace ImGui
|
||||||
|
|
||||||
// Inertial scroll
|
// Inertial scroll
|
||||||
IMGUI_API bool IsInertialScroll();
|
IMGUI_API bool IsInertialScroll();
|
||||||
|
IMGUI_API bool WasInertialScroll();
|
||||||
IMGUI_API void InhibitInertialScroll();
|
IMGUI_API void InhibitInertialScroll();
|
||||||
|
|
||||||
// Clipping
|
// Clipping
|
||||||
|
|
|
@ -1938,6 +1938,8 @@ struct ImGuiContext
|
||||||
|
|
||||||
// Inertial scroll
|
// Inertial scroll
|
||||||
bool InertialScrollInhibited; // Is inertial scroll inhibited? (e.g. by ImGuiItemFlags_NoInertialScroll)
|
bool InertialScrollInhibited; // Is inertial scroll inhibited? (e.g. by ImGuiItemFlags_NoInertialScroll)
|
||||||
|
bool InertialScroll; // Is any window being scrolled?
|
||||||
|
bool WasInertialScroll; // Was ^?
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
|
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
|
||||||
|
|
|
@ -61,6 +61,8 @@
|
||||||
if (SDL_HapticRumblePlay(vibrator,0.5f,20)!=0) { \
|
if (SDL_HapticRumblePlay(vibrator,0.5f,20)!=0) { \
|
||||||
logV("could not vibrate: %s!",SDL_GetError()); \
|
logV("could not vibrate: %s!",SDL_GetError()); \
|
||||||
} \
|
} \
|
||||||
|
} else { \
|
||||||
|
fputc(7,stderr); /* bell */ \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BIND_FOR(x) getKeyName(actionKeys[x],true).c_str()
|
#define BIND_FOR(x) getKeyName(actionKeys[x],true).c_str()
|
||||||
|
|
|
@ -734,19 +734,36 @@ void FurnaceGUI::drawPattern() {
|
||||||
ImGui::SetTooltip("%s",e->getChannelName(i));
|
ImGui::SetTooltip("%s",e->getChannelName(i));
|
||||||
}
|
}
|
||||||
if (settings.channelFont==0) ImGui::PopFont();
|
if (settings.channelFont==0) ImGui::PopFont();
|
||||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
|
if (mobileUI) {
|
||||||
if (settings.soloAction!=1 && soloTimeout>0 && soloChan==i) {
|
if (ImGui::IsItemHovered()) {
|
||||||
e->toggleSolo(i);
|
if (CHECK_LONG_HOLD) {
|
||||||
soloTimeout=0;
|
NOTIFY_LONG_HOLD;
|
||||||
} else {
|
e->toggleSolo(i);
|
||||||
e->toggleMute(i);
|
soloChan=i;
|
||||||
soloTimeout=20;
|
}
|
||||||
soloChan=i;
|
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) && !ImGui::WasInertialScroll()) {
|
||||||
|
if (soloChan!=i) {
|
||||||
|
e->toggleMute(i);
|
||||||
|
} else {
|
||||||
|
soloChan=-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
|
||||||
|
if (settings.soloAction!=1 && soloTimeout>0 && soloChan==i) {
|
||||||
|
e->toggleSolo(i);
|
||||||
|
soloTimeout=0;
|
||||||
|
} else {
|
||||||
|
e->toggleMute(i);
|
||||||
|
soloTimeout=20;
|
||||||
|
soloChan=i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (muted) ImGui::PopStyleColor();
|
if (muted) ImGui::PopStyleColor();
|
||||||
ImGui::PopStyleColor(4);
|
ImGui::PopStyleColor(4);
|
||||||
if (settings.soloAction!=2) if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
|
if (settings.soloAction!=2 && !mobileUI) if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
|
||||||
inhibitMenu=true;
|
inhibitMenu=true;
|
||||||
e->toggleSolo(i);
|
e->toggleSolo(i);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue