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