Skip to content

Commit

Permalink
Fix lost click event when opening popup
Browse files Browse the repository at this point in the history
  • Loading branch information
0HyperCube committed Jan 7, 2025
1 parent 6e9ffb1 commit 9e70e8a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/engine/input/RunOnKeyDownAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public RunOnKeyDownAttribute(string inputName) : base(inputName)

public override bool OnInput(InputEvent @event)
{
var before = HeldDown;
if (base.OnInput(@event) && !before && HeldDown)
// Only trigger if the input was pressed this frame. It isn't possible to use !HeldDown since its value is
// incorrect if a mouse release event is marked as handled e.g. when opening a popup.
// https://github.com/Revolutionary-Games/Thrive/issues/5217
var justPressed = Input.IsActionJustPressed(InputName);
if (base.OnInput(@event) && justPressed && HeldDown)
{
if (TrackInputMethod)
{
Expand Down

0 comments on commit 9e70e8a

Please sign in to comment.