@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
|
@@ -27821,6 +27821,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27821
27821
|
updateDetailsState = _useItemSlotDetails.updateDetailsState,
|
|
27822
27822
|
setContextActions = _useItemSlotDetails.setContextActions;
|
|
27823
27823
|
var isContextMenuVisible = detailsState.isContextMenuVisible,
|
|
27824
|
+
clearDetailsState = detailsState.clearDetailsState,
|
|
27824
27825
|
clearContextActions = detailsState.clearContextActions;
|
|
27825
27826
|
var dragContainer = React.useRef(null);
|
|
27826
27827
|
var _useItemSlotDragging = useItemSlotDragging(),
|
|
@@ -27840,12 +27841,17 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27840
27841
|
isFocused: false
|
|
27841
27842
|
});
|
|
27842
27843
|
}, [containerType, isDepotSystem, setContextActions, clearContextActions, isContextMenuDisabled]);
|
|
27844
|
+
React.useEffect(function () {
|
|
27845
|
+
// Reset drag position and focus when item changes
|
|
27846
|
+
clearDraggingState();
|
|
27847
|
+
// Clear context actions when component unmounts or dependencies change
|
|
27848
|
+
return function () {
|
|
27849
|
+
clearContextActions();
|
|
27850
|
+
};
|
|
27851
|
+
}, [containerType, isDepotSystem, setContextActions, clearContextActions, isContextMenuDisabled, updateDraggingState]);
|
|
27843
27852
|
var resetItem = function resetItem() {
|
|
27844
27853
|
clearDraggingState();
|
|
27845
|
-
|
|
27846
|
-
item: item,
|
|
27847
|
-
isTooltipVisible: false
|
|
27848
|
-
});
|
|
27854
|
+
clearDetailsState();
|
|
27849
27855
|
};
|
|
27850
27856
|
var onSuccessfulDrag = function onSuccessfulDrag(quantity) {
|
|
27851
27857
|
resetItem();
|
|
@@ -27951,12 +27957,12 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27951
27957
|
y: matrix.m42
|
|
27952
27958
|
};
|
|
27953
27959
|
};
|
|
27954
|
-
|
|
27955
|
-
* Processes the end of a drag event, handling quantity selection or resetting state.
|
|
27956
|
-
*/
|
|
27957
|
-
var processDragEnd = function processDragEnd(item) {
|
|
27960
|
+
var processDragEnd = React.useCallback(function (item) {
|
|
27958
27961
|
if (checkIfItemCanBeMoved != null && checkIfItemCanBeMoved()) {
|
|
27959
|
-
if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd())
|
|
27962
|
+
if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd()) {
|
|
27963
|
+
resetItem();
|
|
27964
|
+
return;
|
|
27965
|
+
}
|
|
27960
27966
|
if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) {
|
|
27961
27967
|
openQuantitySelector(item.stackQty, onSuccessfulDrag);
|
|
27962
27968
|
} else {
|
|
@@ -27964,15 +27970,8 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27964
27970
|
}
|
|
27965
27971
|
} else {
|
|
27966
27972
|
resetItem();
|
|
27967
|
-
updateDraggingState({
|
|
27968
|
-
isFocused: false,
|
|
27969
|
-
position: {
|
|
27970
|
-
x: 0,
|
|
27971
|
-
y: 0
|
|
27972
|
-
}
|
|
27973
|
-
});
|
|
27974
27973
|
}
|
|
27975
|
-
};
|
|
27974
|
+
}, [checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, onSuccessfulDrag, resetItem]);
|
|
27976
27975
|
/**
|
|
27977
27976
|
* Handles the context menu or tooltip display after dragging stops without a drop.
|
|
27978
27977
|
*/
|