@rpg-engine/long-bow 0.7.67 → 0.7.68

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.
@@ -27662,17 +27662,13 @@ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27662
27662
  _onSelected = _ref.onSelected,
27663
27663
  atlasIMG = _ref.atlasIMG,
27664
27664
  atlasJSON = _ref.atlasJSON,
27665
- equipmentSet = _ref.equipmentSet,
27666
- isDragging = _ref.isDragging,
27667
- isSelectingShortcut = _ref.isSelectingShortcut,
27668
- showTooltipDelayed = _ref.showTooltipDelayed;
27669
- var canShow = !isDragging || !isSelectingShortcut || showTooltipDelayed;
27670
- return React.createElement(React.Fragment, null, tooltipState.visible && item && !isFocused && canShow && React.createElement(ItemTooltip, {
27665
+ equipmentSet = _ref.equipmentSet;
27666
+ return React.createElement(React.Fragment, null, tooltipState.visible && item && !isFocused && React.createElement(ItemTooltip, {
27671
27667
  item: item,
27672
27668
  atlasIMG: atlasIMG,
27673
27669
  atlasJSON: atlasJSON,
27674
27670
  equipmentSet: equipmentSet
27675
- }), tooltipState.mobileVisible && item && canShow && React.createElement(MobileItemTooltip, {
27671
+ }), tooltipState.mobileVisible && item && React.createElement(MobileItemTooltip, {
27676
27672
  item: item,
27677
27673
  atlasIMG: atlasIMG,
27678
27674
  atlasJSON: atlasJSON,
@@ -27696,7 +27692,7 @@ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27696
27692
  _onSelected == null ? void 0 : _onSelected(optionId, item);
27697
27693
  }
27698
27694
  }
27699
- }), !isContextMenuDisabled && contextMenuState.visible && contextActions && canShow && React.createElement(RelativeListMenu, {
27695
+ }), !isContextMenuDisabled && contextMenuState.visible && contextActions && React.createElement(RelativeListMenu, {
27700
27696
  options: contextActions,
27701
27697
  onSelected: function onSelected(optionId) {
27702
27698
  setContextMenuState(function (prev) {
@@ -27721,23 +27717,46 @@ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27721
27717
 
27722
27718
  var DraggingContext = /*#__PURE__*/createContext({
27723
27719
  item: null,
27724
- setDraggingItem: function setDraggingItem() {}
27720
+ setDraggingItem: function setDraggingItem() {},
27721
+ dragState: {
27722
+ isFocused: false,
27723
+ wasDragged: false,
27724
+ position: {
27725
+ x: 0,
27726
+ y: 0
27727
+ },
27728
+ dropPosition: null
27729
+ },
27730
+ setDragState: function setDragState() {}
27725
27731
  });
27726
- var useDragging = function useDragging() {
27727
- return useContext(DraggingContext);
27728
- };
27729
27732
  var DraggingProvider = function DraggingProvider(_ref) {
27730
27733
  var children = _ref.children;
27731
27734
  var _useState = useState(null),
27732
27735
  item = _useState[0],
27733
27736
  setDraggingItem = _useState[1];
27737
+ var _useState2 = useState({
27738
+ isFocused: false,
27739
+ wasDragged: false,
27740
+ position: {
27741
+ x: 0,
27742
+ y: 0
27743
+ },
27744
+ dropPosition: null
27745
+ }),
27746
+ dragState = _useState2[0],
27747
+ setDragState = _useState2[1];
27734
27748
  return React.createElement(DraggingContext.Provider, {
27735
27749
  value: {
27736
27750
  item: item,
27737
- setDraggingItem: setDraggingItem
27751
+ setDraggingItem: setDraggingItem,
27752
+ dragState: dragState,
27753
+ setDragState: setDragState
27738
27754
  }
27739
27755
  }, children);
27740
27756
  };
27757
+ var useDragging = function useDragging() {
27758
+ return useContext(DraggingContext);
27759
+ };
27741
27760
 
27742
27761
  var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27743
27762
  var isDepotSystem = _ref.isDepotSystem,
@@ -27759,18 +27778,9 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27759
27778
  var dragContainer = useRef(null);
27760
27779
  var _useDragging = useDragging(),
27761
27780
  draggingItem = _useDragging.item,
27762
- setDraggingItem = _useDragging.setDraggingItem;
27763
- var _useState = useState({
27764
- isFocused: false,
27765
- wasDragged: false,
27766
- position: {
27767
- x: 0,
27768
- y: 0
27769
- },
27770
- dropPosition: null
27771
- }),
27772
- dragState = _useState[0],
27773
- setDragState = _useState[1];
27781
+ setDraggingItem = _useDragging.setDraggingItem,
27782
+ dragState = _useDragging.dragState,
27783
+ setDragState = _useDragging.setDragState;
27774
27784
  useEffect(function () {
27775
27785
  setDragState(function (prev) {
27776
27786
  return _extends({}, prev, {
@@ -27781,7 +27791,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27781
27791
  isFocused: false
27782
27792
  });
27783
27793
  });
27784
- }, [item, isDepotSystem]);
27794
+ }, [item, isDepotSystem, setDragState]);
27785
27795
  useEffect(function () {
27786
27796
  if (onDrop && item && dragState.dropPosition) {
27787
27797
  onDrop(item, dragState.dropPosition);
@@ -27809,11 +27819,6 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27809
27819
  };
27810
27820
  }, []);
27811
27821
  var resetDragState = useCallback(function () {
27812
- setTooltipState(function (prev) {
27813
- return _extends({}, prev, {
27814
- visible: false
27815
- });
27816
- });
27817
27822
  setDragState(function (prev) {
27818
27823
  return _extends({}, prev, {
27819
27824
  wasDragged: false,
@@ -27824,7 +27829,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27824
27829
  }
27825
27830
  });
27826
27831
  });
27827
- }, [setTooltipState]);
27832
+ }, [setTooltipState, setDragState]);
27828
27833
  var handleSuccessfulDrag = useCallback(function (quantity) {
27829
27834
  resetDragState();
27830
27835
  if (quantity !== -1 && item) {
@@ -27852,7 +27857,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27852
27857
  if (!draggingItem) {
27853
27858
  setDraggingItem(item);
27854
27859
  }
27855
- }, [dragState.position, draggingItem, item, setDraggingItem]);
27860
+ }, [dragState.position, draggingItem, item, setDraggingItem, setDragState]);
27856
27861
  var onDraggableStop = useCallback(function (e, data) {
27857
27862
  setTimeout(function () {
27858
27863
  setDraggingItem(null);
@@ -28112,12 +28117,6 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28112
28117
  var _useState3 = useState([]),
28113
28118
  contextActions = _useState3[0],
28114
28119
  setContextActions = _useState3[1];
28115
- var isDraggingDisabled = useMemo(function () {
28116
- return contextMenuState.visible || onDragStart === undefined || onDragEnd === undefined;
28117
- }, [contextMenuState.visible, onDragStart, onDragEnd]);
28118
- useEffect(function () {
28119
- console.log('isDraggingDisabled', isDraggingDisabled);
28120
- }, [isDraggingDisabled]);
28121
28120
  var _useItemSlotDragAndDr = useItemSlotDragAndDrop({
28122
28121
  isDepotSystem: !!isDepotSystem,
28123
28122
  item: item,
@@ -28191,22 +28190,6 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28191
28190
  (_document$elementFrom = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28192
28191
  }
28193
28192
  }, [onMouseOut]);
28194
- var _useState4 = useState(false),
28195
- showTooltipDelayed = _useState4[0],
28196
- setShowTooltipDelayed = _useState4[1];
28197
- //@ts-ignore
28198
- useEffect(function () {
28199
- if (tooltipState.visible && !isDraggingDisabled) {
28200
- var timer = setTimeout(function () {
28201
- return setShowTooltipDelayed(true);
28202
- }, 50);
28203
- return function () {
28204
- return clearTimeout(timer);
28205
- };
28206
- } else {
28207
- setShowTooltipDelayed(false);
28208
- }
28209
- }, [tooltipState.visible, isDraggingDisabled]);
28210
28193
  return React.createElement(Container$b, {
28211
28194
  isDraggingItem: !!draggingItem,
28212
28195
  item: item,
@@ -28223,7 +28206,6 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28223
28206
  },
28224
28207
  onTouchEnd: function onTouchEnd(e) {
28225
28208
  var _document$elementFrom2;
28226
- handleInteractionEnd(e);
28227
28209
  var _e$changedTouches$ = e.changedTouches[0],
28228
28210
  clientX = _e$changedTouches$.clientX,
28229
28211
  clientY = _e$changedTouches$.clientY;
@@ -28242,7 +28224,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28242
28224
  axis: isSelectingShortcut ? 'none' : 'both',
28243
28225
  defaultClassName: item ? 'draggable' : 'empty-slot',
28244
28226
  scale: dragScale,
28245
- disabled: isDraggingDisabled,
28227
+ disabled: onDragStart === undefined || onDragEnd === undefined,
28246
28228
  onStop: onDraggableStop,
28247
28229
  onStart: onDraggableStart,
28248
28230
  onDrag: onDraggableProgress,
@@ -28263,15 +28245,12 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28263
28245
  });
28264
28246
  });
28265
28247
  },
28266
- onMouseLeave: function onMouseLeave(e) {
28267
- var _dragContainer$curren;
28268
- if (!e.relatedTarget || !((_dragContainer$curren = dragContainer.current) != null && _dragContainer$curren.contains(e.relatedTarget))) {
28269
- setTooltipState(function (prev) {
28270
- return _extends({}, prev, {
28271
- visible: false
28272
- });
28248
+ onMouseLeave: function onMouseLeave() {
28249
+ setTooltipState(function (prev) {
28250
+ return _extends({}, prev, {
28251
+ visible: false
28273
28252
  });
28274
- }
28253
+ });
28275
28254
  }
28276
28255
  }, React.createElement(ItemSlotRenderer, {
28277
28256
  item: item,
@@ -28299,10 +28278,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28299
28278
  },
28300
28279
  atlasIMG: atlasIMG,
28301
28280
  atlasJSON: atlasJSON,
28302
- equipmentSet: equipmentSet,
28303
- isDragging: !!draggingItem,
28304
- isSelectingShortcut: !!isSelectingShortcut,
28305
- showTooltipDelayed: showTooltipDelayed
28281
+ equipmentSet: equipmentSet
28306
28282
  }));
28307
28283
  }));
28308
28284
  var Container$b = /*#__PURE__*/styled.div.withConfig({