Skip to content

Blackboard: Optimise and Refactor Hint Section Show/Hide

Eamonn Rea requested to merge eamonnrea/kanagram:fix-optimise-hints into master

This MR optimises and improves the Hint-related functionality in three main ways:

  • Hint-related items are now only shown/hidden once instead of constantly on the hintTimer trigger. This allows them to display faster, as they are only toggled on the hintButton action trigger, on the hintTimer finishing, or on the nextAnagram signal (see below)
  • To reduce duplication, Hint-related items are toggled using a helper function that toggles their visibility instead of their opacity.
    • This toggles based on visibility rather than opacity, with the logic being that opacity here is for styling purposes and is not tweened in any way, so there is no animation. Further, since opacity is static, there is little chance of code that changes the opacity setting it to the wrong value.
    • If it is strongly preferred, though, we could go back to using opacity. But since it is only used for styling, I think it makes more sense to use visibility.
  • Fix a bug where a hint would stay displayed when moving between anagrams, and this would show the hint for that next anagram. Now, the hint is hidden whenever the nextAnagram signal is emitted, if the hintTimer is still active.

Note: For this MR, I skipped the wikiButton, wikiSection, and wikiText components. There was a FIXME comment, but I did not check for this MR if it still applies.

Merge request reports