You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
The keyboard handling code in trace viewer is a nightmare: we have a few global document key listeners, and then a pile of hacky code to fix complications arising from this basic mistake.
We should fix it.
The text was updated successfully, but these errors were encountered:
The old key handling architecture had a ton of nasty hacks for whether the
timeline is listening to keys (listensToKeys). This mess stems from a few things:
- Some of our components have local hotkeys that need to get called even when
they dont have keyboard focus. For instance, the wasd keys should work
in the track view even when some other panel has focus.
- Sometimes the toplevel timeline view doesn't have keyboard focus. In the
single-timeline-view-fills-the-screen use cases, we still want the timeline
view to get foucs.
The old architecture addresses this by having tons of global key event
listeners and then piles of hacks to turn off the global behavior when we think
that the timeline-view is not focused.
The new architecture is more modular. Individual components that want to have
hotkeys create and attach a <tr-ui-b-hotkey-controller> element. They then add their
local hotkeys to that object. Hotkeys are strongly typed, so that we can generate help
text automatically down the road.
Internally, the hotkey controllers talk to each other to find the topmost controller. That
topmost controller creates the actual keypress/down listeners, and then does all event dispatch for
all controllers in that subtree.
Notably, the mouse mode selector does not use the new hotkey controller. This is because the
mode selector is quirky: instead of plain hotkeys, its state changes in direct response to modifier
keydown/key up events. Rather than complicating the hotkey controllers design to accommodate the
mouse mode selectors stuff, it directly listens to the modifier keys: to do this and avoid leaking
the selector object due to document-owning-a-backpointer-to-an-element, we rewrite the component
to be polymer, which allows us to register for document listeners in the attached/detached lifecycle callbacks.
BUG=#1060
Review URL: https://codereview.appspot.com/239280043
The keyboard handling code in trace viewer is a nightmare: we have a few global document key listeners, and then a pile of hacky code to fix complications arising from this basic mistake.
We should fix it.
The text was updated successfully, but these errors were encountered: