IO: apply same flooring as UpdateMouseInputs() in dupe event processing. (#4858) + provision for test engine.

This commit is contained in:
ocornut
2022-01-17 18:10:51 +01:00
parent 7374b96f5c
commit 90a6961638
2 changed files with 8 additions and 3 deletions

View File

@ -441,6 +441,7 @@ static inline float ImInvLength(const ImVec2& lhs, float fail_value)
static inline float ImFloor(float f) { return (float)(int)(f); }
static inline float ImFloorSigned(float f) { return (float)((f >= 0 || (float)(int)f == f) ? (int)f : (int)f - 1); } // Decent replacement for floorf()
static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); }
static inline ImVec2 ImFloorSigned(const ImVec2& v) { return ImVec2(ImFloorSigned(v.x), ImFloorSigned(v.y)); }
static inline int ImModPositive(int a, int b) { return (a + b) % b; }
static inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; }
static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
@ -936,6 +937,7 @@ struct ImGuiInputEvent
{
ImGuiInputEventType Type;
ImGuiInputSource Source;
bool SubmittedByTestEngine;
union
{
ImGuiInputEventMousePos MousePos; // if Type == ImGuiInputEventType_MousePos