@rpg-engine/long-bow 0.7.64 → 0.7.66
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/long-bow.cjs.development.js +8 -7
- 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 -7
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +5 -0
- package/src/components/Item/Inventory/hooks/useItemSlotDragAndDrop.ts +23 -6
package/package.json
CHANGED
|
@@ -98,6 +98,7 @@ export const useItemSlotDragAndDrop = ({
|
|
|
98
98
|
isFocused: false,
|
|
99
99
|
position: { x: 0, y: 0 },
|
|
100
100
|
}));
|
|
101
|
+
setDraggingItem(null);
|
|
101
102
|
}, [setTooltipState]);
|
|
102
103
|
|
|
103
104
|
const handleSuccessfulDrag = useCallback(
|
|
@@ -120,8 +121,10 @@ export const useItemSlotDragAndDrop = ({
|
|
|
120
121
|
const onDraggableProgress: DraggableEventHandler = useCallback(
|
|
121
122
|
(_e, data) => {
|
|
122
123
|
const { x, y } = dragState.position;
|
|
123
|
-
if (Math.abs(data.x - x) >
|
|
124
|
+
if (Math.abs(data.x - x) > 20 || Math.abs(data.y - y) > 20) {
|
|
124
125
|
setDragState(prev => ({ ...prev, wasDragged: true, isFocused: true }));
|
|
126
|
+
} else {
|
|
127
|
+
resetDragState();
|
|
125
128
|
}
|
|
126
129
|
if (!draggingItem) {
|
|
127
130
|
setDraggingItem(item);
|
|
@@ -132,9 +135,6 @@ export const useItemSlotDragAndDrop = ({
|
|
|
132
135
|
|
|
133
136
|
const onDraggableStop: DraggableEventHandler = useCallback(
|
|
134
137
|
(e, data) => {
|
|
135
|
-
setTimeout(() => {
|
|
136
|
-
setDraggingItem(null);
|
|
137
|
-
}, 50);
|
|
138
138
|
const target = e.target as HTMLElement;
|
|
139
139
|
if (!target) return;
|
|
140
140
|
|
|
@@ -178,14 +178,31 @@ export const useItemSlotDragAndDrop = ({
|
|
|
178
178
|
}, 50);
|
|
179
179
|
} else if (item) {
|
|
180
180
|
const isTouch = e.type === 'touchend';
|
|
181
|
+
|
|
182
|
+
console.log(`Debug:
|
|
183
|
+
isTouch: ${isTouch},
|
|
184
|
+
isSelectingShortcut: ${isSelectingShortcut},
|
|
185
|
+
draggingItem: ${draggingItem},
|
|
186
|
+
dragState.wasDragged: ${dragState.wasDragged},
|
|
187
|
+
dragState.isFocused: ${dragState.isFocused}
|
|
188
|
+
`);
|
|
189
|
+
|
|
181
190
|
if (
|
|
182
191
|
!isContextMenuDisabled &&
|
|
183
192
|
isTouch &&
|
|
184
193
|
!isSelectingShortcut &&
|
|
185
|
-
!draggingItem
|
|
194
|
+
!draggingItem &&
|
|
195
|
+
!dragState.wasDragged &&
|
|
196
|
+
!dragState.isFocused
|
|
186
197
|
) {
|
|
187
198
|
setTooltipState(prev => ({ ...prev, mobileVisible: true }));
|
|
188
|
-
} else if (
|
|
199
|
+
} else if (
|
|
200
|
+
!isContextMenuDisabled &&
|
|
201
|
+
!isSelectingShortcut &&
|
|
202
|
+
!isTouch &&
|
|
203
|
+
!dragState.wasDragged &&
|
|
204
|
+
!dragState.isFocused
|
|
205
|
+
) {
|
|
189
206
|
const event = e as MouseEvent;
|
|
190
207
|
setContextMenuState(prev => ({
|
|
191
208
|
visible: !prev.visible,
|