Skip to content

fix: only show the locked HUD toast for arrow keys - #1228

Open
RedSavant wants to merge 1 commit into
Polyfrost:v1from
RedSavant:fix/locked-hud-key-toast
Open

RedSavant wants to merge 1 commit into
Polyfrost:v1from
RedSavant:fix/locked-hud-key-toast

Conversation

@RedSavant

Copy link
Copy Markdown

Description

In the HUD studio, pressing any key while a locked HUD was selected showed the "HUD element locked" toast. The locked check in the key handler was running before the arrow key filter, so every key reached it, and it was also consuming those keys.

I removed that early check and made the existing check after the arrow key when cover every selected HUD (selectedHuds.any { it.locked }) instead of only the primary one. So now:

  • non-arrow keys are just ignored and passed on, same as with an unlocked HUDs
  • arrow keys on a selection with a locked HUD still show the toast and dont move anything
  • arrow keys on unlocked HUDs still move them by 1px (10px with Shift)

I also removed the primaryHud() lookup since it wasn't used anymore. selectedHuds is already checked to be non-empty right before, so it couldn't be null there anyway.

Tested on 26.3-fabric : letters, Shift and Space on a locked HUD, arrows on a locked HUD, arrows on an unlocked HUD, and a mixed selection with one locked and one unlocked HUD.

Related Issue(s)

Closes #1138

Checklist

  • I made a clear description of what was changed
  • I stated why these changes were necessary
  • I updated documentation or said what needs to be updated (no documentation changes needed)
  • I made sure these changes are backwards compatible
  • This pull request is for one feature/bug fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

when in the hud studio of a locked hud, pressing any key causes the hud locked notification to show

1 participant