@rpg-engine/long-bow 0.7.79 → 0.7.81
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 +15 -23
- 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 +15 -23
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +41 -35
package/package.json
CHANGED
|
@@ -153,7 +153,7 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
153
153
|
|
|
154
154
|
const {
|
|
155
155
|
isContextMenuVisible,
|
|
156
|
-
|
|
156
|
+
clearDetailsState,
|
|
157
157
|
clearContextActions,
|
|
158
158
|
} = detailsState;
|
|
159
159
|
|
|
@@ -165,12 +165,7 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
165
165
|
clearDraggingState,
|
|
166
166
|
} = useItemSlotDragging();
|
|
167
167
|
|
|
168
|
-
const {
|
|
169
|
-
isFocused,
|
|
170
|
-
dropPosition,
|
|
171
|
-
isDragging,
|
|
172
|
-
draggingDistance,
|
|
173
|
-
} = draggingState;
|
|
168
|
+
const { isFocused, isDragging, draggingDistance } = draggingState;
|
|
174
169
|
|
|
175
170
|
useEffect(() => {
|
|
176
171
|
// Reset drag position and focus when item changes
|
|
@@ -187,18 +182,25 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
187
182
|
]);
|
|
188
183
|
|
|
189
184
|
useEffect(() => {
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
185
|
+
// Reset drag position and focus when item changes
|
|
186
|
+
clearDraggingState();
|
|
187
|
+
|
|
188
|
+
// Clear context actions when component unmounts or dependencies change
|
|
189
|
+
return () => {
|
|
190
|
+
clearContextActions();
|
|
191
|
+
};
|
|
192
|
+
}, [
|
|
193
|
+
containerType,
|
|
194
|
+
isDepotSystem,
|
|
195
|
+
setContextActions,
|
|
196
|
+
clearContextActions,
|
|
197
|
+
isContextMenuDisabled,
|
|
198
|
+
updateDraggingState, // Add this dependency
|
|
199
|
+
]);
|
|
195
200
|
|
|
196
201
|
const resetItem = () => {
|
|
197
202
|
clearDraggingState();
|
|
198
|
-
|
|
199
|
-
item,
|
|
200
|
-
isTooltipVisible: false,
|
|
201
|
-
});
|
|
203
|
+
clearDetailsState();
|
|
202
204
|
};
|
|
203
205
|
|
|
204
206
|
const onSuccessfulDrag = (quantity?: number) => {
|
|
@@ -324,27 +326,31 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
324
326
|
return { x: matrix.m41, y: matrix.m42 };
|
|
325
327
|
};
|
|
326
328
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
329
|
+
const processDragEnd = useCallback(
|
|
330
|
+
(item: IItem) => {
|
|
331
|
+
if (checkIfItemCanBeMoved?.()) {
|
|
332
|
+
if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd()) {
|
|
333
|
+
resetItem();
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) {
|
|
338
|
+
openQuantitySelector(item.stackQty, onSuccessfulDrag);
|
|
339
|
+
} else {
|
|
340
|
+
onSuccessfulDrag(item.stackQty);
|
|
341
|
+
}
|
|
336
342
|
} else {
|
|
337
|
-
|
|
343
|
+
resetItem();
|
|
338
344
|
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
345
|
+
},
|
|
346
|
+
[
|
|
347
|
+
checkIfItemCanBeMoved,
|
|
348
|
+
checkIfItemShouldDragEnd,
|
|
349
|
+
openQuantitySelector,
|
|
350
|
+
onSuccessfulDrag,
|
|
351
|
+
resetItem,
|
|
352
|
+
]
|
|
353
|
+
);
|
|
348
354
|
|
|
349
355
|
/**
|
|
350
356
|
* Handles the context menu or tooltip display after dragging stops without a drop.
|