@rpg-engine/long-bow 0.7.65 → 0.7.67

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,13 +27662,17 @@ 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
- return React.createElement(React.Fragment, null, tooltipState.visible && item && !isFocused && React.createElement(ItemTooltip, {
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, {
27667
27671
  item: item,
27668
27672
  atlasIMG: atlasIMG,
27669
27673
  atlasJSON: atlasJSON,
27670
27674
  equipmentSet: equipmentSet
27671
- }), tooltipState.mobileVisible && item && React.createElement(MobileItemTooltip, {
27675
+ }), tooltipState.mobileVisible && item && canShow && React.createElement(MobileItemTooltip, {
27672
27676
  item: item,
27673
27677
  atlasIMG: atlasIMG,
27674
27678
  atlasJSON: atlasJSON,
@@ -27692,7 +27696,7 @@ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27692
27696
  _onSelected == null ? void 0 : _onSelected(optionId, item);
27693
27697
  }
27694
27698
  }
27695
- }), !isContextMenuDisabled && contextMenuState.visible && contextActions && React.createElement(RelativeListMenu, {
27699
+ }), !isContextMenuDisabled && contextMenuState.visible && contextActions && canShow && React.createElement(RelativeListMenu, {
27696
27700
  options: contextActions,
27697
27701
  onSelected: function onSelected(optionId) {
27698
27702
  setContextMenuState(function (prev) {
@@ -27820,7 +27824,6 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27820
27824
  }
27821
27825
  });
27822
27826
  });
27823
- setDraggingItem(null);
27824
27827
  }, [setTooltipState]);
27825
27828
  var handleSuccessfulDrag = useCallback(function (quantity) {
27826
27829
  resetDragState();
@@ -27838,21 +27841,22 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27838
27841
  var _dragState$position = dragState.position,
27839
27842
  x = _dragState$position.x,
27840
27843
  y = _dragState$position.y;
27841
- if (Math.abs(data.x - x) > 20 || Math.abs(data.y - y) > 20) {
27844
+ if (Math.abs(data.x - x) > 5 || Math.abs(data.y - y) > 5) {
27842
27845
  setDragState(function (prev) {
27843
27846
  return _extends({}, prev, {
27844
27847
  wasDragged: true,
27845
27848
  isFocused: true
27846
27849
  });
27847
27850
  });
27848
- } else {
27849
- resetDragState();
27850
27851
  }
27851
27852
  if (!draggingItem) {
27852
27853
  setDraggingItem(item);
27853
27854
  }
27854
27855
  }, [dragState.position, draggingItem, item, setDraggingItem]);
27855
27856
  var onDraggableStop = useCallback(function (e, data) {
27857
+ setTimeout(function () {
27858
+ setDraggingItem(null);
27859
+ }, 50);
27856
27860
  var target = e.target;
27857
27861
  if (!target) return;
27858
27862
  target.classList.remove('react-draggable-dragging');
@@ -27895,14 +27899,13 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27895
27899
  }, 50);
27896
27900
  } else if (item) {
27897
27901
  var isTouch = e.type === 'touchend';
27898
- console.log("Debug: \n isTouch: " + isTouch + ",\n isSelectingShortcut: " + isSelectingShortcut + ",\n draggingItem: " + draggingItem + ",\n dragState.wasDragged: " + dragState.wasDragged + ",\n dragState.isFocused: " + dragState.isFocused + "\n ");
27899
- if (!isContextMenuDisabled && isTouch && !isSelectingShortcut && !draggingItem && !dragState.wasDragged && !dragState.isFocused) {
27902
+ if (!isContextMenuDisabled && isTouch && !isSelectingShortcut && !draggingItem) {
27900
27903
  setTooltipState(function (prev) {
27901
27904
  return _extends({}, prev, {
27902
27905
  mobileVisible: true
27903
27906
  });
27904
27907
  });
27905
- } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch && !dragState.wasDragged && !dragState.isFocused) {
27908
+ } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
27906
27909
  var event = e;
27907
27910
  setContextMenuState(function (prev) {
27908
27911
  return {
@@ -28109,6 +28112,12 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28109
28112
  var _useState3 = useState([]),
28110
28113
  contextActions = _useState3[0],
28111
28114
  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]);
28112
28121
  var _useItemSlotDragAndDr = useItemSlotDragAndDrop({
28113
28122
  isDepotSystem: !!isDepotSystem,
28114
28123
  item: item,
@@ -28182,6 +28191,22 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28182
28191
  (_document$elementFrom = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28183
28192
  }
28184
28193
  }, [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]);
28185
28210
  return React.createElement(Container$b, {
28186
28211
  isDraggingItem: !!draggingItem,
28187
28212
  item: item,
@@ -28217,7 +28242,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28217
28242
  axis: isSelectingShortcut ? 'none' : 'both',
28218
28243
  defaultClassName: item ? 'draggable' : 'empty-slot',
28219
28244
  scale: dragScale,
28220
- disabled: onDragStart === undefined || onDragEnd === undefined,
28245
+ disabled: isDraggingDisabled,
28221
28246
  onStop: onDraggableStop,
28222
28247
  onStart: onDraggableStart,
28223
28248
  onDrag: onDraggableProgress,
@@ -28238,12 +28263,15 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28238
28263
  });
28239
28264
  });
28240
28265
  },
28241
- onMouseLeave: function onMouseLeave() {
28242
- setTooltipState(function (prev) {
28243
- return _extends({}, prev, {
28244
- visible: false
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
+ });
28245
28273
  });
28246
- });
28274
+ }
28247
28275
  }
28248
28276
  }, React.createElement(ItemSlotRenderer, {
28249
28277
  item: item,
@@ -28271,7 +28299,10 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28271
28299
  },
28272
28300
  atlasIMG: atlasIMG,
28273
28301
  atlasJSON: atlasJSON,
28274
- equipmentSet: equipmentSet
28302
+ equipmentSet: equipmentSet,
28303
+ isDragging: !!draggingItem,
28304
+ isSelectingShortcut: !!isSelectingShortcut,
28305
+ showTooltipDelayed: showTooltipDelayed
28275
28306
  }));
28276
28307
  }));
28277
28308
  var Container$b = /*#__PURE__*/styled.div.withConfig({