@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.
@@ -27821,6 +27821,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27821
27821
  updateDetailsState = _useItemSlotDetails.updateDetailsState,
27822
27822
  setContextActions = _useItemSlotDetails.setContextActions;
27823
27823
  var isContextMenuVisible = detailsState.isContextMenuVisible,
27824
+ clearDetailsState = detailsState.clearDetailsState,
27824
27825
  clearContextActions = detailsState.clearContextActions;
27825
27826
  var dragContainer = React.useRef(null);
27826
27827
  var _useItemSlotDragging = useItemSlotDragging(),
@@ -27828,7 +27829,6 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27828
27829
  updateDraggingState = _useItemSlotDragging.updateDraggingState,
27829
27830
  clearDraggingState = _useItemSlotDragging.clearDraggingState;
27830
27831
  var isFocused = draggingState.isFocused,
27831
- dropPosition = draggingState.dropPosition,
27832
27832
  isDragging = draggingState.isDragging,
27833
27833
  draggingDistance = draggingState.draggingDistance;
27834
27834
  React.useEffect(function () {
@@ -27842,17 +27842,16 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27842
27842
  });
27843
27843
  }, [containerType, isDepotSystem, setContextActions, clearContextActions, isContextMenuDisabled]);
27844
27844
  React.useEffect(function () {
27845
- // Handle outside drop
27846
- if (onDrop && item && dropPosition) {
27847
- onDrop(item, dropPosition);
27848
- }
27849
- }, [dropPosition, onDrop, item]);
27845
+ // Reset drag position and focus when item changes
27846
+ clearDraggingState();
27847
+ // Clear context actions when component unmounts or dependencies change
27848
+ return function () {
27849
+ clearContextActions();
27850
+ };
27851
+ }, [containerType, isDepotSystem, setContextActions, clearContextActions, isContextMenuDisabled, updateDraggingState]);
27850
27852
  var resetItem = function resetItem() {
27851
27853
  clearDraggingState();
27852
- updateDetailsState({
27853
- item: item,
27854
- isTooltipVisible: false
27855
- });
27854
+ clearDetailsState();
27856
27855
  };
27857
27856
  var onSuccessfulDrag = function onSuccessfulDrag(quantity) {
27858
27857
  resetItem();
@@ -27958,12 +27957,12 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27958
27957
  y: matrix.m42
27959
27958
  };
27960
27959
  };
27961
- /**
27962
- * Processes the end of a drag event, handling quantity selection or resetting state.
27963
- */
27964
- var processDragEnd = function processDragEnd(item) {
27960
+ var processDragEnd = React.useCallback(function (item) {
27965
27961
  if (checkIfItemCanBeMoved != null && checkIfItemCanBeMoved()) {
27966
- if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd()) return;
27962
+ if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd()) {
27963
+ resetItem();
27964
+ return;
27965
+ }
27967
27966
  if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) {
27968
27967
  openQuantitySelector(item.stackQty, onSuccessfulDrag);
27969
27968
  } else {
@@ -27971,15 +27970,8 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27971
27970
  }
27972
27971
  } else {
27973
27972
  resetItem();
27974
- updateDraggingState({
27975
- isFocused: false,
27976
- position: {
27977
- x: 0,
27978
- y: 0
27979
- }
27980
- });
27981
27973
  }
27982
- };
27974
+ }, [checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, onSuccessfulDrag, resetItem]);
27983
27975
  /**
27984
27976
  * Handles the context menu or tooltip display after dragging stops without a drop.
27985
27977
  */