|
@@ -22,7 +22,7 @@
|
|
|
// Data
|
|
|
static GLFWwindow* g_Window = NULL;
|
|
|
static double g_Time = 0.0f;
|
|
|
-static bool g_MousePressed[3] = { false, false, false };
|
|
|
+static bool g_MouseJustPressed[3] = { false, false, false };
|
|
|
static float g_MouseWheel = 0.0f;
|
|
|
static GLuint g_FontTexture = 0;
|
|
|
static int g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
|
@@ -150,7 +150,7 @@ static void ImGui_ImplGlfwGL3_SetClipboardText(void* user_data, const char* text
|
|
|
void ImGui_ImplGlfwGL3_MouseButtonCallback(GLFWwindow*, int button, int action, int /*mods*/)
|
|
|
{
|
|
|
if (action == GLFW_PRESS && button >= 0 && button < 3)
|
|
|
- g_MousePressed[button] = true;
|
|
|
+ g_MouseJustPressed[button] = true;
|
|
|
}
|
|
|
|
|
|
void ImGui_ImplGlfwGL3_ScrollCallback(GLFWwindow*, double /*xoffset*/, double yoffset)
|
|
@@ -401,8 +401,9 @@ void ImGui_ImplGlfwGL3_NewFrame()
|
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
- io.MouseDown[i] = g_MousePressed[i] || glfwGetMouseButton(g_Window, i) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
|
|
|
- g_MousePressed[i] = false;
|
|
|
+ // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
|
|
|
+ io.MouseDown[i] = g_MouseJustPressed[i] || glfwGetMouseButton(g_Window, i) != 0;
|
|
|
+ g_MouseJustPressed[i] = false;
|
|
|
}
|
|
|
|
|
|
io.MouseWheel = g_MouseWheel;
|