@rpg-engine/long-bow 0.7.52 → 0.7.53
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 +28 -12
- 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 +28 -12
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +30 -11
package/dist/long-bow.esm.js
CHANGED
|
@@ -27936,6 +27936,9 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
27936
27936
|
var _useState6 = useState(null),
|
|
27937
27937
|
touchStartPosition = _useState6[0],
|
|
27938
27938
|
setTouchStartPosition = _useState6[1];
|
|
27939
|
+
var _useState7 = useState(false),
|
|
27940
|
+
isDragging = _useState7[0],
|
|
27941
|
+
setIsDragging = _useState7[1]; // New state to track dragging
|
|
27939
27942
|
useEffect(function () {
|
|
27940
27943
|
setDragState(function (prev) {
|
|
27941
27944
|
return _extends({}, prev, {
|
|
@@ -27979,7 +27982,8 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
27979
27982
|
var resetItem = function resetItem() {
|
|
27980
27983
|
setTooltipState(function (prev) {
|
|
27981
27984
|
return _extends({}, prev, {
|
|
27982
|
-
visible: false
|
|
27985
|
+
visible: false,
|
|
27986
|
+
mobileVisible: false
|
|
27983
27987
|
});
|
|
27984
27988
|
});
|
|
27985
27989
|
setDragState(function (prev) {
|
|
@@ -27987,6 +27991,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
27987
27991
|
wasDragged: false
|
|
27988
27992
|
});
|
|
27989
27993
|
});
|
|
27994
|
+
setIsDragging(false); // Reset dragging flag
|
|
27990
27995
|
};
|
|
27991
27996
|
var onSuccessfulDrag = function onSuccessfulDrag(quantity) {
|
|
27992
27997
|
resetItem();
|
|
@@ -28014,7 +28019,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28014
28019
|
setItemShortcut(item, index);
|
|
28015
28020
|
}
|
|
28016
28021
|
}
|
|
28017
|
-
//
|
|
28022
|
+
// Remove the class react-draggable-dragging from the element
|
|
28018
28023
|
// to prevent the item from being dragged again
|
|
28019
28024
|
target.classList.remove('react-draggable-dragging');
|
|
28020
28025
|
var isTouch = e.type.startsWith('touch');
|
|
@@ -28098,13 +28103,19 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28098
28103
|
}
|
|
28099
28104
|
}, 50);
|
|
28100
28105
|
} else if (item) {
|
|
28101
|
-
if (isTouch &&
|
|
28106
|
+
if (isTouch && isDragging) {
|
|
28107
|
+
// If it's a touch and we were dragging, do not show context menu
|
|
28108
|
+
return;
|
|
28109
|
+
} else if (isTouch && !isDrag) {
|
|
28110
|
+
// Handle as a tap/click
|
|
28102
28111
|
setTooltipState(function (prev) {
|
|
28103
28112
|
return _extends({}, prev, {
|
|
28104
28113
|
mobileVisible: true
|
|
28105
28114
|
});
|
|
28106
28115
|
});
|
|
28116
|
+
onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
28107
28117
|
} else if (!isTouch && !isContextMenuDisabled && !isSelectingShortcut) {
|
|
28118
|
+
// Handle as context menu for mouse devices
|
|
28108
28119
|
setContextMenuState(function (prev) {
|
|
28109
28120
|
return _extends({}, prev, {
|
|
28110
28121
|
visible: !contextMenuState.visible
|
|
@@ -28122,7 +28133,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28122
28133
|
});
|
|
28123
28134
|
}
|
|
28124
28135
|
}
|
|
28125
|
-
if (!isDrag
|
|
28136
|
+
if (!isDrag && !isTouch) {
|
|
28126
28137
|
console.log('Calling onPointerDown');
|
|
28127
28138
|
onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
28128
28139
|
}
|
|
@@ -28141,6 +28152,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28141
28152
|
if (onDragStart && containerType) {
|
|
28142
28153
|
onDragStart(item, slotIndex, containerType);
|
|
28143
28154
|
}
|
|
28155
|
+
setIsDragging(true); // Set dragging flag on start
|
|
28144
28156
|
};
|
|
28145
28157
|
var onDraggableProgress = function onDraggableProgress(_e, data) {
|
|
28146
28158
|
if (Math.abs(data.x - dragState.position.x) > 5 || Math.abs(data.y - dragState.position.y) > 5) {
|
|
@@ -28155,16 +28167,18 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28155
28167
|
setDraggingItem(item);
|
|
28156
28168
|
}
|
|
28157
28169
|
};
|
|
28158
|
-
var
|
|
28170
|
+
var onTouchStartHandler = function onTouchStartHandler(e) {
|
|
28159
28171
|
setTouchStartTime(new Date().getTime());
|
|
28160
28172
|
setTouchStartPosition({
|
|
28161
28173
|
x: e.touches[0].clientX,
|
|
28162
28174
|
y: e.touches[0].clientY
|
|
28163
28175
|
});
|
|
28164
28176
|
};
|
|
28165
|
-
var
|
|
28166
|
-
//
|
|
28167
|
-
|
|
28177
|
+
var onTouchEndHandler = function onTouchEndHandler(e) {
|
|
28178
|
+
// Only prevent default if not dragging
|
|
28179
|
+
if (!isDragging) {
|
|
28180
|
+
e.preventDefault();
|
|
28181
|
+
}
|
|
28168
28182
|
var touch = e.changedTouches[0];
|
|
28169
28183
|
var touchEndTime = new Date().getTime();
|
|
28170
28184
|
var touchDuration = touchStartTime ? touchEndTime - touchStartTime : 0;
|
|
@@ -28191,6 +28205,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28191
28205
|
});
|
|
28192
28206
|
(_document$elementFrom = document.elementFromPoint(touch.clientX, touch.clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
|
|
28193
28207
|
}
|
|
28208
|
+
setIsDragging(false); // Reset dragging flag on touch end
|
|
28194
28209
|
};
|
|
28195
28210
|
var bounds = getContainerBounds();
|
|
28196
28211
|
return React.createElement(Container$b, {
|
|
@@ -28207,8 +28222,8 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28207
28222
|
if (item) onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
28208
28223
|
},
|
|
28209
28224
|
isSelectingShortcut: isSelectingShortcut && ((item == null ? void 0 : item.type) === ItemType.Consumable || (item == null ? void 0 : item.type) === ItemType.Tool || (item == null ? void 0 : item.subType) === ItemSubType.Seed),
|
|
28210
|
-
onTouchStart:
|
|
28211
|
-
onTouchEnd:
|
|
28225
|
+
onTouchStart: onTouchStartHandler,
|
|
28226
|
+
onTouchEnd: onTouchEndHandler
|
|
28212
28227
|
}, React.createElement(Draggable, {
|
|
28213
28228
|
axis: isSelectingShortcut ? 'none' : 'both',
|
|
28214
28229
|
defaultClassName: item ? 'draggable' : 'empty-slot',
|
|
@@ -28294,8 +28309,9 @@ var Container$b = /*#__PURE__*/styled.div.withConfig({
|
|
|
28294
28309
|
var ItemContainer = /*#__PURE__*/styled.div.withConfig({
|
|
28295
28310
|
displayName: "ItemSlot__ItemContainer",
|
|
28296
28311
|
componentId: "sc-l2j5ef-1"
|
|
28297
|
-
})(["width:64px;height:64px;position:relative;", ";"], function (
|
|
28298
|
-
|
|
28312
|
+
})(["width:64px;height:64px;position:relative;", ";"], function (_ref7) {
|
|
28313
|
+
var isFocused = _ref7.isFocused;
|
|
28314
|
+
return isFocused ? 'z-index: 100; pointer-events: none;' : '';
|
|
28299
28315
|
});
|
|
28300
28316
|
|
|
28301
28317
|
var statisticsToDisplay = [{
|