0.0.9 • Published 2 years ago

@ishikawa-masashi/react-joystick v0.0.9

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

React Joystick Component

Build Status

Click here to see examples

npm i react-joystick-component --save
import { Joystick } from 'react-joystick-component';
<Joystick size={100} baseColor="red" stickColor="blue" move={handleMove} stop={handleStop}></Joystick>

Component Props - as described by IJoystickProps

PropTypeDescription
sizenumberThe size in px of the Joystick base
baseColorstringThe color of the Joystick base
stickColorstringThe color of the Stick
throttlenumberThe throttling rate of the move callback
moveFunctionCallback fired on every mouse move, not throttled unless a throttling rate is provided as above
stopFunctionCallback fired when the user releases the joystick
startFunctionCallback fired when the user starts moving the Joystick
disabledBooleanWhen true, block any usage of the Joystick. This will also apply the joystick-disabled and joystick-base-disabled classNames
interface IJoystickProps {
    size?: number;
    baseColor?: string;
    stickColor?: string;
    disabled?: boolean;
    throttle?: number;
    move?: (event: IJoystickUpdateEvent) => void;
    stop?: (event: IJoystickUpdateEvent) => void;
    start?: (event: IJoystickUpdateEvent) => void;
}
type JoystickDirection = "FORWARD" | "RIGHT" | "LEFT" | "BACKWARD";

export interface IJoystickUpdateEvent {
    type: "move" | "stop" | "start";
    x: number | null;
    y: number | null;
    direction: JoystickDirection | null;
}
0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago