@rpg-engine/long-bow 0.7.46 → 0.7.48

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.46",
3
+ "version": "0.7.48",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -142,6 +142,7 @@ export const ItemSlot = React.memo(
142
142
  const [contextActions, setContextActions] = useState<IContextMenuItem[]>(
143
143
  []
144
144
  );
145
+ const [isDragStarted, setIsDragStarted] = useState(false);
145
146
 
146
147
  useEffect(() => {
147
148
  setDragState(prev => ({
@@ -200,6 +201,7 @@ export const ItemSlot = React.memo(
200
201
 
201
202
  const onDraggableStop: DraggableEventHandler = (e, data) => {
202
203
  setDraggingItem(null);
204
+ setIsDragStarted(false);
203
205
 
204
206
  const target = e.target as HTMLElement;
205
207
  if (!target) return;
@@ -266,18 +268,24 @@ export const ItemSlot = React.memo(
266
268
  }));
267
269
  }
268
270
  }, 50);
269
- } else if (item && !dragState.wasDragged) {
271
+ } else if (item && !isDragStarted) {
270
272
  let isTouch = false;
271
273
  if (
272
274
  !isContextMenuDisabled &&
273
275
  e.type === 'touchend' &&
274
- !isSelectingShortcut
276
+ !isSelectingShortcut &&
277
+ !dragState.wasDragged
275
278
  ) {
276
279
  isTouch = true;
277
280
  setTooltipState(prev => ({ ...prev, mobileVisible: true }));
278
281
  }
279
282
 
280
- if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
283
+ if (
284
+ !isContextMenuDisabled &&
285
+ !isSelectingShortcut &&
286
+ !isTouch &&
287
+ !dragState.wasDragged
288
+ ) {
281
289
  setContextMenuState(prev => ({
282
290
  ...prev,
283
291
  visible: !contextMenuState.visible,
@@ -305,6 +313,8 @@ export const ItemSlot = React.memo(
305
313
  return;
306
314
  }
307
315
 
316
+ setIsDragStarted(true);
317
+
308
318
  if (onDragStart && containerType) {
309
319
  onDragStart(item, slotIndex, containerType);
310
320
  }