@rpg-engine/long-bow 0.7.66 → 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.
@@ -16,6 +16,9 @@ interface IProps {
16
16
  atlasIMG: any;
17
17
  atlasJSON: any;
18
18
  equipmentSet?: IEquipmentSet | null;
19
+ isDragging: boolean;
20
+ isSelectingShortcut: boolean;
21
+ showTooltipDelayed: boolean;
19
22
  }
20
- export declare const ItemSlotToolTips: ({ tooltipState, setTooltipState, contextMenuState, setContextMenuState, isFocused, isContextMenuDisabled, item, contextActions, dragScale, onSelected, atlasIMG, atlasJSON, equipmentSet, }: IProps) => JSX.Element;
23
+ export declare const ItemSlotToolTips: ({ tooltipState, setTooltipState, contextMenuState, setContextMenuState, isFocused, isContextMenuDisabled, item, contextActions, dragScale, onSelected, atlasIMG, atlasJSON, equipmentSet, isDragging, isSelectingShortcut, showTooltipDelayed, }: IProps) => JSX.Element;
21
24
  export {};
@@ -27668,13 +27668,17 @@ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27668
27668
  _onSelected = _ref.onSelected,
27669
27669
  atlasIMG = _ref.atlasIMG,
27670
27670
  atlasJSON = _ref.atlasJSON,
27671
- equipmentSet = _ref.equipmentSet;
27672
- return React__default.createElement(React__default.Fragment, null, tooltipState.visible && item && !isFocused && React__default.createElement(ItemTooltip, {
27671
+ equipmentSet = _ref.equipmentSet,
27672
+ isDragging = _ref.isDragging,
27673
+ isSelectingShortcut = _ref.isSelectingShortcut,
27674
+ showTooltipDelayed = _ref.showTooltipDelayed;
27675
+ var canShow = !isDragging || !isSelectingShortcut || showTooltipDelayed;
27676
+ return React__default.createElement(React__default.Fragment, null, tooltipState.visible && item && !isFocused && canShow && React__default.createElement(ItemTooltip, {
27673
27677
  item: item,
27674
27678
  atlasIMG: atlasIMG,
27675
27679
  atlasJSON: atlasJSON,
27676
27680
  equipmentSet: equipmentSet
27677
- }), tooltipState.mobileVisible && item && React__default.createElement(MobileItemTooltip, {
27681
+ }), tooltipState.mobileVisible && item && canShow && React__default.createElement(MobileItemTooltip, {
27678
27682
  item: item,
27679
27683
  atlasIMG: atlasIMG,
27680
27684
  atlasJSON: atlasJSON,
@@ -27698,7 +27702,7 @@ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27698
27702
  _onSelected == null ? void 0 : _onSelected(optionId, item);
27699
27703
  }
27700
27704
  }
27701
- }), !isContextMenuDisabled && contextMenuState.visible && contextActions && React__default.createElement(RelativeListMenu, {
27705
+ }), !isContextMenuDisabled && contextMenuState.visible && contextActions && canShow && React__default.createElement(RelativeListMenu, {
27702
27706
  options: contextActions,
27703
27707
  onSelected: function onSelected(optionId) {
27704
27708
  setContextMenuState(function (prev) {
@@ -27826,7 +27830,6 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27826
27830
  }
27827
27831
  });
27828
27832
  });
27829
- setDraggingItem(null);
27830
27833
  }, [setTooltipState]);
27831
27834
  var handleSuccessfulDrag = React.useCallback(function (quantity) {
27832
27835
  resetDragState();
@@ -27844,21 +27847,22 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27844
27847
  var _dragState$position = dragState.position,
27845
27848
  x = _dragState$position.x,
27846
27849
  y = _dragState$position.y;
27847
- if (Math.abs(data.x - x) > 20 || Math.abs(data.y - y) > 20) {
27850
+ if (Math.abs(data.x - x) > 5 || Math.abs(data.y - y) > 5) {
27848
27851
  setDragState(function (prev) {
27849
27852
  return _extends({}, prev, {
27850
27853
  wasDragged: true,
27851
27854
  isFocused: true
27852
27855
  });
27853
27856
  });
27854
- } else {
27855
- resetDragState();
27856
27857
  }
27857
27858
  if (!draggingItem) {
27858
27859
  setDraggingItem(item);
27859
27860
  }
27860
27861
  }, [dragState.position, draggingItem, item, setDraggingItem]);
27861
27862
  var onDraggableStop = React.useCallback(function (e, data) {
27863
+ setTimeout(function () {
27864
+ setDraggingItem(null);
27865
+ }, 50);
27862
27866
  var target = e.target;
27863
27867
  if (!target) return;
27864
27868
  target.classList.remove('react-draggable-dragging');
@@ -27901,14 +27905,13 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27901
27905
  }, 50);
27902
27906
  } else if (item) {
27903
27907
  var isTouch = e.type === 'touchend';
27904
- console.log("Debug: \n isTouch: " + isTouch + ",\n isSelectingShortcut: " + isSelectingShortcut + ",\n draggingItem: " + draggingItem + ",\n dragState.wasDragged: " + dragState.wasDragged + ",\n dragState.isFocused: " + dragState.isFocused + "\n ");
27905
- if (!isContextMenuDisabled && isTouch && !isSelectingShortcut && !draggingItem && !dragState.wasDragged && !dragState.isFocused) {
27908
+ if (!isContextMenuDisabled && isTouch && !isSelectingShortcut && !draggingItem) {
27906
27909
  setTooltipState(function (prev) {
27907
27910
  return _extends({}, prev, {
27908
27911
  mobileVisible: true
27909
27912
  });
27910
27913
  });
27911
- } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch && !dragState.wasDragged && !dragState.isFocused) {
27914
+ } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
27912
27915
  var event = e;
27913
27916
  setContextMenuState(function (prev) {
27914
27917
  return {
@@ -28115,6 +28118,12 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28115
28118
  var _useState3 = React.useState([]),
28116
28119
  contextActions = _useState3[0],
28117
28120
  setContextActions = _useState3[1];
28121
+ var isDraggingDisabled = React.useMemo(function () {
28122
+ return contextMenuState.visible || onDragStart === undefined || onDragEnd === undefined;
28123
+ }, [contextMenuState.visible, onDragStart, onDragEnd]);
28124
+ React.useEffect(function () {
28125
+ console.log('isDraggingDisabled', isDraggingDisabled);
28126
+ }, [isDraggingDisabled]);
28118
28127
  var _useItemSlotDragAndDr = useItemSlotDragAndDrop({
28119
28128
  isDepotSystem: !!isDepotSystem,
28120
28129
  item: item,
@@ -28188,6 +28197,22 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28188
28197
  (_document$elementFrom = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28189
28198
  }
28190
28199
  }, [onMouseOut]);
28200
+ var _useState4 = React.useState(false),
28201
+ showTooltipDelayed = _useState4[0],
28202
+ setShowTooltipDelayed = _useState4[1];
28203
+ //@ts-ignore
28204
+ React.useEffect(function () {
28205
+ if (tooltipState.visible && !isDraggingDisabled) {
28206
+ var timer = setTimeout(function () {
28207
+ return setShowTooltipDelayed(true);
28208
+ }, 50);
28209
+ return function () {
28210
+ return clearTimeout(timer);
28211
+ };
28212
+ } else {
28213
+ setShowTooltipDelayed(false);
28214
+ }
28215
+ }, [tooltipState.visible, isDraggingDisabled]);
28191
28216
  return React__default.createElement(Container$b, {
28192
28217
  isDraggingItem: !!draggingItem,
28193
28218
  item: item,
@@ -28223,7 +28248,7 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28223
28248
  axis: isSelectingShortcut ? 'none' : 'both',
28224
28249
  defaultClassName: item ? 'draggable' : 'empty-slot',
28225
28250
  scale: dragScale,
28226
- disabled: onDragStart === undefined || onDragEnd === undefined,
28251
+ disabled: isDraggingDisabled,
28227
28252
  onStop: onDraggableStop,
28228
28253
  onStart: onDraggableStart,
28229
28254
  onDrag: onDraggableProgress,
@@ -28244,12 +28269,15 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28244
28269
  });
28245
28270
  });
28246
28271
  },
28247
- onMouseLeave: function onMouseLeave() {
28248
- setTooltipState(function (prev) {
28249
- return _extends({}, prev, {
28250
- visible: false
28272
+ onMouseLeave: function onMouseLeave(e) {
28273
+ var _dragContainer$curren;
28274
+ if (!e.relatedTarget || !((_dragContainer$curren = dragContainer.current) != null && _dragContainer$curren.contains(e.relatedTarget))) {
28275
+ setTooltipState(function (prev) {
28276
+ return _extends({}, prev, {
28277
+ visible: false
28278
+ });
28251
28279
  });
28252
- });
28280
+ }
28253
28281
  }
28254
28282
  }, React__default.createElement(ItemSlotRenderer, {
28255
28283
  item: item,
@@ -28277,13 +28305,16 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28277
28305
  },
28278
28306
  atlasIMG: atlasIMG,
28279
28307
  atlasJSON: atlasJSON,
28280
- equipmentSet: equipmentSet
28308
+ equipmentSet: equipmentSet,
28309
+ isDragging: !!draggingItem,
28310
+ isSelectingShortcut: !!isSelectingShortcut,
28311
+ showTooltipDelayed: showTooltipDelayed
28281
28312
  }));
28282
28313
  }));
28283
28314
  var Container$b = /*#__PURE__*/styled__default.div.withConfig({
28284
28315
  displayName: "ItemSlot__Container",
28285
28316
  componentId: "sc-l2j5ef-0"
28286
- })(["*{border:1px solid red;}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 (_ref3) {
28317
+ })(["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 (_ref3) {
28287
28318
  var isDraggingItem = _ref3.isDraggingItem;
28288
28319
  return isDraggingItem ? 0 : 1;
28289
28320
  }, function (_ref4) {