Internals: Fixed incorrect repeat delay/rate calculation in IsMouseClicked() with repeat flag leading to involontary but thankfully doubling the rate. Using our standard function, making the multiplicator explicit.

This commit is contained in:
omar 2019-05-03 15:06:06 +02:00
parent 2dc81057ec
commit e2166db282

View File

@ -4195,8 +4195,9 @@ bool ImGui::IsMouseClicked(int button, bool repeat)
if (repeat && t > g.IO.KeyRepeatDelay) if (repeat && t > g.IO.KeyRepeatDelay)
{ {
float delay = g.IO.KeyRepeatDelay, rate = g.IO.KeyRepeatRate; // FIXME: 2019/05/03: Our old repeat code was wrong here and led to doubling the repeat rate, which made it an ok rate for repeat on mouse hold.
if ((ImFmod(t - delay, rate) > rate*0.5f) != (ImFmod(t - delay - g.IO.DeltaTime, rate) > rate*0.5f)) int amount = CalcTypematicPressedRepeatAmount(t, t - g.IO.DeltaTime, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate * 0.5f);
if (amount > 0)
return true; return true;
} }