@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
package/dist/long-bow.esm.js
CHANGED
|
@@ -27701,10 +27701,8 @@ var ItemSlotDetailsProvider = function ItemSlotDetailsProvider(_ref) {
|
|
|
27701
27701
|
setDetailsState(initialDetailsState);
|
|
27702
27702
|
}, [setDetailsState]);
|
|
27703
27703
|
var setContextActions = useCallback(function (item, containerType, isDepotSystem, isContextMenuDisabled) {
|
|
27704
|
-
console.log('ITEM SLOT: Set context actions for', item == null ? void 0 : item.key);
|
|
27705
27704
|
if (item && containerType && !isContextMenuDisabled) {
|
|
27706
27705
|
var newContextActions = generateContextMenu(item, containerType, isDepotSystem);
|
|
27707
|
-
console.log('ITEM SLOT: New context actions:', newContextActions);
|
|
27708
27706
|
updateDetailsState({
|
|
27709
27707
|
contextActions: newContextActions
|
|
27710
27708
|
});
|
|
@@ -27839,12 +27837,10 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
27839
27837
|
}, [containerType, isDepotSystem, setContextActions, clearContextActions, isContextMenuDisabled]);
|
|
27840
27838
|
useEffect(function () {
|
|
27841
27839
|
// Handle outside drop
|
|
27842
|
-
if (onDrop &&
|
|
27843
|
-
|
|
27844
|
-
onDrop(draggingState.item, dropPosition);
|
|
27845
|
-
clearDraggingState();
|
|
27840
|
+
if (onDrop && item && dropPosition) {
|
|
27841
|
+
onDrop(item, dropPosition);
|
|
27846
27842
|
}
|
|
27847
|
-
}, [dropPosition, onDrop,
|
|
27843
|
+
}, [dropPosition, onDrop, item]);
|
|
27848
27844
|
var resetItem = function resetItem() {
|
|
27849
27845
|
clearDraggingState();
|
|
27850
27846
|
updateDetailsState({
|
|
@@ -27911,21 +27907,24 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
27911
27907
|
/**
|
|
27912
27908
|
* Handles the logic when an item has been dragged.
|
|
27913
27909
|
*/
|
|
27914
|
-
var handleDraggedItem = function
|
|
27915
|
-
|
|
27916
|
-
|
|
27917
|
-
|
|
27918
|
-
|
|
27919
|
-
|
|
27920
|
-
|
|
27921
|
-
|
|
27922
|
-
|
|
27923
|
-
|
|
27924
|
-
|
|
27925
|
-
|
|
27926
|
-
|
|
27927
|
-
}
|
|
27910
|
+
var handleDraggedItem = useCallback(function (e, data) {
|
|
27911
|
+
var targetClasses = Array.from(e.target.classList);
|
|
27912
|
+
var isOutsideDrop = targetClasses.some(function (elm) {
|
|
27913
|
+
return elm.includes('rpgui-content');
|
|
27914
|
+
}) || targetClasses.length === 0;
|
|
27915
|
+
if (isOutsideDrop && draggingState.isDragging && draggingState.item) {
|
|
27916
|
+
console.log('ITEM SLOT: Outside drop', draggingState.item.key);
|
|
27917
|
+
onDrop == null ? void 0 : onDrop(draggingState.item, {
|
|
27918
|
+
x: data.x,
|
|
27919
|
+
y: data.y
|
|
27920
|
+
});
|
|
27921
|
+
clearDraggingState();
|
|
27922
|
+
} else {
|
|
27928
27923
|
updateDraggingState({
|
|
27924
|
+
dropPosition: {
|
|
27925
|
+
x: data.x,
|
|
27926
|
+
y: data.y
|
|
27927
|
+
},
|
|
27929
27928
|
isDragging: false
|
|
27930
27929
|
});
|
|
27931
27930
|
var targetElement = dragContainer.current;
|
|
@@ -27940,8 +27939,8 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
27940
27939
|
}
|
|
27941
27940
|
});
|
|
27942
27941
|
processDragEnd(item);
|
|
27943
|
-
}
|
|
27944
|
-
};
|
|
27942
|
+
}
|
|
27943
|
+
}, [draggingState.isDragging, draggingState.item, onDrop, clearDraggingState, updateDraggingState]);
|
|
27945
27944
|
/**
|
|
27946
27945
|
* Retrieves the current transform position of the dragged element.
|
|
27947
27946
|
*/
|