@rpg-engine/long-bow 0.7.99 → 0.8.1
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 +8 -5
- 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 +8 -5
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/DPad/JoystickDPad.tsx +7 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +5 -10
package/package.json
CHANGED
|
@@ -28,6 +28,8 @@ interface IDPadOptions {
|
|
|
28
28
|
interface IDPadProps {
|
|
29
29
|
/** Callback fired when a direction is pressed */
|
|
30
30
|
onDirectionPress?: (direction: 'up' | 'down' | 'left' | 'right') => void;
|
|
31
|
+
/** Callback fired when a direction is released */
|
|
32
|
+
onDirectionRelease?: (direction: 'up' | 'down' | 'left' | 'right') => void;
|
|
31
33
|
/** Whether the component is disabled */
|
|
32
34
|
disabled?: boolean;
|
|
33
35
|
/** Additional options for customizing the D-pad */
|
|
@@ -179,6 +181,7 @@ const DPadContainer = memo(styled.div<IDPadContainerProps>`
|
|
|
179
181
|
export const JoystickDPad = memo(
|
|
180
182
|
({
|
|
181
183
|
onDirectionPress,
|
|
184
|
+
onDirectionRelease,
|
|
182
185
|
disabled = false,
|
|
183
186
|
options = {},
|
|
184
187
|
}: IDPadProps): JSX.Element => {
|
|
@@ -209,11 +212,14 @@ export const JoystickDPad = memo(
|
|
|
209
212
|
}, []);
|
|
210
213
|
|
|
211
214
|
const clearAllPresses = useCallback(() => {
|
|
215
|
+
if (activeDirectionRef.current && onDirectionRelease) {
|
|
216
|
+
onDirectionRelease(activeDirectionRef.current);
|
|
217
|
+
}
|
|
212
218
|
clearPressInterval();
|
|
213
219
|
setPressedButtons(new Set());
|
|
214
220
|
activeDirectionRef.current = null;
|
|
215
221
|
isPressedRef.current = false;
|
|
216
|
-
}, [clearPressInterval]);
|
|
222
|
+
}, [clearPressInterval, onDirectionRelease]);
|
|
217
223
|
|
|
218
224
|
const handleDirectionPress = useCallback(
|
|
219
225
|
(direction: 'up' | 'down' | 'left' | 'right') => {
|
|
@@ -176,20 +176,13 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
176
176
|
position: { x: 0, y: 0 },
|
|
177
177
|
isFocused: false,
|
|
178
178
|
});
|
|
179
|
-
}, [
|
|
180
|
-
containerType,
|
|
181
|
-
isDepotSystem,
|
|
182
|
-
setContextActions,
|
|
183
|
-
clearContextActions,
|
|
184
|
-
isContextMenuDisabled, // Added missing dependency
|
|
185
|
-
]);
|
|
186
179
|
|
|
187
|
-
useEffect(() => {
|
|
188
|
-
// Reset drag position and focus when item changes
|
|
189
180
|
clearDraggingState();
|
|
190
181
|
|
|
191
182
|
// Clear context actions when component unmounts or dependencies change
|
|
192
183
|
return () => {
|
|
184
|
+
clearDraggingState();
|
|
185
|
+
clearDetailsState();
|
|
193
186
|
clearContextActions();
|
|
194
187
|
};
|
|
195
188
|
}, [
|
|
@@ -198,7 +191,9 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
198
191
|
setContextActions,
|
|
199
192
|
clearContextActions,
|
|
200
193
|
isContextMenuDisabled,
|
|
201
|
-
|
|
194
|
+
clearDraggingState,
|
|
195
|
+
clearDetailsState,
|
|
196
|
+
updateDraggingState,
|
|
202
197
|
]);
|
|
203
198
|
|
|
204
199
|
const resetItem = () => {
|