@rpg-engine/long-bow 0.7.77 → 0.7.79
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 +22 -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 +22 -23
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +34 -25
- package/src/components/Item/Inventory/context/ItemSlotDetailsContext.tsx +0 -2
|
@@ -27707,10 +27707,8 @@ var ItemSlotDetailsProvider = function ItemSlotDetailsProvider(_ref) {
|
|
|
27707
27707
|
setDetailsState(initialDetailsState);
|
|
27708
27708
|
}, [setDetailsState]);
|
|
27709
27709
|
var setContextActions = React.useCallback(function (item, containerType, isDepotSystem, isContextMenuDisabled) {
|
|
27710
|
-
console.log('ITEM SLOT: Set context actions for', item == null ? void 0 : item.key);
|
|
27711
27710
|
if (item && containerType && !isContextMenuDisabled) {
|
|
27712
27711
|
var newContextActions = generateContextMenu(item, containerType, isDepotSystem);
|
|
27713
|
-
console.log('ITEM SLOT: New context actions:', newContextActions);
|
|
27714
27712
|
updateDetailsState({
|
|
27715
27713
|
contextActions: newContextActions
|
|
27716
27714
|
});
|
|
@@ -27845,12 +27843,10 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27845
27843
|
}, [containerType, isDepotSystem, setContextActions, clearContextActions, isContextMenuDisabled]);
|
|
27846
27844
|
React.useEffect(function () {
|
|
27847
27845
|
// Handle outside drop
|
|
27848
|
-
if (onDrop &&
|
|
27849
|
-
|
|
27850
|
-
onDrop(draggingState.item, dropPosition);
|
|
27851
|
-
clearDraggingState();
|
|
27846
|
+
if (onDrop && item && dropPosition) {
|
|
27847
|
+
onDrop(item, dropPosition);
|
|
27852
27848
|
}
|
|
27853
|
-
}, [dropPosition, onDrop,
|
|
27849
|
+
}, [dropPosition, onDrop, item]);
|
|
27854
27850
|
var resetItem = function resetItem() {
|
|
27855
27851
|
clearDraggingState();
|
|
27856
27852
|
updateDetailsState({
|
|
@@ -27917,21 +27913,24 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27917
27913
|
/**
|
|
27918
27914
|
* Handles the logic when an item has been dragged.
|
|
27919
27915
|
*/
|
|
27920
|
-
var handleDraggedItem = function
|
|
27921
|
-
|
|
27922
|
-
|
|
27923
|
-
|
|
27924
|
-
|
|
27925
|
-
|
|
27926
|
-
|
|
27927
|
-
|
|
27928
|
-
|
|
27929
|
-
|
|
27930
|
-
|
|
27931
|
-
|
|
27932
|
-
|
|
27933
|
-
}
|
|
27916
|
+
var handleDraggedItem = React.useCallback(function (e, data) {
|
|
27917
|
+
var targetClasses = Array.from(e.target.classList);
|
|
27918
|
+
var isOutsideDrop = targetClasses.some(function (elm) {
|
|
27919
|
+
return elm.includes('rpgui-content');
|
|
27920
|
+
}) || targetClasses.length === 0;
|
|
27921
|
+
if (isOutsideDrop && draggingState.isDragging && draggingState.item) {
|
|
27922
|
+
console.log('ITEM SLOT: Outside drop', draggingState.item.key);
|
|
27923
|
+
onDrop == null ? void 0 : onDrop(draggingState.item, {
|
|
27924
|
+
x: data.x,
|
|
27925
|
+
y: data.y
|
|
27926
|
+
});
|
|
27927
|
+
clearDraggingState();
|
|
27928
|
+
} else {
|
|
27934
27929
|
updateDraggingState({
|
|
27930
|
+
dropPosition: {
|
|
27931
|
+
x: data.x,
|
|
27932
|
+
y: data.y
|
|
27933
|
+
},
|
|
27935
27934
|
isDragging: false
|
|
27936
27935
|
});
|
|
27937
27936
|
var targetElement = dragContainer.current;
|
|
@@ -27946,8 +27945,8 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27946
27945
|
}
|
|
27947
27946
|
});
|
|
27948
27947
|
processDragEnd(item);
|
|
27949
|
-
}
|
|
27950
|
-
};
|
|
27948
|
+
}
|
|
27949
|
+
}, [draggingState.isDragging, draggingState.item, onDrop, clearDraggingState, updateDraggingState]);
|
|
27951
27950
|
/**
|
|
27952
27951
|
* Retrieves the current transform position of the dragged element.
|
|
27953
27952
|
*/
|