@rpg-engine/long-bow 0.7.74 → 0.7.76
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/components/Item/Inventory/ItemSlot.d.ts +25 -0
- package/dist/components/Item/Inventory/context/ItemSlotDetailsContext.d.ts +1 -1
- package/dist/long-bow.cjs.development.js +11 -11
- 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 +11 -11
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +57 -18
- package/src/components/Item/Inventory/context/ItemSlotDetailsContext.tsx +7 -3
|
@@ -27,5 +27,30 @@ interface IProps {
|
|
|
27
27
|
setItemShortcut?: (item: IItem, shortcutIndex: number) => void;
|
|
28
28
|
isDepotSystem?: boolean;
|
|
29
29
|
}
|
|
30
|
+
interface IProps {
|
|
31
|
+
slotIndex: number;
|
|
32
|
+
item: IItem | null;
|
|
33
|
+
itemContainer?: IItemContainer | null;
|
|
34
|
+
itemContainerType?: ItemContainerType | null;
|
|
35
|
+
slotSpriteMask?: ItemSlotType | null;
|
|
36
|
+
onMouseOver?: (event: any, slotIndex: number, item: IItem | null, x: number, y: number) => void;
|
|
37
|
+
onMouseOut?: () => void;
|
|
38
|
+
onPointerDown: (ItemType: ItemType, itemContainerType: ItemContainerType | null, item: IItem) => void;
|
|
39
|
+
onDragStart?: (item: IItem, slotIndex: number, itemContainerType: ItemContainerType | null) => void;
|
|
40
|
+
onDragEnd?: (quantity?: number) => void;
|
|
41
|
+
onOutsideDrop?: (item: IItem, position: IPosition) => void;
|
|
42
|
+
dragScale?: number;
|
|
43
|
+
checkIfItemCanBeMoved?: () => boolean;
|
|
44
|
+
checkIfItemShouldDragEnd?: () => boolean;
|
|
45
|
+
openQuantitySelector?: (maxQuantity: number, callback: () => void) => void;
|
|
46
|
+
onPlaceDrop?: (item: IItem | null, slotIndex: number, itemContainerType: ItemContainerType | null) => void;
|
|
47
|
+
atlasJSON: any;
|
|
48
|
+
atlasIMG: any;
|
|
49
|
+
isContextMenuDisabled?: boolean;
|
|
50
|
+
isSelectingShortcut?: boolean;
|
|
51
|
+
equipmentSet?: IEquipmentSet | null;
|
|
52
|
+
setItemShortcut?: (item: IItem, shortcutIndex: number) => void;
|
|
53
|
+
isDepotSystem?: boolean;
|
|
54
|
+
}
|
|
30
55
|
export declare const ItemSlot: React.FC<IProps>;
|
|
31
56
|
export {};
|
|
@@ -19,7 +19,7 @@ interface IItemSlotDetailsContext {
|
|
|
19
19
|
detailsState: IItemSlotDetailsState;
|
|
20
20
|
updateDetailsState: (newState: Partial<IItemSlotDetailsState>) => void;
|
|
21
21
|
clearDetailsState: () => void;
|
|
22
|
-
setContextActions: (item: IItem | null, containerType: string | null, isDepotSystem: boolean) => void;
|
|
22
|
+
setContextActions: (item: IItem | null, containerType: string | null, isDepotSystem: boolean, isContextMenuDisabled: boolean) => void;
|
|
23
23
|
clearContextActions: () => void;
|
|
24
24
|
}
|
|
25
25
|
export declare const useItemSlotDetails: () => IItemSlotDetailsContext;
|
|
@@ -27706,9 +27706,11 @@ var ItemSlotDetailsProvider = function ItemSlotDetailsProvider(_ref) {
|
|
|
27706
27706
|
var clearDetailsState = React.useCallback(function () {
|
|
27707
27707
|
setDetailsState(initialDetailsState);
|
|
27708
27708
|
}, [setDetailsState]);
|
|
27709
|
-
var setContextActions = React.useCallback(function (item, containerType, isDepotSystem) {
|
|
27710
|
-
|
|
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
|
+
if (item && containerType && !isContextMenuDisabled) {
|
|
27711
27712
|
var newContextActions = generateContextMenu(item, containerType, isDepotSystem);
|
|
27713
|
+
console.log('ITEM SLOT: New context actions:', newContextActions);
|
|
27712
27714
|
updateDetailsState({
|
|
27713
27715
|
contextActions: newContextActions
|
|
27714
27716
|
});
|
|
@@ -27840,19 +27842,13 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27840
27842
|
},
|
|
27841
27843
|
isFocused: false
|
|
27842
27844
|
});
|
|
27843
|
-
|
|
27844
|
-
if (item && containerType && !isContextMenuDisabled) {
|
|
27845
|
-
setContextActions(item, containerType, isDepotSystem != null ? isDepotSystem : false);
|
|
27846
|
-
} else {
|
|
27847
|
-
clearContextActions();
|
|
27848
|
-
}
|
|
27849
|
-
}, [item, containerType, isDepotSystem, setContextActions, clearContextActions]);
|
|
27845
|
+
}, [containerType, isDepotSystem, setContextActions, clearContextActions, isContextMenuDisabled]);
|
|
27850
27846
|
React.useEffect(function () {
|
|
27851
27847
|
// Handle outside drop
|
|
27852
27848
|
if (onDrop && item && dropPosition) {
|
|
27853
27849
|
onDrop(item, dropPosition);
|
|
27854
27850
|
}
|
|
27855
|
-
}, [dropPosition]);
|
|
27851
|
+
}, [dropPosition, onDrop, item]);
|
|
27856
27852
|
var resetItem = function resetItem() {
|
|
27857
27853
|
clearDraggingState();
|
|
27858
27854
|
updateDetailsState({
|
|
@@ -27874,6 +27870,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27874
27870
|
onDragEnd == null ? void 0 : onDragEnd(quantity);
|
|
27875
27871
|
}
|
|
27876
27872
|
};
|
|
27873
|
+
var refreshContextActions = function refreshContextActions() {
|
|
27874
|
+
setContextActions(item, containerType, isDepotSystem != null ? isDepotSystem : false, isContextMenuDisabled);
|
|
27875
|
+
};
|
|
27877
27876
|
var onDraggableStop = function onDraggableStop(e, data) {
|
|
27878
27877
|
requestAnimationFrame(function () {
|
|
27879
27878
|
updateDraggingState({
|
|
@@ -28013,6 +28012,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
28013
28012
|
if (!item || isSelectingShortcut) {
|
|
28014
28013
|
return;
|
|
28015
28014
|
}
|
|
28015
|
+
refreshContextActions();
|
|
28016
28016
|
if (onDragStart && containerType) {
|
|
28017
28017
|
onDragStart(item, slotIndex, containerType);
|
|
28018
28018
|
}
|
|
@@ -28101,7 +28101,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
28101
28101
|
var Container$9 = /*#__PURE__*/styled__default.div.withConfig({
|
|
28102
28102
|
displayName: "ItemSlot__Container",
|
|
28103
28103
|
componentId: "sc-l2j5ef-0"
|
|
28104
|
-
})(["margin:0.1rem
|
|
28104
|
+
})(["margin:0.1rem;.react-draggable-dragging{opacity:", ";}position:relative;.sprite-from-atlas-img--item{position:relative;top:1.5rem;left:1.5rem;border-color:", ";box-shadow:", " inset,", ";}&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;border-radius:12px;pointer-events:none;animation:", ";@keyframes bg-color-change{0%{background-color:rgba(255 255 255 / 0.5);}50%{background-color:transparent;}100%{background-color:rgba(255 255 255 / 0.5);}}}"], function (_ref2) {
|
|
28105
28105
|
var isDraggingItem = _ref2.isDraggingItem;
|
|
28106
28106
|
return isDraggingItem ? 0 : 1;
|
|
28107
28107
|
}, function (_ref3) {
|