@rpg-engine/long-bow 0.7.99 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DPad/JoystickDPad.d.ts +3 -1
- package/dist/long-bow.cjs.development.js +5 -1
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +5 -1
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DPad/JoystickDPad.tsx +7 -1
|
@@ -12,10 +12,12 @@ interface IDPadOptions {
|
|
|
12
12
|
interface IDPadProps {
|
|
13
13
|
/** Callback fired when a direction is pressed */
|
|
14
14
|
onDirectionPress?: (direction: 'up' | 'down' | 'left' | 'right') => void;
|
|
15
|
+
/** Callback fired when a direction is released */
|
|
16
|
+
onDirectionRelease?: (direction: 'up' | 'down' | 'left' | 'right') => void;
|
|
15
17
|
/** Whether the component is disabled */
|
|
16
18
|
disabled?: boolean;
|
|
17
19
|
/** Additional options for customizing the D-pad */
|
|
18
20
|
options?: IDPadOptions;
|
|
19
21
|
}
|
|
20
|
-
export declare const JoystickDPad: React.MemoExoticComponent<({ onDirectionPress, disabled, options, }: IDPadProps) => JSX.Element>;
|
|
22
|
+
export declare const JoystickDPad: React.MemoExoticComponent<({ onDirectionPress, onDirectionRelease, disabled, options, }: IDPadProps) => JSX.Element>;
|
|
21
23
|
export {};
|
|
@@ -29157,6 +29157,7 @@ var DPadContainer = /*#__PURE__*/React.memo( /*#__PURE__*/styled__default.div.wi
|
|
|
29157
29157
|
}));
|
|
29158
29158
|
var JoystickDPad = /*#__PURE__*/React.memo(function (_ref) {
|
|
29159
29159
|
var onDirectionPress = _ref.onDirectionPress,
|
|
29160
|
+
onDirectionRelease = _ref.onDirectionRelease,
|
|
29160
29161
|
_ref$disabled = _ref.disabled,
|
|
29161
29162
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
29162
29163
|
_ref$options = _ref.options,
|
|
@@ -29185,11 +29186,14 @@ var JoystickDPad = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
29185
29186
|
activeDirectionRef.current = null;
|
|
29186
29187
|
}, []);
|
|
29187
29188
|
var clearAllPresses = React.useCallback(function () {
|
|
29189
|
+
if (activeDirectionRef.current && onDirectionRelease) {
|
|
29190
|
+
onDirectionRelease(activeDirectionRef.current);
|
|
29191
|
+
}
|
|
29188
29192
|
clearPressInterval();
|
|
29189
29193
|
setPressedButtons(new Set());
|
|
29190
29194
|
activeDirectionRef.current = null;
|
|
29191
29195
|
isPressedRef.current = false;
|
|
29192
|
-
}, [clearPressInterval]);
|
|
29196
|
+
}, [clearPressInterval, onDirectionRelease]);
|
|
29193
29197
|
var handleDirectionPress = React.useCallback(function (direction) {
|
|
29194
29198
|
if (disabled) return;
|
|
29195
29199
|
// Clear any existing presses first
|