@rpg-engine/long-bow 0.7.49 → 0.7.51

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.
@@ -28011,6 +28011,10 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28011
28011
  // remove the class react-draggable-dragging from the element
28012
28012
  // to prevent the item from being dragged again
28013
28013
  target.classList.remove('react-draggable-dragging');
28014
+ var isTouch = e.type.startsWith('touch');
28015
+ // Threshold for considering a tap/click as a drag
28016
+ var dragThreshold = 5; // pixels
28017
+ var isDrag = Math.abs(data.x) > dragThreshold || Math.abs(data.y) > dragThreshold;
28014
28018
  if (dragState.wasDragged && item && !isSelectingShortcut) {
28015
28019
  var _e$target;
28016
28020
  //@ts-ignore
@@ -28067,16 +28071,13 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28067
28071
  }
28068
28072
  }, 50);
28069
28073
  } else if (item) {
28070
- var isTouch = false;
28071
- if (!isContextMenuDisabled && e.type === 'touchend' && !isSelectingShortcut) {
28072
- isTouch = true;
28074
+ if (isTouch && !isDrag) {
28073
28075
  setTooltipState(function (prev) {
28074
28076
  return _extends({}, prev, {
28075
28077
  mobileVisible: true
28076
28078
  });
28077
28079
  });
28078
- }
28079
- if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch && !dragState.wasDragged) {
28080
+ } else if (!isTouch && !isContextMenuDisabled && !isSelectingShortcut) {
28080
28081
  setContextMenuState(function (prev) {
28081
28082
  return _extends({}, prev, {
28082
28083
  visible: !contextMenuState.visible
@@ -28094,8 +28095,17 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28094
28095
  });
28095
28096
  }
28096
28097
  }
28097
- onPointerDown(item.type, containerType != null ? containerType : null, item);
28098
+ if (!isDrag || !isTouch) {
28099
+ console.log('Calling onPointerDown');
28100
+ onPointerDown(item.type, containerType != null ? containerType : null, item);
28101
+ }
28098
28102
  }
28103
+ setDragState(function (prev) {
28104
+ return _extends({}, prev, {
28105
+ wasDragged: false
28106
+ });
28107
+ });
28108
+ console.log('Final dragState:', dragState);
28099
28109
  };
28100
28110
  var onDraggableStart = function onDraggableStart() {
28101
28111
  if (!item || isSelectingShortcut) {