This fixes a bug where the ShowUIHighlight tutorial script command only worked for some UI elements
Implementation Notes
This addresses a combination of issues:
When removing anys from the codebase, Andy dealt with the proper typing of getUiElementReference, which could be something other than something that could be addObjected (eg, a DisplayObject). However, he only did this in the case the returned reference was PoseEditMode - which only happens in a fallthrough case
It is not always possible to parent the highlight to the reference - eg, when returning a "proxy" object for toolbar buttons. Instead, we should just use the mode
In some situations we might parent to something in a container that is clipped, as is the case of things in the ModeBar, which are placed in a scrollcontainer, which would cut off the highlight box awkwardly. I have opted to put the highlight at the very top of the mode. That does mean that the highlighted thing could be behind something else (ie, a dialog) but the highlight stays on the top of the screen - while visually a bit odd, I think this is actually best so that users don't get confused because there's a highlight that's supposed to be directing them that just isnt showing up whatsoever
We now have more instances where we use "proxies". Namely, the toolbar dropdown will actually indicate the specific dropdown item to select and in the toolbar and mode bar, when the item needs to be scrolled into view the scrollbar will be indicated. This became more important because masks are no longer applied (otherwise the highlights could be floating randomly in space), but is desirable anyways as if masked the user may not understand what they're supposed to do because the indicator is missing.
In situations where we change what we're highlighting (eg when a tool isnt on the hotbar and we need to highlight the expand button, then the tab, then the tool, and maybe regress) the highlight wasnt properly updating as we only got the UI element once, but the whole point of the proxy is that it changes over time
We can now simplify a whole bunch of code!
Also: I was potentially concerned about the performance of the per-frame repositioning since getBounds calls can be expensive, but I did some framerate comparisons both on my PC and phone and didn't see any noticeable differences
Testing
Ran showuihighlight on switch, togglenatural, swap (in the hotbar), and zoomin (not in the hotbar)
Summary
This fixes a bug where the ShowUIHighlight tutorial script command only worked for some UI elements
Implementation Notes
This addresses a combination of issues:
any
s from the codebase, Andy dealt with the proper typing of getUiElementReference, which could be something other than something that could beaddObject
ed (eg, a DisplayObject). However, he only did this in the case the returned reference was PoseEditMode - which only happens in a fallthrough caseAlso: I was potentially concerned about the performance of the per-frame repositioning since getBounds calls can be expensive, but I did some framerate comparisons both on my PC and phone and didn't see any noticeable differences
Testing
Related Issues
Resolves #735