mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-06 06:25:54 +01:00
add guard against div-by-0 when processing SDL pinch events
This commit is contained in:
parent
8c8802ed31
commit
b0438d27a4
@ -2086,6 +2086,8 @@ void ImGuiIO::AddPinchUpdateEvent(float scale, float span_x, float span_y, float
|
||||
e.Source = ImGuiInputSource_Mouse;
|
||||
e.EventId = g.InputEventsNextEventId++;
|
||||
float norm = ImSqrt(ImPow(span_x,2) + ImPow(span_y,2));
|
||||
if(norm == 0)
|
||||
return;
|
||||
e.MouseWheel.WheelX = (1-scale)*100*span_x/norm;
|
||||
e.MouseWheel.WheelY = (1-scale)*100*span_y/norm;
|
||||
e.MouseWheel.MouseSource = g.InputEventsNextMouseSource;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user