toggleDebugPanel
Toggles the visibility of the debug panel.
Typically toggleDebugPanel should check the canToggleDebugPanel before the call. E.g., when toggling the debug panel on pressing a key, both the down and up event must be consumed if we can toggle the debug panel, but neither should be consumed if we can't.