@rpg-engine/long-bow 0.7.66 → 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.
@@ -27717,23 +27717,46 @@ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27717
27717
 
27718
27718
  var DraggingContext = /*#__PURE__*/createContext({
27719
27719
  item: null,
27720
- 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() {}
27721
27731
  });
27722
- var useDragging = function useDragging() {
27723
- return useContext(DraggingContext);
27724
- };
27725
27732
  var DraggingProvider = function DraggingProvider(_ref) {
27726
27733
  var children = _ref.children;
27727
27734
  var _useState = useState(null),
27728
27735
  item = _useState[0],
27729
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];
27730
27748
  return React.createElement(DraggingContext.Provider, {
27731
27749
  value: {
27732
27750
  item: item,
27733
- setDraggingItem: setDraggingItem
27751
+ setDraggingItem: setDraggingItem,
27752
+ dragState: dragState,
27753
+ setDragState: setDragState
27734
27754
  }
27735
27755
  }, children);
27736
27756
  };
27757
+ var useDragging = function useDragging() {
27758
+ return useContext(DraggingContext);
27759
+ };
27737
27760
 
27738
27761
  var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27739
27762
  var isDepotSystem = _ref.isDepotSystem,
@@ -27755,18 +27778,9 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27755
27778
  var dragContainer = useRef(null);
27756
27779
  var _useDragging = useDragging(),
27757
27780
  draggingItem = _useDragging.item,
27758
- setDraggingItem = _useDragging.setDraggingItem;
27759
- var _useState = useState({
27760
- isFocused: false,
27761
- wasDragged: false,
27762
- position: {
27763
- x: 0,
27764
- y: 0
27765
- },
27766
- dropPosition: null
27767
- }),
27768
- dragState = _useState[0],
27769
- setDragState = _useState[1];
27781
+ setDraggingItem = _useDragging.setDraggingItem,
27782
+ dragState = _useDragging.dragState,
27783
+ setDragState = _useDragging.setDragState;
27770
27784
  useEffect(function () {
27771
27785
  setDragState(function (prev) {
27772
27786
  return _extends({}, prev, {
@@ -27777,7 +27791,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27777
27791
  isFocused: false
27778
27792
  });
27779
27793
  });
27780
- }, [item, isDepotSystem]);
27794
+ }, [item, isDepotSystem, setDragState]);
27781
27795
  useEffect(function () {
27782
27796
  if (onDrop && item && dragState.dropPosition) {
27783
27797
  onDrop(item, dragState.dropPosition);
@@ -27805,11 +27819,6 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27805
27819
  };
27806
27820
  }, []);
27807
27821
  var resetDragState = useCallback(function () {
27808
- setTooltipState(function (prev) {
27809
- return _extends({}, prev, {
27810
- visible: false
27811
- });
27812
- });
27813
27822
  setDragState(function (prev) {
27814
27823
  return _extends({}, prev, {
27815
27824
  wasDragged: false,
@@ -27820,8 +27829,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27820
27829
  }
27821
27830
  });
27822
27831
  });
27823
- setDraggingItem(null);
27824
- }, [setTooltipState]);
27832
+ }, [setTooltipState, setDragState]);
27825
27833
  var handleSuccessfulDrag = useCallback(function (quantity) {
27826
27834
  resetDragState();
27827
27835
  if (quantity !== -1 && item) {
@@ -27838,21 +27846,22 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27838
27846
  var _dragState$position = dragState.position,
27839
27847
  x = _dragState$position.x,
27840
27848
  y = _dragState$position.y;
27841
- if (Math.abs(data.x - x) > 20 || Math.abs(data.y - y) > 20) {
27849
+ if (Math.abs(data.x - x) > 5 || Math.abs(data.y - y) > 5) {
27842
27850
  setDragState(function (prev) {
27843
27851
  return _extends({}, prev, {
27844
27852
  wasDragged: true,
27845
27853
  isFocused: true
27846
27854
  });
27847
27855
  });
27848
- } else {
27849
- resetDragState();
27850
27856
  }
27851
27857
  if (!draggingItem) {
27852
27858
  setDraggingItem(item);
27853
27859
  }
27854
- }, [dragState.position, draggingItem, item, setDraggingItem]);
27860
+ }, [dragState.position, draggingItem, item, setDraggingItem, setDragState]);
27855
27861
  var onDraggableStop = useCallback(function (e, data) {
27862
+ setTimeout(function () {
27863
+ setDraggingItem(null);
27864
+ }, 50);
27856
27865
  var target = e.target;
27857
27866
  if (!target) return;
27858
27867
  target.classList.remove('react-draggable-dragging');
@@ -27895,14 +27904,13 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27895
27904
  }, 50);
27896
27905
  } else if (item) {
27897
27906
  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) {
27907
+ if (!isContextMenuDisabled && isTouch && !isSelectingShortcut && !draggingItem) {
27900
27908
  setTooltipState(function (prev) {
27901
27909
  return _extends({}, prev, {
27902
27910
  mobileVisible: true
27903
27911
  });
27904
27912
  });
27905
- } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch && !dragState.wasDragged && !dragState.isFocused) {
27913
+ } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
27906
27914
  var event = e;
27907
27915
  setContextMenuState(function (prev) {
27908
27916
  return {
@@ -28198,7 +28206,6 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28198
28206
  },
28199
28207
  onTouchEnd: function onTouchEnd(e) {
28200
28208
  var _document$elementFrom2;
28201
- handleInteractionEnd(e);
28202
28209
  var _e$changedTouches$ = e.changedTouches[0],
28203
28210
  clientX = _e$changedTouches$.clientX,
28204
28211
  clientY = _e$changedTouches$.clientY;
@@ -28277,7 +28284,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28277
28284
  var Container$b = /*#__PURE__*/styled.div.withConfig({
28278
28285
  displayName: "ItemSlot__Container",
28279
28286
  componentId: "sc-l2j5ef-0"
28280
- })(["*{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) {
28287
+ })(["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) {
28281
28288
  var isDraggingItem = _ref3.isDraggingItem;
28282
28289
  return isDraggingItem ? 0 : 1;
28283
28290
  }, function (_ref4) {