@htmlbricks/hb-pad-joystick
v0.66.27
Published
Touch-friendly directional control: either a four-way D-pad that emits cardinal directions or an analog joystick (html5-joystick-new) that streams position and cardinal direction with customizable colors.
Readme
hb-pad-joystick — pad joystick
Category: utilities
Tags: utilities, controls
What it does
Touch-friendly directional control: either a four-way D-pad that emits cardinal directions or an analog joystick that streams position and cardinal direction with customizable colors.
Custom element
hb-pad-joystick
Attributes (snake_case; use string values in HTML)
id,style(optional): strings.pad_or_joystick(optional):"dpad"|"joystick"(default pad-style behavior when omitted per examples).joystick_parameters(optional): JSON string —internalFillColor,internalLineWidth,internalStrokeColor,externalLineWidth,externalStrokeColor.
Events
sendDirection:{ direction: "up" | "right" | "down" | "left"; id: string }.sendJoystickPosition:{ x; y; cardinalDirection; id: string }(cardinal set perCardinalDirectionin types).
Usage notes
- CSS variables:
--hb-pad-joystick-size(default200px). - Use
pad_or_joystick="joystick"for analog mode; seeextra/docs.ts.
Minimal HTML example
<hb-pad-joystick pad_or_joystick="dpad"></hb-pad-joystick>