@rpg-engine/long-bow 0.7.52 → 0.7.53

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.
@@ -27942,6 +27942,9 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
27942
27942
  var _useState6 = React.useState(null),
27943
27943
  touchStartPosition = _useState6[0],
27944
27944
  setTouchStartPosition = _useState6[1];
27945
+ var _useState7 = React.useState(false),
27946
+ isDragging = _useState7[0],
27947
+ setIsDragging = _useState7[1]; // New state to track dragging
27945
27948
  React.useEffect(function () {
27946
27949
  setDragState(function (prev) {
27947
27950
  return _extends({}, prev, {
@@ -27985,7 +27988,8 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
27985
27988
  var resetItem = function resetItem() {
27986
27989
  setTooltipState(function (prev) {
27987
27990
  return _extends({}, prev, {
27988
- visible: false
27991
+ visible: false,
27992
+ mobileVisible: false
27989
27993
  });
27990
27994
  });
27991
27995
  setDragState(function (prev) {
@@ -27993,6 +27997,7 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
27993
27997
  wasDragged: false
27994
27998
  });
27995
27999
  });
28000
+ setIsDragging(false); // Reset dragging flag
27996
28001
  };
27997
28002
  var onSuccessfulDrag = function onSuccessfulDrag(quantity) {
27998
28003
  resetItem();
@@ -28020,7 +28025,7 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28020
28025
  setItemShortcut(item, index);
28021
28026
  }
28022
28027
  }
28023
- // remove the class react-draggable-dragging from the element
28028
+ // Remove the class react-draggable-dragging from the element
28024
28029
  // to prevent the item from being dragged again
28025
28030
  target.classList.remove('react-draggable-dragging');
28026
28031
  var isTouch = e.type.startsWith('touch');
@@ -28104,13 +28109,19 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28104
28109
  }
28105
28110
  }, 50);
28106
28111
  } else if (item) {
28107
- if (isTouch && !isDrag) {
28112
+ if (isTouch && isDragging) {
28113
+ // If it's a touch and we were dragging, do not show context menu
28114
+ return;
28115
+ } else if (isTouch && !isDrag) {
28116
+ // Handle as a tap/click
28108
28117
  setTooltipState(function (prev) {
28109
28118
  return _extends({}, prev, {
28110
28119
  mobileVisible: true
28111
28120
  });
28112
28121
  });
28122
+ onPointerDown(item.type, containerType != null ? containerType : null, item);
28113
28123
  } else if (!isTouch && !isContextMenuDisabled && !isSelectingShortcut) {
28124
+ // Handle as context menu for mouse devices
28114
28125
  setContextMenuState(function (prev) {
28115
28126
  return _extends({}, prev, {
28116
28127
  visible: !contextMenuState.visible
@@ -28128,7 +28139,7 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28128
28139
  });
28129
28140
  }
28130
28141
  }
28131
- if (!isDrag || !isTouch) {
28142
+ if (!isDrag && !isTouch) {
28132
28143
  console.log('Calling onPointerDown');
28133
28144
  onPointerDown(item.type, containerType != null ? containerType : null, item);
28134
28145
  }
@@ -28147,6 +28158,7 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28147
28158
  if (onDragStart && containerType) {
28148
28159
  onDragStart(item, slotIndex, containerType);
28149
28160
  }
28161
+ setIsDragging(true); // Set dragging flag on start
28150
28162
  };
28151
28163
  var onDraggableProgress = function onDraggableProgress(_e, data) {
28152
28164
  if (Math.abs(data.x - dragState.position.x) > 5 || Math.abs(data.y - dragState.position.y) > 5) {
@@ -28161,16 +28173,18 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28161
28173
  setDraggingItem(item);
28162
28174
  }
28163
28175
  };
28164
- var onTouchStart = function onTouchStart(e) {
28176
+ var onTouchStartHandler = function onTouchStartHandler(e) {
28165
28177
  setTouchStartTime(new Date().getTime());
28166
28178
  setTouchStartPosition({
28167
28179
  x: e.touches[0].clientX,
28168
28180
  y: e.touches[0].clientY
28169
28181
  });
28170
28182
  };
28171
- var onTouchEnd = function onTouchEnd(e) {
28172
- // Prevent default to stop potential unwanted behaviors
28173
- e.preventDefault();
28183
+ var onTouchEndHandler = function onTouchEndHandler(e) {
28184
+ // Only prevent default if not dragging
28185
+ if (!isDragging) {
28186
+ e.preventDefault();
28187
+ }
28174
28188
  var touch = e.changedTouches[0];
28175
28189
  var touchEndTime = new Date().getTime();
28176
28190
  var touchDuration = touchStartTime ? touchEndTime - touchStartTime : 0;
@@ -28197,6 +28211,7 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28197
28211
  });
28198
28212
  (_document$elementFrom = document.elementFromPoint(touch.clientX, touch.clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28199
28213
  }
28214
+ setIsDragging(false); // Reset dragging flag on touch end
28200
28215
  };
28201
28216
  var bounds = getContainerBounds();
28202
28217
  return React__default.createElement(Container$b, {
@@ -28213,8 +28228,8 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28213
28228
  if (item) onPointerDown(item.type, containerType != null ? containerType : null, item);
28214
28229
  },
28215
28230
  isSelectingShortcut: isSelectingShortcut && ((item == null ? void 0 : item.type) === shared.ItemType.Consumable || (item == null ? void 0 : item.type) === shared.ItemType.Tool || (item == null ? void 0 : item.subType) === shared.ItemSubType.Seed),
28216
- onTouchStart: onTouchStart,
28217
- onTouchEnd: onTouchEnd
28231
+ onTouchStart: onTouchStartHandler,
28232
+ onTouchEnd: onTouchEndHandler
28218
28233
  }, React__default.createElement(Draggable, {
28219
28234
  axis: isSelectingShortcut ? 'none' : 'both',
28220
28235
  defaultClassName: item ? 'draggable' : 'empty-slot',
@@ -28300,8 +28315,9 @@ var Container$b = /*#__PURE__*/styled__default.div.withConfig({
28300
28315
  var ItemContainer = /*#__PURE__*/styled__default.div.withConfig({
28301
28316
  displayName: "ItemSlot__ItemContainer",
28302
28317
  componentId: "sc-l2j5ef-1"
28303
- })(["width:64px;height:64px;position:relative;", ";"], function (props) {
28304
- return props.isFocused && 'z-index: 100; pointer-events: none;';
28318
+ })(["width:64px;height:64px;position:relative;", ";"], function (_ref7) {
28319
+ var isFocused = _ref7.isFocused;
28320
+ return isFocused ? 'z-index: 100; pointer-events: none;' : '';
28305
28321
  });
28306
28322
 
28307
28323
  var statisticsToDisplay = [{