mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-23 21:09:01 +08:00
Minor amend 9028088 (#3261)
This commit is contained in:
parent
43f79aa210
commit
9c209d5a90
@ -64,6 +64,7 @@ Other Changes:
|
||||
- Backends: Vulkan: Fixed error in if initial frame has no vertices. (#3177)
|
||||
- Backends: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData
|
||||
structure didn't have any vertices. (#2697) [@kudaba]
|
||||
- Backends: OSX: Added workaround to avoid fast mouse clicks. (#3261, #1992, #2525) [@nburrus]
|
||||
- Examples: Apple: Fixed example_apple_metal and example_apple_opengl2 using imgui_impl_osx.mm
|
||||
not forwarding right and center mouse clicks. (#3260) [@nburrus]
|
||||
|
||||
|
@ -68,7 +68,7 @@ enum GlfwClientApi
|
||||
static GLFWwindow* g_Window = NULL; // Main window
|
||||
static GlfwClientApi g_ClientApi = GlfwClientApi_Unknown;
|
||||
static double g_Time = 0.0;
|
||||
static bool g_MouseJustPressed[5] = { false, false, false, false, false };
|
||||
static bool g_MouseJustPressed[ImGuiMouseButton_COUNT] = {};
|
||||
static GLFWcursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = {};
|
||||
static bool g_InstalledCallbacks = false;
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
static CFAbsoluteTime g_Time = 0.0;
|
||||
static NSCursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = {};
|
||||
static bool g_MouseCursorHidden = false;
|
||||
static bool g_MouseJustPressed[5] = { false, false, false, false, false };
|
||||
static bool g_MouseDown[5] = { false, false, false, false, false };
|
||||
static bool g_MouseJustPressed[ImGuiMouseButton_COUNT] = {};
|
||||
static bool g_MouseDown[ImGuiMouseButton_COUNT] = {};
|
||||
|
||||
// Undocumented methods for creating cursors.
|
||||
@interface NSCursor()
|
||||
@ -126,9 +126,9 @@ void ImGui_ImplOSX_Shutdown()
|
||||
|
||||
static void ImGui_ImplOSX_UpdateMouseCursorAndButtons()
|
||||
{
|
||||
// Update buttons
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown) && i < IM_ARRAYSIZE(g_MouseJustPressed); i++)
|
||||
for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++)
|
||||
{
|
||||
// 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] || g_MouseDown[i];
|
||||
@ -208,11 +208,8 @@ bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
|
||||
if (event.type == NSEventTypeLeftMouseDown || event.type == NSEventTypeRightMouseDown || event.type == NSEventTypeOtherMouseDown)
|
||||
{
|
||||
int button = (int)[event buttonNumber];
|
||||
if (button >= 0 && button < IM_ARRAYSIZE(g_MouseJustPressed))
|
||||
{
|
||||
g_MouseJustPressed[button] = true;
|
||||
g_MouseDown[button] = true;
|
||||
}
|
||||
if (button >= 0 && button < IM_ARRAYSIZE(g_MouseDown))
|
||||
g_MouseDown[button] = g_MouseJustPressed[button] = true;
|
||||
return io.WantCaptureMouse;
|
||||
}
|
||||
|
||||
|
2
imgui.h
2
imgui.h
@ -1488,7 +1488,7 @@ struct ImGuiIO
|
||||
//------------------------------------------------------------------
|
||||
|
||||
ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.)
|
||||
bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
|
||||
bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
|
||||
float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text.
|
||||
float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all back-ends.
|
||||
bool KeyCtrl; // Keyboard modifier pressed: Control
|
||||
|
Loading…
Reference in New Issue
Block a user