components/PlayerGamepadButton
Floating touch-gamepad toggle for the player clients.
Functions
GamepadIcon()
function GamepadIcon(): Element;Defined in: components/PlayerGamepadButton.jsx:24
Four-way arrow glyph drawn on the toggle.
Returns
Element
PlayerGamepadButton()
function PlayerGamepadButton(props): Element;Defined in: components/PlayerGamepadButton.jsx:51
Draggable button that shows and hides the touch gamepad for every client
that is not the primary controller: the #player2 to #player4 and
#shared hashes, which render no dashboard, and a token-authenticated
viewer, whose sidebar is withdrawn once the server assigns the role.
The player slots exist to contribute gamepad input, so their toggle stays
reachable on any device; a shared viewer only sees it once the client
looks like a touch device (touchOnly: a mobile user agent or a first
touchstart), the same gate the sidebar applies to its own touch tiles.
Uncontrolled, the button owns the overlay state: the first activation posts
TOUCH_GAMEPAD_SETUP to the window, later toggles post
TOUCH_GAMEPAD_VISIBILITY. A host that already owns that state (the
sidebar, whose Ctrl+Shift+G handler must agree with the button) passes
isActive and onToggle instead. A press that travels further than
DRAG_THRESHOLD moves the button instead of toggling.
Parameters
| Parameter | Type | Description |
|---|---|---|
props | { touchOnly?: boolean; isActive?: boolean; onToggle?: () => void; } | - |
props.touchOnly? | boolean | Render only on a mobile or touch-detected client. |
props.isActive? | boolean | Overlay state when controlled by the host. |
props.onToggle? | () => void | Host toggle, replacing the internal one. |
Returns
Element
References
default
Renames and re-exports PlayerGamepadButton