@rpg-engine/long-bow 0.7.80 → 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 +16 -17
- 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 -17
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +42 -24
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
|
|
|
@@ -181,12 +181,26 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
181
181
|
isContextMenuDisabled, // Added missing dependency
|
|
182
182
|
]);
|
|
183
183
|
|
|
184
|
+
useEffect(() => {
|
|
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
|
+
]);
|
|
200
|
+
|
|
184
201
|
const resetItem = () => {
|
|
185
202
|
clearDraggingState();
|
|
186
|
-
|
|
187
|
-
item,
|
|
188
|
-
isTooltipVisible: false,
|
|
189
|
-
});
|
|
203
|
+
clearDetailsState();
|
|
190
204
|
};
|
|
191
205
|
|
|
192
206
|
const onSuccessfulDrag = (quantity?: number) => {
|
|
@@ -312,27 +326,31 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
312
326
|
return { x: matrix.m41, y: matrix.m42 };
|
|
313
327
|
};
|
|
314
328
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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
|
+
}
|
|
324
342
|
} else {
|
|
325
|
-
|
|
343
|
+
resetItem();
|
|
326
344
|
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
345
|
+
},
|
|
346
|
+
[
|
|
347
|
+
checkIfItemCanBeMoved,
|
|
348
|
+
checkIfItemShouldDragEnd,
|
|
349
|
+
openQuantitySelector,
|
|
350
|
+
onSuccessfulDrag,
|
|
351
|
+
resetItem,
|
|
352
|
+
]
|
|
353
|
+
);
|
|
336
354
|
|
|
337
355
|
/**
|
|
338
356
|
* Handles the context menu or tooltip display after dragging stops without a drop.
|