@rpg-engine/long-bow 0.7.63 → 0.7.65

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.7.63",
3
+ "version": "0.7.65",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -98,6 +98,7 @@ export const useItemSlotDragAndDrop = ({
98
98
  isFocused: false,
99
99
  position: { x: 0, y: 0 },
100
100
  }));
101
+ setDraggingItem(null);
101
102
  }, [setTooltipState]);
102
103
 
103
104
  const handleSuccessfulDrag = useCallback(
@@ -120,8 +121,10 @@ export const useItemSlotDragAndDrop = ({
120
121
  const onDraggableProgress: DraggableEventHandler = useCallback(
121
122
  (_e, data) => {
122
123
  const { x, y } = dragState.position;
123
- if (Math.abs(data.x - x) > 5 || Math.abs(data.y - y) > 5) {
124
+ if (Math.abs(data.x - x) > 20 || Math.abs(data.y - y) > 20) {
124
125
  setDragState(prev => ({ ...prev, wasDragged: true, isFocused: true }));
126
+ } else {
127
+ resetDragState();
125
128
  }
126
129
  if (!draggingItem) {
127
130
  setDraggingItem(item);
@@ -132,9 +135,6 @@ export const useItemSlotDragAndDrop = ({
132
135
 
133
136
  const onDraggableStop: DraggableEventHandler = useCallback(
134
137
  (e, data) => {
135
- setTimeout(() => {
136
- setDraggingItem(null);
137
- }, 50);
138
138
  const target = e.target as HTMLElement;
139
139
  if (!target) return;
140
140
 
@@ -178,14 +178,31 @@ export const useItemSlotDragAndDrop = ({
178
178
  }, 50);
179
179
  } else if (item) {
180
180
  const isTouch = e.type === 'touchend';
181
+
182
+ console.log(`Debug:
183
+ isTouch: ${isTouch},
184
+ isSelectingShortcut: ${isSelectingShortcut},
185
+ draggingItem: ${draggingItem},
186
+ dragState.wasDragged: ${dragState.wasDragged},
187
+ dragState.isFocused: ${dragState.isFocused}
188
+ `);
189
+
181
190
  if (
182
191
  !isContextMenuDisabled &&
183
192
  isTouch &&
184
193
  !isSelectingShortcut &&
185
- !draggingItem
194
+ !draggingItem &&
195
+ !dragState.wasDragged &&
196
+ !dragState.isFocused
186
197
  ) {
187
198
  setTooltipState(prev => ({ ...prev, mobileVisible: true }));
188
- } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
199
+ } else if (
200
+ !isContextMenuDisabled &&
201
+ !isSelectingShortcut &&
202
+ !isTouch &&
203
+ !dragState.wasDragged &&
204
+ !dragState.isFocused
205
+ ) {
189
206
  const event = e as MouseEvent;
190
207
  setContextMenuState(prev => ({
191
208
  visible: !prev.visible,