@rpg-engine/long-bow 0.7.40 → 0.7.42
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 +65 -9
- 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 +65 -9
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Equipment/EquipmentSet.tsx +1 -0
- package/src/components/Item/Inventory/ItemSlot.tsx +56 -7
package/dist/long-bow.esm.js
CHANGED
|
@@ -27931,6 +27931,12 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
27931
27931
|
var _useState4 = useState([]),
|
|
27932
27932
|
contextActions = _useState4[0],
|
|
27933
27933
|
setContextActions = _useState4[1];
|
|
27934
|
+
var _useState5 = useState(false),
|
|
27935
|
+
isClicking = _useState5[0],
|
|
27936
|
+
setIsClicking = _useState5[1];
|
|
27937
|
+
var clickTimeoutRef = useRef(null);
|
|
27938
|
+
// Add a ref to track touch events
|
|
27939
|
+
var isTouchEventRef = useRef(false);
|
|
27934
27940
|
useEffect(function () {
|
|
27935
27941
|
setDragState(function (prev) {
|
|
27936
27942
|
return _extends({}, prev, {
|
|
@@ -28119,22 +28125,69 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28119
28125
|
setDraggingItem(item);
|
|
28120
28126
|
}
|
|
28121
28127
|
};
|
|
28128
|
+
var handleMouseDown = function handleMouseDown(_e) {
|
|
28129
|
+
setIsClicking(true);
|
|
28130
|
+
clickTimeoutRef.current = setTimeout(function () {
|
|
28131
|
+
setIsClicking(false);
|
|
28132
|
+
// Allow dragging by setting wasDragged to true
|
|
28133
|
+
setDragState(function (prev) {
|
|
28134
|
+
return _extends({}, prev, {
|
|
28135
|
+
wasDragged: true,
|
|
28136
|
+
isFocused: true
|
|
28137
|
+
});
|
|
28138
|
+
});
|
|
28139
|
+
}, 200); // 200ms threshold for distinguishing click vs. hold
|
|
28140
|
+
};
|
|
28141
|
+
var handleMouseUp = function handleMouseUp(_e) {
|
|
28142
|
+
if (clickTimeoutRef.current) {
|
|
28143
|
+
clearTimeout(clickTimeoutRef.current);
|
|
28144
|
+
clickTimeoutRef.current = null;
|
|
28145
|
+
}
|
|
28146
|
+
if (isClicking && item) {
|
|
28147
|
+
// Always open the mobile menu when clicking an item
|
|
28148
|
+
setTooltipState(function (prev) {
|
|
28149
|
+
return _extends({}, prev, {
|
|
28150
|
+
mobileVisible: true
|
|
28151
|
+
});
|
|
28152
|
+
});
|
|
28153
|
+
setContextMenuState(function (prev) {
|
|
28154
|
+
return _extends({}, prev, {
|
|
28155
|
+
visible: false
|
|
28156
|
+
});
|
|
28157
|
+
}); // Ensure desktop menu is closed
|
|
28158
|
+
onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
28159
|
+
setIsClicking(false);
|
|
28160
|
+
} else if (onPlaceDrop && containerType) {
|
|
28161
|
+
// Handle item placement if not clicking (i.e., after dragging)
|
|
28162
|
+
var data = item ? item : null;
|
|
28163
|
+
onPlaceDrop(data, slotIndex, containerType);
|
|
28164
|
+
}
|
|
28165
|
+
// Reset drag state
|
|
28166
|
+
setDragState(function (prev) {
|
|
28167
|
+
return _extends({}, prev, {
|
|
28168
|
+
wasDragged: false
|
|
28169
|
+
});
|
|
28170
|
+
});
|
|
28171
|
+
};
|
|
28172
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
28173
|
+
if (clickTimeoutRef.current) {
|
|
28174
|
+
clearTimeout(clickTimeoutRef.current);
|
|
28175
|
+
clickTimeoutRef.current = null;
|
|
28176
|
+
}
|
|
28177
|
+
setIsClicking(false);
|
|
28178
|
+
};
|
|
28122
28179
|
var bounds = getContainerBounds();
|
|
28123
28180
|
return React.createElement(Container$b, {
|
|
28124
28181
|
isDraggingItem: !!draggingItem,
|
|
28125
28182
|
item: item,
|
|
28126
28183
|
className: "rpgui-icon empty-slot",
|
|
28127
|
-
onMouseUp: function onMouseUp() {
|
|
28128
|
-
var data = item ? item : null;
|
|
28129
|
-
if (onPlaceDrop && containerType) {
|
|
28130
|
-
onPlaceDrop(data, slotIndex, containerType);
|
|
28131
|
-
}
|
|
28132
|
-
},
|
|
28133
28184
|
onTouchEnd: function onTouchEnd(e) {
|
|
28134
28185
|
var _document$elementFrom;
|
|
28135
28186
|
var _e$changedTouches$ = e.changedTouches[0],
|
|
28136
28187
|
clientX = _e$changedTouches$.clientX,
|
|
28137
28188
|
clientY = _e$changedTouches$.clientY;
|
|
28189
|
+
// Set the flag to indicate a touch event
|
|
28190
|
+
isTouchEventRef.current = true;
|
|
28138
28191
|
var simulatedEvent = new MouseEvent('mouseup', {
|
|
28139
28192
|
clientX: clientX,
|
|
28140
28193
|
clientY: clientY,
|
|
@@ -28145,12 +28198,15 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28145
28198
|
onPointerDown: onDragStart !== undefined && onDragEnd !== undefined ? undefined : function () {
|
|
28146
28199
|
if (item) onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
28147
28200
|
},
|
|
28148
|
-
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)
|
|
28201
|
+
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),
|
|
28202
|
+
onMouseDown: handleMouseDown,
|
|
28203
|
+
onMouseUp: handleMouseUp,
|
|
28204
|
+
onMouseLeave: handleMouseLeave
|
|
28149
28205
|
}, React.createElement(Draggable, {
|
|
28150
28206
|
axis: isSelectingShortcut ? 'none' : 'both',
|
|
28151
28207
|
defaultClassName: item ? 'draggable' : 'empty-slot',
|
|
28152
28208
|
scale: dragScale,
|
|
28153
|
-
disabled: onDragStart === undefined || onDragEnd === undefined,
|
|
28209
|
+
disabled: isClicking || onDragStart === undefined || onDragEnd === undefined,
|
|
28154
28210
|
onStop: onDraggableStop,
|
|
28155
28211
|
onStart: onDraggableStart,
|
|
28156
28212
|
onDrag: onDraggableProgress,
|
|
@@ -29130,7 +29186,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29130
29186
|
var EquipmentSetContainer = /*#__PURE__*/styled.div.withConfig({
|
|
29131
29187
|
displayName: "EquipmentSet__EquipmentSetContainer",
|
|
29132
29188
|
componentId: "sc-1wuddg2-0"
|
|
29133
|
-
})(["width:inherit;display:flex;justify-content:center;flex-wrap:wrap;flex-direction:row;touch-action:none;"]);
|
|
29189
|
+
})(["width:inherit;display:flex;justify-content:center;flex-wrap:wrap;flex-direction:row;touch-action:none;overflow:hidden;"]);
|
|
29134
29190
|
var EquipmentColumn = /*#__PURE__*/styled.div.withConfig({
|
|
29135
29191
|
displayName: "EquipmentSet__EquipmentColumn",
|
|
29136
29192
|
componentId: "sc-1wuddg2-1"
|