@rpg-engine/long-bow 0.7.49 → 0.7.51
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 +16 -6
- 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 +16 -6
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +21 -14
package/package.json
CHANGED
|
@@ -215,6 +215,13 @@ export const ItemSlot = React.memo(
|
|
|
215
215
|
// to prevent the item from being dragged again
|
|
216
216
|
target.classList.remove('react-draggable-dragging');
|
|
217
217
|
|
|
218
|
+
const isTouch = e.type.startsWith('touch');
|
|
219
|
+
|
|
220
|
+
// Threshold for considering a tap/click as a drag
|
|
221
|
+
const dragThreshold = 5; // pixels
|
|
222
|
+
const isDrag =
|
|
223
|
+
Math.abs(data.x) > dragThreshold || Math.abs(data.y) > dragThreshold;
|
|
224
|
+
|
|
218
225
|
if (dragState.wasDragged && item && !isSelectingShortcut) {
|
|
219
226
|
//@ts-ignore
|
|
220
227
|
const classes: string[] = Array.from(e.target?.classList);
|
|
@@ -267,21 +274,15 @@ export const ItemSlot = React.memo(
|
|
|
267
274
|
}
|
|
268
275
|
}, 50);
|
|
269
276
|
} else if (item) {
|
|
270
|
-
|
|
271
|
-
|
|
277
|
+
if (isTouch && !isDrag) {
|
|
278
|
+
setTooltipState(prev => ({
|
|
279
|
+
...prev,
|
|
280
|
+
mobileVisible: true,
|
|
281
|
+
}));
|
|
282
|
+
} else if (
|
|
283
|
+
!isTouch &&
|
|
272
284
|
!isContextMenuDisabled &&
|
|
273
|
-
e.type === 'touchend' &&
|
|
274
285
|
!isSelectingShortcut
|
|
275
|
-
) {
|
|
276
|
-
isTouch = true;
|
|
277
|
-
setTooltipState(prev => ({ ...prev, mobileVisible: true }));
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (
|
|
281
|
-
!isContextMenuDisabled &&
|
|
282
|
-
!isSelectingShortcut &&
|
|
283
|
-
!isTouch &&
|
|
284
|
-
!dragState.wasDragged
|
|
285
286
|
) {
|
|
286
287
|
setContextMenuState(prev => ({
|
|
287
288
|
...prev,
|
|
@@ -301,8 +302,14 @@ export const ItemSlot = React.memo(
|
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
304
|
|
|
304
|
-
|
|
305
|
+
if (!isDrag || !isTouch) {
|
|
306
|
+
console.log('Calling onPointerDown');
|
|
307
|
+
onPointerDown(item.type, containerType ?? null, item);
|
|
308
|
+
}
|
|
305
309
|
}
|
|
310
|
+
|
|
311
|
+
setDragState(prev => ({ ...prev, wasDragged: false }));
|
|
312
|
+
console.log('Final dragState:', dragState);
|
|
306
313
|
};
|
|
307
314
|
|
|
308
315
|
const onDraggableStart: DraggableEventHandler = () => {
|