@rpg-engine/long-bow 0.7.81 → 0.7.82
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/hooks/useTouchTarget.d.ts +5 -0
- package/dist/long-bow.cjs.development.js +21 -0
- 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 +22 -1
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +9 -1
- package/src/hooks/useTouchTarget.ts +38 -0
|
@@ -27377,6 +27377,23 @@ var Container$8 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
27377
27377
|
componentId: "sc-dgmp04-0"
|
|
27378
27378
|
})(["position:static !important;"]);
|
|
27379
27379
|
|
|
27380
|
+
function useTouchTarget() {
|
|
27381
|
+
var getTouchTarget = React.useCallback(function (e) {
|
|
27382
|
+
// Check if it's a touch event
|
|
27383
|
+
if ('changedTouches' in e || 'touches' in e) {
|
|
27384
|
+
var _touchEvent$changedTo, _touchEvent$touches;
|
|
27385
|
+
var touchEvent = e;
|
|
27386
|
+
var touch = ((_touchEvent$changedTo = touchEvent.changedTouches) == null ? void 0 : _touchEvent$changedTo[0]) || ((_touchEvent$touches = touchEvent.touches) == null ? void 0 : _touchEvent$touches[0]);
|
|
27387
|
+
if (touch) {
|
|
27388
|
+
return document.elementFromPoint(touch.clientX, touch.clientY);
|
|
27389
|
+
}
|
|
27390
|
+
}
|
|
27391
|
+
// If it's not a touch event or touch is not available, fallback to target
|
|
27392
|
+
return e.target || document.body;
|
|
27393
|
+
}, []);
|
|
27394
|
+
return getTouchTarget;
|
|
27395
|
+
}
|
|
27396
|
+
|
|
27380
27397
|
var rarityColor = function rarityColor(item) {
|
|
27381
27398
|
switch (item == null ? void 0 : item.rarity) {
|
|
27382
27399
|
case shared.ItemRarities.Uncommon:
|
|
@@ -27820,6 +27837,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27820
27837
|
detailsState = _useItemSlotDetails.detailsState,
|
|
27821
27838
|
updateDetailsState = _useItemSlotDetails.updateDetailsState,
|
|
27822
27839
|
setContextActions = _useItemSlotDetails.setContextActions;
|
|
27840
|
+
var getTouchTarget = useTouchTarget();
|
|
27823
27841
|
var isContextMenuVisible = detailsState.isContextMenuVisible,
|
|
27824
27842
|
clearDetailsState = detailsState.clearDetailsState,
|
|
27825
27843
|
clearContextActions = detailsState.clearContextActions;
|
|
@@ -27876,6 +27894,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27876
27894
|
item: null
|
|
27877
27895
|
});
|
|
27878
27896
|
var target = e.target;
|
|
27897
|
+
if (shared.isMobile()) {
|
|
27898
|
+
target = getTouchTarget(e);
|
|
27899
|
+
}
|
|
27879
27900
|
handleShortcutSetter(target);
|
|
27880
27901
|
removeDraggingClass(target);
|
|
27881
27902
|
var shouldHandleDraggedItemResult = shouldHandleDraggedItem();
|