@rpg-engine/long-bow 0.7.75 → 0.7.77

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.
@@ -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
- if (item && containerType) {
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,15 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27840
27842
  },
27841
27843
  isFocused: false
27842
27844
  });
27843
- // Update context actions when item or depot system changes
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
- if (onDrop && item && dropPosition) {
27853
- onDrop(item, dropPosition);
27848
+ if (onDrop && draggingState.item && dropPosition) {
27849
+ console.log('ITEM SLOT: Outside drop', draggingState.item.key);
27850
+ onDrop(draggingState.item, dropPosition);
27851
+ clearDraggingState();
27854
27852
  }
27855
- }, [dropPosition]);
27853
+ }, [dropPosition, onDrop, draggingState.item]);
27856
27854
  var resetItem = function resetItem() {
27857
27855
  clearDraggingState();
27858
27856
  updateDetailsState({
@@ -27874,6 +27872,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27874
27872
  onDragEnd == null ? void 0 : onDragEnd(quantity);
27875
27873
  }
27876
27874
  };
27875
+ var refreshContextActions = function refreshContextActions() {
27876
+ setContextActions(item, containerType, isDepotSystem != null ? isDepotSystem : false, isContextMenuDisabled);
27877
+ };
27877
27878
  var onDraggableStop = function onDraggableStop(e, data) {
27878
27879
  requestAnimationFrame(function () {
27879
27880
  updateDraggingState({
@@ -28013,6 +28014,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28013
28014
  if (!item || isSelectingShortcut) {
28014
28015
  return;
28015
28016
  }
28017
+ refreshContextActions();
28016
28018
  if (onDragStart && containerType) {
28017
28019
  onDragStart(item, slotIndex, containerType);
28018
28020
  }