Jelajahi Sumber

IO: Fixed AddFocusEvent(false) to also clear MouseDown[] state. (#4921)

ocornut 2 tahun lalu
induk
melakukan
a241dc7990
2 mengubah file dengan 4 tambahan dan 0 penghapusan
  1. 1 0
      docs/CHANGELOG.txt
  2. 3 0
      imgui.cpp

+ 1 - 0
docs/CHANGELOG.txt

@@ -142,6 +142,7 @@ Other Changes:
 - IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey
 - IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey
   can apply to mouse data as well. (#4921)
   can apply to mouse data as well. (#4921)
 - IO: Filter duplicate input events during the AddXXX() calls. (#5599, #4921)
 - IO: Filter duplicate input events during the AddXXX() calls. (#5599, #4921)
+- IO: Fixed AddFocusEvent(false) to also clear MouseDown[] state. (#4921)
 - Menus: Fixed incorrect sub-menu parent association when opening a menu by closing another.
 - Menus: Fixed incorrect sub-menu parent association when opening a menu by closing another.
   Among other things, it would accidentally break part of the closing heuristic logic when moving
   Among other things, it would accidentally break part of the closing heuristic logic when moving
   towards a sub-menu. (#2517, #5614). [@rokups]
   towards a sub-menu. (#2517, #5614). [@rokups]

+ 3 - 0
imgui.cpp

@@ -1303,6 +1303,9 @@ void ImGuiIO::ClearInputKeys()
     }
     }
     KeyCtrl = KeyShift = KeyAlt = KeySuper = false;
     KeyCtrl = KeyShift = KeyAlt = KeySuper = false;
     KeyMods = ImGuiMod_None;
     KeyMods = ImGuiMod_None;
+    MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
+    memset(MouseDown, 0, sizeof(MouseDown));
+    MouseWheel = MouseWheelH = 0.0f;
 }
 }
 
 
 static ImGuiInputEvent* FindLatestInputEvent(ImGuiInputEventType type, int arg = -1)
 static ImGuiInputEvent* FindLatestInputEvent(ImGuiInputEventType type, int arg = -1)