@rpg-engine/long-bow 0.7.70 → 0.7.71

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.
Files changed (25) hide show
  1. package/dist/components/Item/Inventory/ItemSlot.d.ts +5 -18
  2. package/dist/components/Item/Inventory/ItemSlotTooltips.d.ts +12 -1
  3. package/dist/components/Item/Inventory/context/DraggingContext.d.ts +11 -0
  4. package/dist/hooks/useCursorPosition.d.ts +1 -1
  5. package/dist/long-bow.cjs.development.js +572 -660
  6. package/dist/long-bow.cjs.development.js.map +1 -1
  7. package/dist/long-bow.cjs.production.min.js +1 -1
  8. package/dist/long-bow.cjs.production.min.js.map +1 -1
  9. package/dist/long-bow.esm.js +574 -662
  10. package/dist/long-bow.esm.js.map +1 -1
  11. package/package.json +2 -3
  12. package/src/components/Equipment/EquipmentSet.tsx +29 -61
  13. package/src/components/Item/Inventory/DraggedItem.tsx +2 -2
  14. package/src/components/Item/Inventory/ItemContainer.tsx +44 -68
  15. package/src/components/Item/Inventory/ItemSlot.tsx +447 -239
  16. package/src/components/Item/Inventory/ItemSlotTooltips.tsx +46 -48
  17. package/src/components/Item/Inventory/context/DraggingContext.tsx +26 -0
  18. package/src/hooks/useCursorPosition.ts +20 -29
  19. package/src/stories/UI/containers/ItemContainer.stories.tsx +3 -30
  20. package/dist/components/Item/Inventory/context/ItemSlotDraggingContext.d.ts +0 -26
  21. package/dist/components/Item/Inventory/context/ItemSlotTooltipContext.d.ts +0 -28
  22. package/dist/components/Item/Inventory/hooks/useItemSlotDragAndDrop.d.ts +0 -39
  23. package/src/components/Item/Inventory/context/ItemSlotDraggingContext.tsx +0 -52
  24. package/src/components/Item/Inventory/context/ItemSlotTooltipContext.tsx +0 -95
  25. package/src/components/Item/Inventory/hooks/useItemSlotDragAndDrop.ts +0 -248
@@ -1,8 +1,8 @@
1
- import React, { useState, useEffect, Component, useRef, useCallback, useContext, createContext, useMemo, Fragment } from 'react';
1
+ import React, { useState, useEffect, Component, useRef, useContext, createContext, useMemo, useCallback, Fragment } from 'react';
2
2
  import styled, { css, keyframes } from 'styled-components';
3
3
  import { BeatLoader } from 'react-spinners';
4
4
  import { v4 } from 'uuid';
5
- import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarities, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSubType, isMobile, ItemSlotType, isMobileOrTablet, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, PeriodOfDay, UserAccountTypes } from '@rpg-engine/shared';
5
+ import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarities, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSubType, ItemSlotType, isMobileOrTablet, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, PeriodOfDay, UserAccountTypes } from '@rpg-engine/shared';
6
6
  import dayjs from 'dayjs';
7
7
  import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
8
8
  import { FaTimes } from 'react-icons/fa';
@@ -27371,57 +27371,6 @@ var Container$8 = /*#__PURE__*/styled.div.withConfig({
27371
27371
  componentId: "sc-dgmp04-0"
27372
27372
  })(["position:static !important;"]);
27373
27373
 
27374
- var useCursorPosition = function useCursorPosition(_ref) {
27375
- var _ref$scale = _ref.scale,
27376
- scale = _ref$scale === void 0 ? 1 : _ref$scale;
27377
- var _useState = useState({
27378
- x: 0,
27379
- y: 0
27380
- }),
27381
- position = _useState[0],
27382
- setPosition = _useState[1];
27383
- var scalePosition = useCallback(function (x, y) {
27384
- return {
27385
- x: (x - GRID_WIDTH / 2) / scale + GRID_WIDTH / 2,
27386
- y: (y - GRID_HEIGHT / 2) / scale + GRID_HEIGHT / 2
27387
- };
27388
- }, [scale]);
27389
- var setFromEvent = useCallback(function (e) {
27390
- var x, y;
27391
- if ('touches' in e) {
27392
- x = e.touches[0].clientX;
27393
- y = e.touches[0].clientY;
27394
- } else {
27395
- x = e.clientX;
27396
- y = e.clientY;
27397
- }
27398
- var scaledPosition = scalePosition(x, y);
27399
- setPosition(scaledPosition);
27400
- }, [scale, scalePosition]);
27401
- var cleanup = useCallback(function () {
27402
- setPosition({
27403
- x: 0,
27404
- y: 0
27405
- });
27406
- }, []);
27407
- useEffect(function () {
27408
- var handleEvent = function handleEvent(e) {
27409
- return setFromEvent(e);
27410
- };
27411
- window.addEventListener('mousemove', handleEvent);
27412
- window.addEventListener('touchmove', handleEvent);
27413
- window.addEventListener('mouseup', cleanup);
27414
- window.addEventListener('touchend', cleanup);
27415
- return function () {
27416
- window.removeEventListener('mousemove', handleEvent);
27417
- window.removeEventListener('touchmove', handleEvent);
27418
- window.removeEventListener('mouseup', cleanup);
27419
- window.removeEventListener('touchend', cleanup);
27420
- };
27421
- }, [setFromEvent, cleanup]);
27422
- return position;
27423
- };
27424
-
27425
27374
  var rarityColor = function rarityColor(item) {
27426
27375
  switch (item == null ? void 0 : item.rarity) {
27427
27376
  case ItemRarities.Uncommon:
@@ -27590,306 +27539,187 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
27590
27539
  return React.createElement(React.Fragment, null, onRenderSlot(item));
27591
27540
  };
27592
27541
 
27593
- // Set default state with clearly defined initial values
27594
- var defaultItemDetails = {
27595
- item: null,
27596
- tooltip: {
27597
- visible: false,
27598
- mobileVisible: false
27599
- },
27600
- contextMenu: {
27601
- visible: false,
27602
- position: {
27603
- x: 0,
27604
- y: 0
27605
- },
27606
- actions: []
27607
- }
27608
- };
27609
- // Create context with default values
27610
- var ItemSlotTooltipContext = /*#__PURE__*/createContext({
27611
- itemDetails: defaultItemDetails,
27612
- updateItemDetails: function updateItemDetails() {},
27613
- clearItemDetails: function clearItemDetails() {}
27614
- });
27615
- // Provider component
27616
- var ItemSlotTooltipProvider = function ItemSlotTooltipProvider(_ref) {
27617
- var children = _ref.children;
27618
- var _useState = useState(defaultItemDetails),
27619
- itemDetails = _useState[0],
27620
- setItemDetails = _useState[1];
27542
+ var RelativeListMenu = function RelativeListMenu(_ref) {
27543
+ var options = _ref.options,
27544
+ onSelected = _ref.onSelected,
27545
+ onOutsideClick = _ref.onOutsideClick,
27546
+ _ref$fontSize = _ref.fontSize,
27547
+ fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
27548
+ pos = _ref.pos;
27549
+ var ref = useRef(null);
27550
+ useOutsideClick(ref, 'relative-context-menu');
27621
27551
  useEffect(function () {
27622
- console.log('itemDetails', itemDetails);
27623
- }, [itemDetails]);
27624
- // Memoize the update function to optimize performance
27625
- var updateItemDetails = useCallback(function (updates) {
27626
- setItemDetails(function (prev) {
27627
- var _updates$contextMenu$, _updates$contextMenu, _prev$contextMenu;
27628
- return _extends({}, prev, updates, {
27629
- tooltip: _extends({}, prev.tooltip, updates.tooltip),
27630
- contextMenu: _extends({}, prev.contextMenu, updates.contextMenu, {
27631
- // Ensure actions are properly merged or overridden
27632
- actions: (_updates$contextMenu$ = (_updates$contextMenu = updates.contextMenu) == null ? void 0 : _updates$contextMenu.actions) != null ? _updates$contextMenu$ : (_prev$contextMenu = prev.contextMenu) == null ? void 0 : _prev$contextMenu.actions
27633
- })
27634
- });
27552
+ document.addEventListener('clickOutside', function (event) {
27553
+ var e = event;
27554
+ if (e.detail.id === 'relative-context-menu') {
27555
+ if (onOutsideClick) {
27556
+ onOutsideClick();
27557
+ }
27558
+ }
27635
27559
  });
27560
+ return function () {
27561
+ document.removeEventListener('clickOutside', function (_e) {});
27562
+ };
27636
27563
  }, []);
27637
- var clearItemDetails = useCallback(function () {
27638
- setItemDetails(defaultItemDetails);
27639
- }, []);
27640
- return React.createElement(ItemSlotTooltipContext.Provider, {
27641
- value: {
27642
- itemDetails: itemDetails,
27643
- updateItemDetails: updateItemDetails,
27644
- clearItemDetails: clearItemDetails
27564
+ return React.createElement(ModalPortal, null, React.createElement(Container$9, Object.assign({
27565
+ fontSize: fontSize,
27566
+ ref: ref
27567
+ }, pos), React.createElement("ul", {
27568
+ className: "rpgui-list-imp",
27569
+ style: {
27570
+ overflow: 'hidden'
27645
27571
  }
27646
- }, children);
27572
+ }, options.map(function (params, index) {
27573
+ return React.createElement(ListElement$2, {
27574
+ key: (params == null ? void 0 : params.id) || index,
27575
+ onPointerDown: function onPointerDown() {
27576
+ onSelected(params == null ? void 0 : params.id);
27577
+ }
27578
+ }, (params == null ? void 0 : params.text) || 'No text');
27579
+ }))));
27647
27580
  };
27648
- // Custom hook for consuming the context
27649
- var useItemSlotTooltip = function useItemSlotTooltip() {
27650
- return useContext(ItemSlotTooltipContext);
27581
+ var Container$9 = /*#__PURE__*/styled.div.withConfig({
27582
+ displayName: "RelativeListMenu__Container",
27583
+ componentId: "sc-7hohf-0"
27584
+ })(["position:absolute;top:", "px;left:", "px;display:flex;flex-direction:column;width:max-content;justify-content:start;align-items:flex-start;li{font-size:", "em;}"], function (props) {
27585
+ return props.y;
27586
+ }, function (props) {
27587
+ return props.x;
27588
+ }, function (props) {
27589
+ return props.fontSize;
27590
+ });
27591
+ var ListElement$2 = /*#__PURE__*/styled.li.withConfig({
27592
+ displayName: "RelativeListMenu__ListElement",
27593
+ componentId: "sc-7hohf-1"
27594
+ })(["margin-right:0.5rem;"]);
27595
+
27596
+ var MobileItemTooltip = function MobileItemTooltip(_ref) {
27597
+ var item = _ref.item,
27598
+ atlasIMG = _ref.atlasIMG,
27599
+ atlasJSON = _ref.atlasJSON,
27600
+ closeTooltip = _ref.closeTooltip,
27601
+ equipmentSet = _ref.equipmentSet,
27602
+ _ref$scale = _ref.scale,
27603
+ scale = _ref$scale === void 0 ? 1 : _ref$scale,
27604
+ options = _ref.options,
27605
+ onSelected = _ref.onSelected;
27606
+ var ref = useRef(null);
27607
+ var handleFadeOut = function handleFadeOut() {
27608
+ var _ref$current;
27609
+ (_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
27610
+ };
27611
+ return React.createElement(ModalPortal, null, React.createElement(Container$a, {
27612
+ ref: ref,
27613
+ onTouchEnd: function onTouchEnd() {
27614
+ handleFadeOut();
27615
+ setTimeout(function () {
27616
+ closeTooltip();
27617
+ }, 100);
27618
+ },
27619
+ scale: scale
27620
+ }, React.createElement(ItemInfoDisplay, {
27621
+ item: item,
27622
+ atlasIMG: atlasIMG,
27623
+ atlasJSON: atlasJSON,
27624
+ equipmentSet: equipmentSet,
27625
+ isMobile: true
27626
+ }), React.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
27627
+ return React.createElement(Option, {
27628
+ key: option.id,
27629
+ onTouchEnd: function onTouchEnd() {
27630
+ handleFadeOut();
27631
+ setTimeout(function () {
27632
+ onSelected == null ? void 0 : onSelected(option.id);
27633
+ closeTooltip();
27634
+ }, 100);
27635
+ }
27636
+ }, option.text);
27637
+ }))));
27651
27638
  };
27639
+ var Container$a = /*#__PURE__*/styled.div.withConfig({
27640
+ displayName: "MobileItemTooltip__Container",
27641
+ componentId: "sc-ku4p1j-0"
27642
+ })(["position:absolute;z-index:100;left:0;top:0;width:100vw;height:100vh;background-color:rgba(0 0 0 / 0.5);display:flex;justify-content:center;align-items:center;gap:0.5rem;transition:opacity 0.08s;animation:fadeIn 0.1s forwards;@keyframes fadeIn{0%{opacity:0;}100%{opacity:0.92;}}@keyframes fadeOut{0%{opacity:0.92;}100%{opacity:0;}}&.fadeOut{animation:fadeOut 0.1s forwards;}@media (max-width:640px){flex-direction:column;}"]);
27643
+ var OptionsContainer = /*#__PURE__*/styled.div.withConfig({
27644
+ displayName: "MobileItemTooltip__OptionsContainer",
27645
+ componentId: "sc-ku4p1j-1"
27646
+ })(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
27647
+ var Option = /*#__PURE__*/styled.button.withConfig({
27648
+ displayName: "MobileItemTooltip__Option",
27649
+ componentId: "sc-ku4p1j-2"
27650
+ })(["padding:1rem;background-color:#333;color:white;border:none;border-radius:3px;width:8rem;transition:background-color 0.1s;&:hover{background-color:#555;}@media (max-width:640px){padding:1rem 0.5rem;}"]);
27652
27651
 
27653
- var ItemSlotDraggingContext = /*#__PURE__*/createContext({
27654
- item: null,
27655
- setDraggingItem: function setDraggingItem() {},
27656
- dragState: {
27657
- isFocused: false,
27658
- wasDragged: false,
27659
- position: {
27660
- x: 0,
27661
- y: 0
27652
+ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27653
+ var isTooltipVisible = _ref.isTooltipVisible,
27654
+ isFocused = _ref.isFocused,
27655
+ isContextMenuVisible = _ref.isContextMenuVisible,
27656
+ isContextMenuDisabled = _ref.isContextMenuDisabled,
27657
+ item = _ref.item,
27658
+ contextActions = _ref.contextActions,
27659
+ contextMenuPosition = _ref.contextMenuPosition,
27660
+ dragScale = _ref.dragScale,
27661
+ setIsContextMenuVisible = _ref.setIsContextMenuVisible,
27662
+ setIsTooltipMobileVisible = _ref.setIsTooltipMobileVisible,
27663
+ isTooltipMobileVisible = _ref.isTooltipMobileVisible,
27664
+ _onSelected = _ref.onSelected,
27665
+ atlasIMG = _ref.atlasIMG,
27666
+ atlasJSON = _ref.atlasJSON,
27667
+ equipmentSet = _ref.equipmentSet;
27668
+ return React.createElement(React.Fragment, null, isTooltipVisible && item && !isFocused && React.createElement(ItemTooltip, {
27669
+ item: item,
27670
+ atlasIMG: atlasIMG,
27671
+ atlasJSON: atlasJSON,
27672
+ equipmentSet: equipmentSet
27673
+ }), isTooltipMobileVisible && item && React.createElement(MobileItemTooltip, {
27674
+ item: item,
27675
+ atlasIMG: atlasIMG,
27676
+ atlasJSON: atlasJSON,
27677
+ equipmentSet: equipmentSet,
27678
+ closeTooltip: function closeTooltip() {
27679
+ setIsTooltipMobileVisible(false);
27662
27680
  },
27663
- dropPosition: null
27664
- },
27665
- setDragState: function setDragState() {}
27681
+ scale: dragScale,
27682
+ options: contextActions,
27683
+ onSelected: function onSelected(optionId) {
27684
+ setIsContextMenuVisible(false);
27685
+ if (item) {
27686
+ _onSelected == null ? void 0 : _onSelected(optionId, item);
27687
+ }
27688
+ }
27689
+ }), !isContextMenuDisabled && isContextMenuVisible && contextActions && React.createElement(RelativeListMenu, {
27690
+ options: contextActions,
27691
+ onSelected: function onSelected(optionId) {
27692
+ setIsContextMenuVisible(false);
27693
+ if (item) {
27694
+ _onSelected == null ? void 0 : _onSelected(optionId, item);
27695
+ }
27696
+ },
27697
+ onOutsideClick: function onOutsideClick() {
27698
+ setIsContextMenuVisible(false);
27699
+ },
27700
+ pos: contextMenuPosition
27701
+ }));
27702
+ };
27703
+
27704
+ var DraggingContext = /*#__PURE__*/createContext({
27705
+ item: null,
27706
+ setDraggingItem: function setDraggingItem() {}
27666
27707
  });
27667
- var ItemSlotDraggingProvider = function ItemSlotDraggingProvider(_ref) {
27708
+ var useDragging = function useDragging() {
27709
+ return useContext(DraggingContext);
27710
+ };
27711
+ var DraggingProvider = function DraggingProvider(_ref) {
27668
27712
  var children = _ref.children;
27669
27713
  var _useState = useState(null),
27670
27714
  item = _useState[0],
27671
27715
  setDraggingItem = _useState[1];
27672
- var _useState2 = useState({
27673
- isFocused: false,
27674
- wasDragged: false,
27675
- position: {
27676
- x: 0,
27677
- y: 0
27678
- },
27679
- dropPosition: null
27680
- }),
27681
- dragState = _useState2[0],
27682
- setDragState = _useState2[1];
27683
- return React.createElement(ItemSlotDraggingContext.Provider, {
27716
+ return React.createElement(DraggingContext.Provider, {
27684
27717
  value: {
27685
27718
  item: item,
27686
- setDraggingItem: setDraggingItem,
27687
- dragState: dragState,
27688
- setDragState: setDragState
27719
+ setDraggingItem: setDraggingItem
27689
27720
  }
27690
27721
  }, children);
27691
27722
  };
27692
- var useItemSlotDragging = function useItemSlotDragging() {
27693
- return useContext(ItemSlotDraggingContext);
27694
- };
27695
-
27696
- var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27697
- var isDepotSystem = _ref.isDepotSystem,
27698
- item = _ref.item,
27699
- onDrop = _ref.onDrop,
27700
- onDragEnd = _ref.onDragEnd,
27701
- checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
27702
- checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
27703
- setItemShortcut = _ref.setItemShortcut,
27704
- isSelectingShortcut = _ref.isSelectingShortcut,
27705
- onDragStart = _ref.onDragStart,
27706
- onPointerDown = _ref.onPointerDown,
27707
- containerType = _ref.containerType,
27708
- slotIndex = _ref.slotIndex,
27709
- openQuantitySelector = _ref.openQuantitySelector,
27710
- isContextMenuDisabled = _ref.isContextMenuDisabled;
27711
- var dragContainer = useRef(null);
27712
- var _useItemSlotDragging = useItemSlotDragging(),
27713
- draggingItem = _useItemSlotDragging.item,
27714
- setDraggingItem = _useItemSlotDragging.setDraggingItem,
27715
- dragState = _useItemSlotDragging.dragState,
27716
- setDragState = _useItemSlotDragging.setDragState;
27717
- var _useItemSlotTooltip = useItemSlotTooltip(),
27718
- updateItemDetails = _useItemSlotTooltip.updateItemDetails,
27719
- itemDetails = _useItemSlotTooltip.itemDetails;
27720
- useEffect(function () {
27721
- setDragState(function (prev) {
27722
- return _extends({}, prev, {
27723
- position: {
27724
- x: 0,
27725
- y: 0
27726
- },
27727
- isFocused: false
27728
- });
27729
- });
27730
- }, [item, isDepotSystem, setDragState]);
27731
- useEffect(function () {
27732
- if (onDrop && item && dragState.dropPosition) {
27733
- onDrop(item, dragState.dropPosition);
27734
- setDragState(function (prev) {
27735
- return _extends({}, prev, {
27736
- dropPosition: null
27737
- });
27738
- });
27739
- }
27740
- }, [dragState.dropPosition, item, onDrop]);
27741
- var getContainerBounds = useCallback(function () {
27742
- var container = dragContainer.current;
27743
- if (!container) return {
27744
- left: 0,
27745
- top: 0,
27746
- right: 0,
27747
- bottom: 0
27748
- };
27749
- var rect = container.getBoundingClientRect();
27750
- return {
27751
- left: rect.left,
27752
- top: rect.top,
27753
- right: window.innerWidth - rect.right,
27754
- bottom: window.innerHeight - rect.bottom
27755
- };
27756
- }, []);
27757
- var resetDragState = useCallback(function () {
27758
- console.log('RESET_DRAG_STATE!');
27759
- setDragState(function (prev) {
27760
- return _extends({}, prev, {
27761
- wasDragged: false,
27762
- isFocused: false,
27763
- position: {
27764
- x: 0,
27765
- y: 0
27766
- }
27767
- });
27768
- });
27769
- setDraggingItem(null);
27770
- // Reset tooltip visibility
27771
- updateItemDetails({
27772
- tooltip: {
27773
- visible: false,
27774
- mobileVisible: false
27775
- }
27776
- });
27777
- }, [updateItemDetails, setDragState]);
27778
- var handleSuccessfulDrag = useCallback(function (quantity) {
27779
- console.log('HANDLE_SUCCESSFUL_DRAG!');
27780
- resetDragState();
27781
- if (quantity !== -1 && item) {
27782
- onDragEnd == null ? void 0 : onDragEnd(quantity);
27783
- }
27784
- }, [item, onDragEnd, resetDragState]);
27785
- var onDraggableStart = useCallback(function () {
27786
- console.log('ON_DRAGGABLE_START!');
27787
- if (!item || isSelectingShortcut) return;
27788
- if (onDragStart && containerType) {
27789
- onDragStart(item, slotIndex, containerType);
27790
- }
27791
- if (!draggingItem && item) {
27792
- console.log('!!! SETTING DRAGGING ITEM ', item._id);
27793
- setDraggingItem(item);
27794
- }
27795
- }, [item, isSelectingShortcut, onDragStart, containerType, slotIndex]);
27796
- var onDraggableProgress = useCallback(function (_e, data) {
27797
- console.log('ON_DRAGGABLE_PROGRESS!');
27798
- var _dragState$position = dragState.position,
27799
- x = _dragState$position.x,
27800
- y = _dragState$position.y;
27801
- if (Math.abs(data.x - x) > 5 || Math.abs(data.y - y) > 5) {
27802
- setDragState(function (prev) {
27803
- return _extends({}, prev, {
27804
- wasDragged: true,
27805
- isFocused: true
27806
- });
27807
- });
27808
- }
27809
- }, [dragState.position, draggingItem, item, setDraggingItem, setDragState]);
27810
- var onDraggableStop = useCallback(function (e, data) {
27811
- console.log('ON_DRAGGABLE_STOP!');
27812
- var target = e.target;
27813
- if (!target) return;
27814
- target.classList.remove('react-draggable-dragging');
27815
- if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
27816
- var index = parseInt(target.id.split('_')[1]);
27817
- if (!isNaN(index)) {
27818
- setItemShortcut(item, index);
27819
- }
27820
- }
27821
- if (dragState.wasDragged && item && !isSelectingShortcut) {
27822
- var classes = Array.from(target.classList);
27823
- var isOutsideDrop = classes.some(function (elm) {
27824
- return elm.includes('rpgui-content');
27825
- }) || classes.length === 0;
27826
- if (isOutsideDrop) {
27827
- setDragState(function (prev) {
27828
- return _extends({}, prev, {
27829
- dropPosition: {
27830
- x: data.x,
27831
- y: data.y
27832
- }
27833
- });
27834
- });
27835
- }
27836
- setDragState(function (prev) {
27837
- return _extends({}, prev, {
27838
- wasDragged: false
27839
- });
27840
- });
27841
- setTimeout(function () {
27842
- if (checkIfItemCanBeMoved != null && checkIfItemCanBeMoved() && (!checkIfItemShouldDragEnd || checkIfItemShouldDragEnd())) {
27843
- if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) {
27844
- openQuantitySelector(item.stackQty, handleSuccessfulDrag);
27845
- } else {
27846
- handleSuccessfulDrag(item.stackQty);
27847
- }
27848
- } else {
27849
- resetDragState();
27850
- }
27851
- }, 50);
27852
- } else if (item) {
27853
- var isTouch = e.type === 'touchend';
27854
- console.log("Debug: \n isTouch: " + isTouch + ",\n isSelectingShortcut: " + isSelectingShortcut + ",\n draggingItem: " + draggingItem + ",\n dragginState: " + JSON.stringify(dragState) + "\n ");
27855
- if (!isContextMenuDisabled && isTouch && !isSelectingShortcut) {
27856
- updateItemDetails({
27857
- item: item,
27858
- tooltip: {
27859
- mobileVisible: true
27860
- }
27861
- });
27862
- } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
27863
- var _itemDetails$contextM;
27864
- var event = e;
27865
- updateItemDetails({
27866
- item: item,
27867
- contextMenu: {
27868
- visible: !(itemDetails != null && (_itemDetails$contextM = itemDetails.contextMenu) != null && _itemDetails$contextM.visible),
27869
- position: {
27870
- x: event.clientX - 10,
27871
- y: event.clientY - 5
27872
- }
27873
- }
27874
- });
27875
- }
27876
- onPointerDown == null ? void 0 : onPointerDown(item.type, containerType != null ? containerType : null, item);
27877
- }
27878
- console.log('setting draggingItem to null');
27879
- setDraggingItem(null);
27880
- }, [dragState.wasDragged, item, isSelectingShortcut, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, handleSuccessfulDrag, resetDragState, isContextMenuDisabled, onPointerDown, containerType, setItemShortcut]);
27881
- return {
27882
- dragContainer: dragContainer,
27883
- dragState: dragState,
27884
- draggingItem: draggingItem,
27885
- setDraggingItem: setDraggingItem,
27886
- getContainerBounds: getContainerBounds,
27887
- onDraggableStart: onDraggableStart,
27888
- onDraggableProgress: onDraggableProgress,
27889
- onDraggableStop: onDraggableStop,
27890
- resetItem: resetDragState
27891
- };
27892
- };
27893
27723
 
27894
27724
  var generateContextMenuListOptions = function generateContextMenuListOptions(actionsByTypeList) {
27895
27725
  var contextMenu = actionsByTypeList.map(function (action) {
@@ -28028,14 +27858,15 @@ var EquipmentSlotSpriteByType = {
28028
27858
  RightHand: 'shields/plate-shield.png',
28029
27859
  Accessory: 'ranged-weapons/arrow.png'
28030
27860
  };
28031
- var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
27861
+ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
28032
27862
  var slotIndex = _ref.slotIndex,
28033
27863
  item = _ref.item,
28034
27864
  containerType = _ref.itemContainerType,
28035
27865
  slotSpriteMask = _ref.slotSpriteMask,
28036
27866
  _onMouseOver = _ref.onMouseOver,
28037
- onMouseOut = _ref.onMouseOut,
27867
+ _onMouseOut = _ref.onMouseOut,
28038
27868
  onPointerDown = _ref.onPointerDown,
27869
+ _onSelected = _ref.onSelected,
28039
27870
  atlasJSON = _ref.atlasJSON,
28040
27871
  atlasIMG = _ref.atlasIMG,
28041
27872
  _ref$isContextMenuDis = _ref.isContextMenuDisabled,
@@ -28046,102 +27877,292 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28046
27877
  onDrop = _ref.onOutsideDrop,
28047
27878
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
28048
27879
  openQuantitySelector = _ref.openQuantitySelector,
27880
+ checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
28049
27881
  dragScale = _ref.dragScale,
28050
27882
  isSelectingShortcut = _ref.isSelectingShortcut,
27883
+ equipmentSet = _ref.equipmentSet,
28051
27884
  setItemShortcut = _ref.setItemShortcut,
28052
27885
  isDepotSystem = _ref.isDepotSystem;
28053
- var _useItemSlotDragAndDr = useItemSlotDragAndDrop({
28054
- isDepotSystem: !!isDepotSystem,
28055
- item: item,
28056
- onDrop: onDrop != null ? onDrop : function () {},
28057
- onDragEnd: onDragEnd,
28058
- checkIfItemCanBeMoved: checkIfItemCanBeMoved,
28059
- setItemShortcut: setItemShortcut,
28060
- isSelectingShortcut: isSelectingShortcut,
28061
- onDragStart: onDragStart,
28062
- onPointerDown: onPointerDown,
28063
- containerType: containerType,
28064
- slotIndex: slotIndex,
28065
- openQuantitySelector: openQuantitySelector != null ? openQuantitySelector : function () {},
28066
- isContextMenuDisabled: isContextMenuDisabled
28067
- }),
28068
- dragContainer = _useItemSlotDragAndDr.dragContainer,
28069
- dragState = _useItemSlotDragAndDr.dragState,
28070
- draggingItem = _useItemSlotDragAndDr.draggingItem,
28071
- getContainerBounds = _useItemSlotDragAndDr.getContainerBounds,
28072
- onDraggableStart = _useItemSlotDragAndDr.onDraggableStart,
28073
- onDraggableProgress = _useItemSlotDragAndDr.onDraggableProgress,
28074
- onDraggableStop = _useItemSlotDragAndDr.onDraggableStop;
28075
- var _useItemSlotTooltip = useItemSlotTooltip(),
28076
- updateItemDetails = _useItemSlotTooltip.updateItemDetails,
28077
- itemDetails = _useItemSlotTooltip.itemDetails;
28078
- var _useCursorPosition = useCursorPosition({
28079
- scale: dragScale
27886
+ // Centralized state using a single useState hook
27887
+ var _useState = useState({
27888
+ isTooltipVisible: false,
27889
+ isTooltipMobileVisible: false,
27890
+ isContextMenuVisible: false,
27891
+ contextMenuPosition: {
27892
+ x: 0,
27893
+ y: 0
27894
+ },
27895
+ isFocused: false,
27896
+ wasDragged: false,
27897
+ dragPosition: {
27898
+ x: 0,
27899
+ y: 0
27900
+ },
27901
+ dropPosition: null,
27902
+ contextActions: [],
27903
+ draggingDistance: 0
28080
27904
  }),
28081
- cursorX = _useCursorPosition.x,
28082
- cursorY = _useCursorPosition.y;
27905
+ state = _useState[0],
27906
+ setState = _useState[1];
27907
+ var isTooltipVisible = state.isTooltipVisible,
27908
+ isTooltipMobileVisible = state.isTooltipMobileVisible,
27909
+ isContextMenuVisible = state.isContextMenuVisible,
27910
+ contextMenuPosition = state.contextMenuPosition,
27911
+ isFocused = state.isFocused,
27912
+ wasDragged = state.wasDragged,
27913
+ dragPosition = state.dragPosition,
27914
+ dropPosition = state.dropPosition,
27915
+ contextActions = state.contextActions;
27916
+ var dragContainer = useRef(null);
27917
+ var _useDragging = useDragging(),
27918
+ draggingItem = _useDragging.item,
27919
+ setDraggingItem = _useDragging.setDraggingItem;
28083
27920
  useEffect(function () {
27921
+ // Reset drag position and focus when item changes
27922
+ setState(function (prevState) {
27923
+ return _extends({}, prevState, {
27924
+ dragPosition: {
27925
+ x: 0,
27926
+ y: 0
27927
+ },
27928
+ isFocused: false
27929
+ });
27930
+ });
27931
+ // Update context actions when item or depot system changes
28084
27932
  if (item && containerType) {
28085
- updateItemDetails({
28086
- item: item,
28087
- contextMenu: {
28088
- actions: generateContextMenu(item, containerType, isDepotSystem)
28089
- }
27933
+ setState(function (prevState) {
27934
+ return _extends({}, prevState, {
27935
+ contextActions: generateContextMenu(item, containerType, isDepotSystem)
27936
+ });
27937
+ });
27938
+ } else {
27939
+ setState(function (prevState) {
27940
+ return _extends({}, prevState, {
27941
+ contextActions: []
27942
+ });
28090
27943
  });
28091
27944
  }
28092
27945
  }, [item, isDepotSystem]);
28093
- var bounds = getContainerBounds();
28094
- var handleInteraction = useCallback(function (event) {
28095
- event.stopPropagation();
28096
- console.log('handleInteraction');
28097
- if (item && containerType) {
28098
- if (onPlaceDrop && draggingItem) {
28099
- onPlaceDrop(item, slotIndex, containerType);
28100
- }
28101
- if (onPointerDown && onDragStart === undefined && onDragEnd === undefined) {
28102
- onPointerDown(item.type, containerType, item);
27946
+ useEffect(function () {
27947
+ // Handle outside drop
27948
+ if (onDrop && item && dropPosition) {
27949
+ onDrop(item, dropPosition);
27950
+ }
27951
+ }, [dropPosition]);
27952
+ var resetItem = function resetItem() {
27953
+ setState(function (prevState) {
27954
+ return _extends({}, prevState, {
27955
+ isTooltipVisible: false,
27956
+ wasDragged: false
27957
+ });
27958
+ });
27959
+ };
27960
+ var onSuccessfulDrag = function onSuccessfulDrag(quantity) {
27961
+ resetItem();
27962
+ if (quantity === -1) {
27963
+ setState(function (prevState) {
27964
+ return _extends({}, prevState, {
27965
+ dragPosition: {
27966
+ x: 0,
27967
+ y: 0
27968
+ },
27969
+ isFocused: false
27970
+ });
27971
+ });
27972
+ } else if (item) {
27973
+ onDragEnd == null ? void 0 : onDragEnd(quantity);
27974
+ }
27975
+ };
27976
+ var onDraggableStop = function onDraggableStop(e, data) {
27977
+ console.log('>>> ON_DRAGGABLE_STOP');
27978
+ // Stop the dragging state
27979
+ console.log('setDraggingItem(null)');
27980
+ setDraggingItem(null);
27981
+ var target = e.target;
27982
+ console.log('handleShortcutSetter(target)');
27983
+ handleShortcutSetter(target);
27984
+ console.log('removeDraggingClass(target)');
27985
+ removeDraggingClass(target);
27986
+ console.log('shouldHandleDraggedItem()');
27987
+ if (shouldHandleDraggedItem()) {
27988
+ console.log('handleDraggedItem(e, data)');
27989
+ handleDraggedItem(e, data);
27990
+ } else if (item && !wasDragged) {
27991
+ console.log('handleContextMenuOrTooltip(e)');
27992
+ handleContextMenuOrTooltip(e);
27993
+ }
27994
+ };
27995
+ /**
27996
+ * Handles the shortcut setter logic if the target element is a shortcut setter.
27997
+ */
27998
+ var handleShortcutSetter = function handleShortcutSetter(target) {
27999
+ if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
28000
+ var index = parseInt(target.id.split('_')[1], 10);
28001
+ if (!isNaN(index)) {
28002
+ setItemShortcut(item, index);
28103
28003
  }
28104
28004
  }
28105
- _onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, cursorX, cursorY);
28106
- }, [item, containerType, slotIndex, onPlaceDrop, onPointerDown, _onMouseOver, onDragStart, onDragEnd, cursorX, cursorY]);
28107
- var handleInteractionEnd = useCallback(function (event) {
28108
- event.preventDefault();
28109
- event.stopPropagation();
28110
- console.log('handleInteractionEnd');
28111
- console.log('itemDetails', itemDetails);
28112
- onMouseOut == null ? void 0 : onMouseOut();
28113
- if (event.type === 'touchend') {
28114
- var _document$elementFrom;
28115
- var simulatedEvent = new MouseEvent('mouseup', {
28116
- clientX: cursorX,
28117
- clientY: cursorY,
28118
- bubbles: true
28005
+ };
28006
+ /**
28007
+ * Removes the dragging CSS class from the target element.
28008
+ */
28009
+ var removeDraggingClass = function removeDraggingClass(target) {
28010
+ target.classList.remove('react-draggable-dragging');
28011
+ };
28012
+ /**
28013
+ * Determines whether the dragged item should be processed.
28014
+ */
28015
+ var shouldHandleDraggedItem = function shouldHandleDraggedItem() {
28016
+ console.log("Debug: shouldHandleDraggedItem()", "wasDragged: " + wasDragged, "item: " + item, "isSelectingShortcut: " + isSelectingShortcut);
28017
+ return !!(wasDragged && item && !isSelectingShortcut);
28018
+ };
28019
+ /**
28020
+ * Handles the logic when an item has been dragged.
28021
+ */
28022
+ var handleDraggedItem = function handleDraggedItem(e, data) {
28023
+ var targetClasses = Array.from(e.target.classList);
28024
+ var isOutsideDrop = targetClasses.some(function (elm) {
28025
+ return elm.includes('rpgui-content');
28026
+ }) || targetClasses.length === 0;
28027
+ if (isOutsideDrop) {
28028
+ setState(function (prevState) {
28029
+ return _extends({}, prevState, {
28030
+ dropPosition: {
28031
+ x: data.x,
28032
+ y: data.y
28033
+ }
28034
+ });
28119
28035
  });
28120
- (_document$elementFrom = document.elementFromPoint(cursorX, cursorY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28121
- updateItemDetails({
28122
- item: item,
28123
- tooltip: {
28124
- visible: false
28036
+ }
28037
+ setState(function (prevState) {
28038
+ return _extends({}, prevState, {
28039
+ wasDragged: false
28040
+ });
28041
+ });
28042
+ var targetElement = dragContainer.current;
28043
+ if (!targetElement) return;
28044
+ var _getElementTransform = getElementTransform(targetElement),
28045
+ x = _getElementTransform.x,
28046
+ y = _getElementTransform.y;
28047
+ setState(function (prevState) {
28048
+ return _extends({}, prevState, {
28049
+ dragPosition: {
28050
+ x: x,
28051
+ y: y
28125
28052
  }
28126
28053
  });
28054
+ });
28055
+ // Delay to ensure state updates before proceeding
28056
+ setTimeout(function () {
28057
+ processDragEnd(item);
28058
+ }, 50);
28059
+ };
28060
+ /**
28061
+ * Retrieves the current transform position of the dragged element.
28062
+ */
28063
+ var getElementTransform = function getElementTransform(element) {
28064
+ var style = window.getComputedStyle(element);
28065
+ var matrix = new DOMMatrixReadOnly(style.transform);
28066
+ return {
28067
+ x: matrix.m41,
28068
+ y: matrix.m42
28069
+ };
28070
+ };
28071
+ /**
28072
+ * Processes the end of a drag event, handling quantity selection or resetting state.
28073
+ */
28074
+ var processDragEnd = function processDragEnd(item) {
28075
+ console.log("Debug: processDragEnd(item)", "item: " + item);
28076
+ if (checkIfItemCanBeMoved != null && checkIfItemCanBeMoved()) {
28077
+ console.log("Debug: checkIfItemCanBeMoved()", "result: " + checkIfItemCanBeMoved());
28078
+ if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd()) return;
28079
+ console.log("Debug: checkIfItemShouldDragEnd()", "result: " + (checkIfItemShouldDragEnd == null ? void 0 : checkIfItemShouldDragEnd()));
28080
+ if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) {
28081
+ console.log("Debug: openQuantitySelector(item.stackQty, onSuccessfulDrag)");
28082
+ openQuantitySelector(item.stackQty, onSuccessfulDrag);
28083
+ } else {
28084
+ console.log("Debug: onSuccessfulDrag(item.stackQty)");
28085
+ onSuccessfulDrag(item.stackQty);
28086
+ }
28087
+ } else {
28088
+ console.log("Debug: resetItem()");
28089
+ resetItem();
28090
+ setState(function (prevState) {
28091
+ return _extends({}, prevState, {
28092
+ isFocused: false,
28093
+ dragPosition: {
28094
+ x: 0,
28095
+ y: 0
28096
+ }
28097
+ });
28098
+ });
28099
+ }
28100
+ };
28101
+ /**
28102
+ * Handles the context menu or tooltip display after dragging stops without a drop.
28103
+ */
28104
+ var handleContextMenuOrTooltip = function handleContextMenuOrTooltip(e) {
28105
+ var isTouchEvent = false;
28106
+ if (!isContextMenuDisabled && e.type === 'touchend' && !isSelectingShortcut) {
28107
+ isTouchEvent = true;
28108
+ setState(function (prevState) {
28109
+ return _extends({}, prevState, {
28110
+ isTooltipMobileVisible: true
28111
+ });
28112
+ });
28113
+ }
28114
+ if (!isContextMenuDisabled && !isSelectingShortcut && !isTouchEvent) {
28115
+ setState(function (prevState) {
28116
+ return _extends({}, prevState, {
28117
+ isContextMenuVisible: !prevState.isContextMenuVisible,
28118
+ contextMenuPosition: {
28119
+ x: e.clientX - 10,
28120
+ y: e.clientY - 5
28121
+ }
28122
+ });
28123
+ });
28124
+ }
28125
+ if (item) {
28126
+ onPointerDown(item.type, containerType != null ? containerType : null, item);
28127
+ }
28128
+ };
28129
+ var onDraggableStart = function onDraggableStart() {
28130
+ if (!item || isSelectingShortcut) {
28131
+ return;
28132
+ }
28133
+ if (onDragStart && containerType) {
28134
+ onDragStart(item, slotIndex, containerType);
28135
+ }
28136
+ };
28137
+ var onDraggableProgress = function onDraggableProgress(_e, _data) {
28138
+ // increment draggingDistance by 1
28139
+ setState(function (prevState) {
28140
+ return _extends({}, prevState, {
28141
+ draggingDistance: prevState.draggingDistance + 1
28142
+ });
28143
+ });
28144
+ if (state.draggingDistance > 10) {
28145
+ setState(function (prevState) {
28146
+ return _extends({}, prevState, {
28147
+ wasDragged: true,
28148
+ isFocused: true
28149
+ });
28150
+ });
28151
+ }
28152
+ if (!draggingItem) {
28153
+ setDraggingItem(item);
28127
28154
  }
28128
- }, [onMouseOut, cursorX, cursorY]);
28129
- return React.createElement(Container$9, {
28155
+ };
28156
+ return React.createElement(Container$b, {
28130
28157
  isDraggingItem: !!draggingItem,
28131
28158
  item: item,
28132
28159
  className: "rpgui-icon empty-slot",
28133
- isSelectingShortcut: isSelectingShortcut && ((item == null ? void 0 : item.type) === ItemType.Consumable || (item == null ? void 0 : item.type) === ItemType.Tool || (item == null ? void 0 : item.subType) === ItemSubType.Seed),
28134
- onMouseDown: handleInteraction,
28135
- onTouchStart: handleInteraction,
28136
- onMouseUp: function onMouseUp(e) {
28137
- handleInteractionEnd(e);
28160
+ onMouseUp: function onMouseUp() {
28138
28161
  var data = item ? item : null;
28139
- if (onPlaceDrop && containerType && draggingItem) {
28140
- onPlaceDrop(data, slotIndex, containerType);
28141
- }
28162
+ if (onPlaceDrop && containerType) onPlaceDrop(data, slotIndex, containerType);
28142
28163
  },
28143
28164
  onTouchEnd: function onTouchEnd(e) {
28144
- var _document$elementFrom2;
28165
+ var _document$elementFrom;
28145
28166
  var _e$changedTouches$ = e.changedTouches[0],
28146
28167
  clientX = _e$changedTouches$.clientX,
28147
28168
  clientY = _e$changedTouches$.clientY;
@@ -28150,12 +28171,12 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28150
28171
  clientY: clientY,
28151
28172
  bubbles: true
28152
28173
  });
28153
- (_document$elementFrom2 = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _document$elementFrom2.dispatchEvent(simulatedEvent);
28174
+ (_document$elementFrom = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28154
28175
  },
28155
28176
  onPointerDown: onDragStart !== undefined && onDragEnd !== undefined ? undefined : function () {
28156
28177
  if (item) onPointerDown(item.type, containerType != null ? containerType : null, item);
28157
28178
  },
28158
- onMouseLeave: handleInteractionEnd
28179
+ isSelectingShortcut: isSelectingShortcut && ((item == null ? void 0 : item.type) === ItemType.Consumable || (item == null ? void 0 : item.type) === ItemType.Tool || (item == null ? void 0 : item.subType) === ItemSubType.Seed)
28159
28180
  }, React.createElement(Draggable, {
28160
28181
  axis: isSelectingShortcut ? 'none' : 'both',
28161
28182
  defaultClassName: item ? 'draggable' : 'empty-slot',
@@ -28164,30 +28185,30 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28164
28185
  onStop: onDraggableStop,
28165
28186
  onStart: onDraggableStart,
28166
28187
  onDrag: onDraggableProgress,
28167
- position: dragState.position,
28188
+ position: dragPosition,
28168
28189
  cancel: ".empty-slot",
28169
- bounds: bounds
28190
+ bounds: ".item-container-body, .equipment-container-body"
28170
28191
  }, React.createElement(ItemContainer, {
28171
28192
  ref: dragContainer,
28172
- isFocused: dragState.isFocused,
28173
- onMouseOver: function onMouseOver() {
28174
- _onMouseOver == null ? void 0 : _onMouseOver({}, slotIndex, item, cursorX, cursorY);
28193
+ isFocused: isFocused,
28194
+ onMouseOver: function onMouseOver(event) {
28195
+ _onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, event.clientX, event.clientY);
28196
+ },
28197
+ onMouseOut: function onMouseOut() {
28198
+ if (_onMouseOut) _onMouseOut();
28175
28199
  },
28176
- onMouseOut: onMouseOut,
28177
28200
  onMouseEnter: function onMouseEnter() {
28178
- updateItemDetails({
28179
- item: item,
28180
- tooltip: {
28181
- visible: true
28182
- }
28201
+ setState(function (prevState) {
28202
+ return _extends({}, prevState, {
28203
+ isTooltipVisible: true
28204
+ });
28183
28205
  });
28184
28206
  },
28185
28207
  onMouseLeave: function onMouseLeave() {
28186
- updateItemDetails({
28187
- item: item,
28188
- tooltip: {
28189
- visible: false
28190
- }
28208
+ setState(function (prevState) {
28209
+ return _extends({}, prevState, {
28210
+ isTooltipVisible: false
28211
+ });
28191
28212
  });
28192
28213
  }
28193
28214
  }, React.createElement(ItemSlotRenderer, {
@@ -28196,9 +28217,51 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28196
28217
  atlasIMG: atlasIMG,
28197
28218
  atlasJSON: atlasJSON,
28198
28219
  containerType: containerType
28199
- }))));
28200
- }));
28201
- var Container$9 = /*#__PURE__*/styled.div.withConfig({
28220
+ }))), React.createElement(ItemSlotToolTips, {
28221
+ isTooltipVisible: isTooltipVisible,
28222
+ isTooltipMobileVisible: isTooltipMobileVisible,
28223
+ setIsTooltipMobileVisible: function setIsTooltipMobileVisible(value) {
28224
+ return setState(function (prevState) {
28225
+ return _extends({}, prevState, {
28226
+ isTooltipMobileVisible: value
28227
+ });
28228
+ });
28229
+ },
28230
+ isFocused: isFocused,
28231
+ isContextMenuVisible: isContextMenuVisible,
28232
+ isContextMenuDisabled: isContextMenuDisabled,
28233
+ item: item,
28234
+ contextActions: contextActions,
28235
+ contextMenuPosition: contextMenuPosition,
28236
+ dragScale: dragScale,
28237
+ setIsContextMenuVisible: function setIsContextMenuVisible(value) {
28238
+ return setState(function (prevState) {
28239
+ return _extends({}, prevState, {
28240
+ isContextMenuVisible: value
28241
+ });
28242
+ });
28243
+ },
28244
+ onSelected: function onSelected(optionId, item) {
28245
+ setState(function (prevState) {
28246
+ return _extends({}, prevState, {
28247
+ isContextMenuVisible: false
28248
+ });
28249
+ });
28250
+ if (_onSelected) _onSelected(optionId, item);
28251
+ },
28252
+ atlasIMG: atlasIMG,
28253
+ atlasJSON: atlasJSON,
28254
+ equipmentSet: equipmentSet,
28255
+ setIsTooltipVisible: function setIsTooltipVisible(value) {
28256
+ return setState(function (prevState) {
28257
+ return _extends({}, prevState, {
28258
+ isTooltipVisible: value
28259
+ });
28260
+ });
28261
+ }
28262
+ }));
28263
+ });
28264
+ var Container$b = /*#__PURE__*/styled.div.withConfig({
28202
28265
  displayName: "ItemSlot__Container",
28203
28266
  componentId: "sc-l2j5ef-0"
28204
28267
  })(["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 (_ref2) {
@@ -28314,7 +28377,7 @@ var ItemInfo = function ItemInfo(_ref) {
28314
28377
  });
28315
28378
  };
28316
28379
  var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
28317
- return React.createElement(Container$a, {
28380
+ return React.createElement(Container$c, {
28318
28381
  item: item
28319
28382
  }, React.createElement(Header, null, React.createElement("div", null, React.createElement(Title$1, null, item.name), item.rarity !== 'Common' && React.createElement(Rarity, {
28320
28383
  item: item
@@ -28328,7 +28391,7 @@ var ItemInfo = function ItemInfo(_ref) {
28328
28391
  "$isSpecial": true
28329
28392
  }, "Two handed"), React.createElement(Description, null, item.description), item.maxStackSize && item.maxStackSize !== 1 && React.createElement(StackInfo, null, "x", Math.round(((_item$stackQty = item.stackQty) != null ? _item$stackQty : 1) * 100) / 100, "(", item.maxStackSize, ")"), renderMissingStatistic().length > 0 && React.createElement(MissingStatistics, null, React.createElement(Statistic, null, "Equipped Diff"), itemToCompare && renderMissingStatistic()));
28330
28393
  };
28331
- var Container$a = /*#__PURE__*/styled.div.withConfig({
28394
+ var Container$c = /*#__PURE__*/styled.div.withConfig({
28332
28395
  displayName: "ItemInfo__Container",
28333
28396
  componentId: "sc-1xm4q8k-0"
28334
28397
  })(["color:white;background-color:#222;border-radius:5px;padding:0.5rem;font-size:", ";border:3px solid ", ";height:max-content;width:18rem;@media (max-width:640px){width:80vw;}"], uiFonts.size.small, function (_ref2) {
@@ -28474,7 +28537,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
28474
28537
  }
28475
28538
  return;
28476
28539
  }, []);
28477
- return React.createElement(ModalPortal, null, React.createElement(Container$b, {
28540
+ return React.createElement(ModalPortal, null, React.createElement(Container$d, {
28478
28541
  ref: ref
28479
28542
  }, React.createElement(ItemInfoDisplay, {
28480
28543
  item: item,
@@ -28483,67 +28546,11 @@ var ItemTooltip = function ItemTooltip(_ref) {
28483
28546
  equipmentSet: equipmentSet
28484
28547
  })));
28485
28548
  };
28486
- var Container$b = /*#__PURE__*/styled.div.withConfig({
28549
+ var Container$d = /*#__PURE__*/styled.div.withConfig({
28487
28550
  displayName: "ItemTooltip__Container",
28488
28551
  componentId: "sc-11d9r7x-0"
28489
28552
  })(["position:absolute;z-index:100;pointer-events:none;left:0;top:0;opacity:0;transition:opacity 0.08s;"]);
28490
28553
 
28491
- var MobileItemTooltip = function MobileItemTooltip(_ref) {
28492
- var item = _ref.item,
28493
- atlasIMG = _ref.atlasIMG,
28494
- atlasJSON = _ref.atlasJSON,
28495
- closeTooltip = _ref.closeTooltip,
28496
- equipmentSet = _ref.equipmentSet,
28497
- _ref$scale = _ref.scale,
28498
- scale = _ref$scale === void 0 ? 1 : _ref$scale,
28499
- options = _ref.options,
28500
- onSelected = _ref.onSelected;
28501
- var ref = useRef(null);
28502
- var handleFadeOut = function handleFadeOut() {
28503
- var _ref$current;
28504
- (_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
28505
- };
28506
- return React.createElement(ModalPortal, null, React.createElement(Container$c, {
28507
- ref: ref,
28508
- onTouchEnd: function onTouchEnd() {
28509
- handleFadeOut();
28510
- setTimeout(function () {
28511
- closeTooltip();
28512
- }, 100);
28513
- },
28514
- scale: scale
28515
- }, React.createElement(ItemInfoDisplay, {
28516
- item: item,
28517
- atlasIMG: atlasIMG,
28518
- atlasJSON: atlasJSON,
28519
- equipmentSet: equipmentSet,
28520
- isMobile: true
28521
- }), React.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
28522
- return React.createElement(Option, {
28523
- key: option.id,
28524
- onTouchEnd: function onTouchEnd() {
28525
- handleFadeOut();
28526
- setTimeout(function () {
28527
- onSelected == null ? void 0 : onSelected(option.id);
28528
- closeTooltip();
28529
- }, 100);
28530
- }
28531
- }, option.text);
28532
- }))));
28533
- };
28534
- var Container$c = /*#__PURE__*/styled.div.withConfig({
28535
- displayName: "MobileItemTooltip__Container",
28536
- componentId: "sc-ku4p1j-0"
28537
- })(["position:absolute;z-index:100;left:0;top:0;width:100vw;height:100vh;background-color:rgba(0 0 0 / 0.5);display:flex;justify-content:center;align-items:center;gap:0.5rem;transition:opacity 0.08s;animation:fadeIn 0.1s forwards;@keyframes fadeIn{0%{opacity:0;}100%{opacity:0.92;}}@keyframes fadeOut{0%{opacity:0.92;}100%{opacity:0;}}&.fadeOut{animation:fadeOut 0.1s forwards;}@media (max-width:640px){flex-direction:column;}"]);
28538
- var OptionsContainer = /*#__PURE__*/styled.div.withConfig({
28539
- displayName: "MobileItemTooltip__OptionsContainer",
28540
- componentId: "sc-ku4p1j-1"
28541
- })(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
28542
- var Option = /*#__PURE__*/styled.button.withConfig({
28543
- displayName: "MobileItemTooltip__Option",
28544
- componentId: "sc-ku4p1j-2"
28545
- })(["padding:1rem;background-color:#333;color:white;border:none;border-radius:3px;width:8rem;transition:background-color 0.1s;&:hover{background-color:#555;}@media (max-width:640px){padding:1rem 0.5rem;}"]);
28546
-
28547
28554
  var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
28548
28555
  var children = _ref.children,
28549
28556
  atlasIMG = _ref.atlasIMG,
@@ -28898,7 +28905,7 @@ var Dropdown = function Dropdown(_ref) {
28898
28905
  onChange(selectedValue);
28899
28906
  }
28900
28907
  }, [selectedValue]);
28901
- return React.createElement(Container$d, {
28908
+ return React.createElement(Container$e, {
28902
28909
  onMouseLeave: function onMouseLeave() {
28903
28910
  return setOpened(false);
28904
28911
  },
@@ -28926,7 +28933,7 @@ var Dropdown = function Dropdown(_ref) {
28926
28933
  }, option.option);
28927
28934
  })));
28928
28935
  };
28929
- var Container$d = /*#__PURE__*/styled.div.withConfig({
28936
+ var Container$e = /*#__PURE__*/styled.div.withConfig({
28930
28937
  displayName: "Dropdown__Container",
28931
28938
  componentId: "sc-8arn65-0"
28932
28939
  })(["position:relative;width:", ";"], function (props) {
@@ -28968,6 +28975,57 @@ var Details = /*#__PURE__*/styled.p.withConfig({
28968
28975
  componentId: "sc-kaa0h9-0"
28969
28976
  })(["font-size:", " !important;"], uiFonts.size.xsmall);
28970
28977
 
28978
+ var useCursorPosition = function useCursorPosition(_ref) {
28979
+ var _ref$scale = _ref.scale,
28980
+ scale = _ref$scale === void 0 ? 1 : _ref$scale;
28981
+ var _useState = useState({
28982
+ x: 0,
28983
+ y: 0
28984
+ }),
28985
+ position = _useState[0],
28986
+ setPosition = _useState[1];
28987
+ var scalePosition = useCallback(function (x, y) {
28988
+ return {
28989
+ x: (x - GRID_WIDTH / 2) / scale + GRID_WIDTH / 2,
28990
+ y: (y - GRID_HEIGHT / 2) / scale + GRID_HEIGHT / 2
28991
+ };
28992
+ }, [scale]);
28993
+ var setFromEvent = useCallback(function (e) {
28994
+ var x, y;
28995
+ if ('touches' in e) {
28996
+ x = e.touches[0].clientX;
28997
+ y = e.touches[0].clientY;
28998
+ } else {
28999
+ x = e.clientX;
29000
+ y = e.clientY;
29001
+ }
29002
+ var scaledPosition = scalePosition(x, y);
29003
+ setPosition(scaledPosition);
29004
+ }, [scale, scalePosition]);
29005
+ var cleanup = useCallback(function () {
29006
+ setPosition({
29007
+ x: 0,
29008
+ y: 0
29009
+ });
29010
+ }, []);
29011
+ useEffect(function () {
29012
+ var handleEvent = function handleEvent(e) {
29013
+ return setFromEvent(e);
29014
+ };
29015
+ window.addEventListener('mousemove', handleEvent);
29016
+ window.addEventListener('touchmove', handleEvent);
29017
+ window.addEventListener('mouseup', cleanup);
29018
+ window.addEventListener('touchend', cleanup);
29019
+ return function () {
29020
+ window.removeEventListener('mousemove', handleEvent);
29021
+ window.removeEventListener('touchmove', handleEvent);
29022
+ window.removeEventListener('mouseup', cleanup);
29023
+ window.removeEventListener('touchend', cleanup);
29024
+ };
29025
+ }, [setFromEvent, cleanup]);
29026
+ return position;
29027
+ };
29028
+
28971
29029
  var CONTAINER_SIZE = 32;
28972
29030
  var OFFSET = CONTAINER_SIZE / 2;
28973
29031
  var DraggedItem = function DraggedItem(_ref) {
@@ -28975,8 +29033,8 @@ var DraggedItem = function DraggedItem(_ref) {
28975
29033
  var atlasJSON = _ref.atlasJSON,
28976
29034
  atlasIMG = _ref.atlasIMG,
28977
29035
  scale = _ref.scale;
28978
- var _useItemSlotDragging = useItemSlotDragging(),
28979
- item = _useItemSlotDragging.item;
29036
+ var _useDragging = useDragging(),
29037
+ item = _useDragging.item;
28980
29038
  var _useCursorPosition = useCursorPosition({
28981
29039
  scale: scale
28982
29040
  }),
@@ -28991,7 +29049,7 @@ var DraggedItem = function DraggedItem(_ref) {
28991
29049
  var centeredX = x - OFFSET;
28992
29050
  var centeredY = y - OFFSET;
28993
29051
  var stackInfo = onRenderStackInfo((_item$_id = item == null ? void 0 : item._id) != null ? _item$_id : '', (_item$stackQty = item == null ? void 0 : item.stackQty) != null ? _item$stackQty : 0);
28994
- return React.createElement(Container$e, null, React.createElement(SpriteContainer, {
29052
+ return React.createElement(Container$f, null, React.createElement(SpriteContainer, {
28995
29053
  x: centeredX,
28996
29054
  y: centeredY
28997
29055
  }, React.createElement(SpriteFromAtlas, {
@@ -29009,7 +29067,7 @@ var DraggedItem = function DraggedItem(_ref) {
29009
29067
  }), stackInfo));
29010
29068
  };
29011
29069
  var pulse = "\n @keyframes pulse {\n 0%, 100% {\n transform: scale(1) rotate(-3deg);\n }\n 50% {\n transform: scale(0.95) rotate(-3deg);\n }\n }\n";
29012
- var Container$e = /*#__PURE__*/styled.div.withConfig({
29070
+ var Container$f = /*#__PURE__*/styled.div.withConfig({
29013
29071
  displayName: "DraggedItem__Container",
29014
29072
  componentId: "sc-mlzzcp-0"
29015
29073
  })(["position:relative;"]);
@@ -29025,127 +29083,11 @@ var SpriteContainer = /*#__PURE__*/styled.div.attrs(function (props) {
29025
29083
  componentId: "sc-mlzzcp-1"
29026
29084
  })(["", " position:absolute;z-index:100;pointer-events:none;width:", "px;height:", "px;transform:rotate(-3deg);filter:grayscale(100%);opacity:0.35;animation:pulse 2s infinite;.item-slot-qty{position:absolute;bottom:0;margin-left:0.8rem;}"], pulse, CONTAINER_SIZE, CONTAINER_SIZE);
29027
29085
 
29028
- var RelativeListMenu = function RelativeListMenu(_ref) {
29029
- var options = _ref.options,
29030
- onSelected = _ref.onSelected,
29031
- onOutsideClick = _ref.onOutsideClick,
29032
- _ref$fontSize = _ref.fontSize,
29033
- fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
29034
- pos = _ref.pos;
29035
- var ref = useRef(null);
29036
- useOutsideClick(ref, 'relative-context-menu');
29037
- useEffect(function () {
29038
- document.addEventListener('clickOutside', function (event) {
29039
- var e = event;
29040
- if (e.detail.id === 'relative-context-menu') {
29041
- if (onOutsideClick) {
29042
- onOutsideClick();
29043
- }
29044
- }
29045
- });
29046
- return function () {
29047
- document.removeEventListener('clickOutside', function (_e) {});
29048
- };
29049
- }, []);
29050
- return React.createElement(ModalPortal, null, React.createElement(Container$f, Object.assign({
29051
- fontSize: fontSize,
29052
- ref: ref
29053
- }, pos), React.createElement("ul", {
29054
- className: "rpgui-list-imp",
29055
- style: {
29056
- overflow: 'hidden'
29057
- }
29058
- }, options.map(function (params, index) {
29059
- return React.createElement(ListElement$2, {
29060
- key: (params == null ? void 0 : params.id) || index,
29061
- onPointerDown: function onPointerDown() {
29062
- onSelected(params == null ? void 0 : params.id);
29063
- }
29064
- }, (params == null ? void 0 : params.text) || 'No text');
29065
- }))));
29066
- };
29067
- var Container$f = /*#__PURE__*/styled.div.withConfig({
29068
- displayName: "RelativeListMenu__Container",
29069
- componentId: "sc-7hohf-0"
29070
- })(["position:absolute;top:", "px;left:", "px;display:flex;flex-direction:column;width:max-content;justify-content:start;align-items:flex-start;li{font-size:", "em;}"], function (props) {
29071
- return props.y;
29072
- }, function (props) {
29073
- return props.x;
29074
- }, function (props) {
29075
- return props.fontSize;
29076
- });
29077
- var ListElement$2 = /*#__PURE__*/styled.li.withConfig({
29078
- displayName: "RelativeListMenu__ListElement",
29079
- componentId: "sc-7hohf-1"
29080
- })(["margin-right:0.5rem;"]);
29081
-
29082
- var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
29083
- var _itemDetails$tooltip, _itemDetails$tooltip2, _itemDetails$contextM, _itemDetails$contextM2;
29084
- var isFocused = _ref.isFocused,
29085
- isContextMenuDisabled = _ref.isContextMenuDisabled,
29086
- dragScale = _ref.dragScale,
29087
- onSelected = _ref.onSelected,
29088
- atlasIMG = _ref.atlasIMG,
29089
- atlasJSON = _ref.atlasJSON,
29090
- equipmentSet = _ref.equipmentSet;
29091
- var _useItemSlotTooltip = useItemSlotTooltip(),
29092
- itemDetails = _useItemSlotTooltip.itemDetails,
29093
- updateItemDetails = _useItemSlotTooltip.updateItemDetails;
29094
- var item = itemDetails.item;
29095
- var handleCloseTooltip = function handleCloseTooltip() {
29096
- updateItemDetails({
29097
- item: item,
29098
- tooltip: {
29099
- mobileVisible: false
29100
- }
29101
- });
29102
- };
29103
- var handleContextMenuSelect = function handleContextMenuSelect(optionId) {
29104
- updateItemDetails({
29105
- item: item,
29106
- contextMenu: {
29107
- visible: false
29108
- }
29109
- });
29110
- if (item) {
29111
- onSelected == null ? void 0 : onSelected(optionId, item);
29112
- }
29113
- };
29114
- var handleOutsideClick = function handleOutsideClick() {
29115
- updateItemDetails({
29116
- item: item,
29117
- contextMenu: {
29118
- visible: false
29119
- }
29120
- });
29121
- };
29122
- // monitor why mobileVisible is not working
29123
- return React.createElement(React.Fragment, null, ((_itemDetails$tooltip = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip.visible) && item && !isFocused && React.createElement(ItemTooltip, {
29124
- item: item,
29125
- atlasIMG: atlasIMG,
29126
- atlasJSON: atlasJSON,
29127
- equipmentSet: equipmentSet
29128
- }), ((_itemDetails$tooltip2 = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip2.mobileVisible) && item && React.createElement(MobileItemTooltip, {
29129
- item: item,
29130
- atlasIMG: atlasIMG,
29131
- atlasJSON: atlasJSON,
29132
- equipmentSet: equipmentSet,
29133
- closeTooltip: handleCloseTooltip,
29134
- scale: dragScale,
29135
- options: ((_itemDetails$contextM = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM.actions) || [],
29136
- onSelected: handleContextMenuSelect
29137
- }), !isContextMenuDisabled && ((_itemDetails$contextM2 = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM2.visible) && itemDetails.contextMenu.actions && React.createElement(RelativeListMenu, {
29138
- options: itemDetails.contextMenu.actions,
29139
- onSelected: handleContextMenuSelect,
29140
- onOutsideClick: handleOutsideClick,
29141
- pos: itemDetails.contextMenu.position
29142
- }));
29143
- };
29144
-
29145
29086
  var EquipmentSet = function EquipmentSet(_ref) {
29146
29087
  var equipmentSet = _ref.equipmentSet,
29147
29088
  onClose = _ref.onClose,
29148
29089
  _onMouseOver = _ref.onMouseOver,
29090
+ _onSelected = _ref.onSelected,
29149
29091
  onItemClick = _ref.onItemClick,
29150
29092
  atlasIMG = _ref.atlasIMG,
29151
29093
  atlasJSON = _ref.atlasJSON,
@@ -29154,11 +29096,11 @@ var EquipmentSet = function EquipmentSet(_ref) {
29154
29096
  onItemPlaceDrop = _ref.onItemPlaceDrop,
29155
29097
  onItemOutsideDrop = _ref.onItemOutsideDrop,
29156
29098
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
29099
+ checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
29157
29100
  scale = _ref.scale,
29158
29101
  initialPosition = _ref.initialPosition,
29159
29102
  onPositionChangeEnd = _ref.onPositionChangeEnd,
29160
- onPositionChangeStart = _ref.onPositionChangeStart,
29161
- _onSelected = _ref.onSelected;
29103
+ onPositionChangeStart = _ref.onPositionChangeStart;
29162
29104
  var neck = equipmentSet.neck,
29163
29105
  leftHand = equipmentSet.leftHand,
29164
29106
  ring = equipmentSet.ring,
@@ -29171,10 +29113,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
29171
29113
  accessory = equipmentSet.accessory;
29172
29114
  var equipmentData = [neck, leftHand, ring, head, armor, legs, boot, inventory, rightHand, accessory];
29173
29115
  var equipmentMaskSlots = [ItemSlotType.Neck, ItemSlotType.LeftHand, ItemSlotType.Ring, ItemSlotType.Head, ItemSlotType.Torso, ItemSlotType.Legs, ItemSlotType.Feet, ItemSlotType.Inventory, ItemSlotType.RightHand, ItemSlotType.Accessory];
29174
- var _useItemSlotDragging = useItemSlotDragging(),
29175
- dragState = _useItemSlotDragging.dragState;
29176
- var _useItemSlotTooltip = useItemSlotTooltip(),
29177
- updateItemDetails = _useItemSlotTooltip.updateItemDetails;
29178
29116
  var onRenderEquipmentSlotRange = function onRenderEquipmentSlotRange(start, end) {
29179
29117
  var equipmentRange = equipmentData.slice(start, end);
29180
29118
  var slotMaksRange = equipmentMaskSlots.slice(start, end);
@@ -29195,6 +29133,9 @@ var EquipmentSet = function EquipmentSet(_ref) {
29195
29133
  onPointerDown: function onPointerDown(itemType, ContainerType) {
29196
29134
  if (onItemClick) onItemClick(itemType, item, ContainerType);
29197
29135
  },
29136
+ onSelected: function onSelected(optionId) {
29137
+ if (_onSelected) _onSelected(optionId);
29138
+ },
29198
29139
  onDragStart: function onDragStart(item, slotIndex, itemContainerType) {
29199
29140
  if (!item) {
29200
29141
  return;
@@ -29206,6 +29147,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
29206
29147
  },
29207
29148
  dragScale: scale,
29208
29149
  checkIfItemCanBeMoved: checkIfItemCanBeMoved,
29150
+ checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
29209
29151
  onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
29210
29152
  if (onItemPlaceDrop) onItemPlaceDrop(item, slotIndex, itemContainerType);
29211
29153
  },
@@ -29217,7 +29159,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
29217
29159
  });
29218
29160
  });
29219
29161
  };
29220
- return React.createElement(ItemSlotDraggingProvider, null, React.createElement(ItemSlotTooltipProvider, null, React.createElement(DraggedItem, {
29162
+ return React.createElement(DraggingProvider, null, React.createElement(DraggedItem, {
29221
29163
  atlasIMG: atlasIMG,
29222
29164
  atlasJSON: atlasJSON,
29223
29165
  scale: scale
@@ -29235,23 +29177,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
29235
29177
  onPositionChangeStart: onPositionChangeStart
29236
29178
  }, React.createElement(EquipmentSetContainer, {
29237
29179
  className: "equipment-container-body"
29238
- }, React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10)))), React.createElement(ItemSlotToolTips, {
29239
- isFocused: dragState.isFocused,
29240
- isContextMenuDisabled: isMobile(),
29241
- dragScale: scale,
29242
- onSelected: function onSelected(optionId, item) {
29243
- updateItemDetails({
29244
- item: item,
29245
- contextMenu: {
29246
- visible: false
29247
- }
29248
- });
29249
- if (_onSelected) _onSelected(optionId);
29250
- },
29251
- atlasIMG: atlasIMG,
29252
- atlasJSON: atlasJSON,
29253
- equipmentSet: equipmentSet
29254
- })));
29180
+ }, React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10)))));
29255
29181
  };
29256
29182
  var EquipmentSetContainer = /*#__PURE__*/styled.div.withConfig({
29257
29183
  displayName: "EquipmentSet__EquipmentSetContainer",
@@ -30684,6 +30610,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30684
30610
  _onOutsideDrop = _ref.onOutsideDrop,
30685
30611
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
30686
30612
  initialPosition = _ref.initialPosition,
30613
+ checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
30687
30614
  scale = _ref.scale,
30688
30615
  shortcuts = _ref.shortcuts,
30689
30616
  setItemShortcut = _ref.setItemShortcut,
@@ -30764,10 +30691,14 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30764
30691
  onItemClick(item, itemType, containerType);
30765
30692
  }
30766
30693
  },
30694
+ onSelected: function onSelected(optionId, item) {
30695
+ if (_onSelected) _onSelected(optionId, item);
30696
+ },
30767
30697
  onDragStart: onDragStart,
30768
30698
  onDragEnd: onDragEnd,
30769
30699
  dragScale: scale,
30770
30700
  checkIfItemCanBeMoved: checkIfItemCanBeMoved,
30701
+ checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
30771
30702
  openQuantitySelector: function openQuantitySelector(maxQuantity, callback) {
30772
30703
  setQuantitySelect({
30773
30704
  isOpen: true,
@@ -30792,17 +30723,14 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30792
30723
  atlasIMG: atlasIMG,
30793
30724
  atlasJSON: atlasJSON,
30794
30725
  isSelectingShortcut: settingShortcutIndex !== -1,
30726
+ equipmentSet: equipmentSet,
30795
30727
  setItemShortcut: type === ItemContainerType.Inventory ? handleSetShortcut : undefined,
30796
30728
  isDepotSystem: isDepotSystem
30797
30729
  }));
30798
30730
  }
30799
30731
  return slots;
30800
30732
  };
30801
- var _useItemSlotTooltip = useItemSlotTooltip(),
30802
- updateItemDetails = _useItemSlotTooltip.updateItemDetails;
30803
- var _useItemSlotDragging = useItemSlotDragging(),
30804
- dragState = _useItemSlotDragging.dragState;
30805
- return React.createElement(ItemSlotDraggingProvider, null, React.createElement(ItemSlotTooltipProvider, null, React.createElement(DraggedItem, {
30733
+ return React.createElement(DraggingProvider, null, React.createElement(DraggedItem, {
30806
30734
  atlasIMG: atlasIMG,
30807
30735
  atlasJSON: atlasJSON,
30808
30736
  scale: scale
@@ -30827,26 +30755,10 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30827
30755
  ref: containerRef,
30828
30756
  isScrollable: itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL,
30829
30757
  isFullScreen: isFullScreen
30830
- }, onRenderSlots())), React.createElement(ItemSlotToolTips, {
30831
- isFocused: dragState.isFocused,
30832
- isContextMenuDisabled: disableContextMenu,
30833
- dragScale: scale,
30834
- onSelected: function onSelected(optionId, item) {
30835
- updateItemDetails({
30836
- item: item,
30837
- contextMenu: {
30838
- visible: false
30839
- }
30840
- });
30841
- if (_onSelected) _onSelected(optionId, item);
30842
- },
30843
- atlasIMG: atlasIMG,
30844
- atlasJSON: atlasJSON,
30845
- equipmentSet: equipmentSet
30846
- }), quantitySelect.isOpen && React.createElement(ItemQuantitySelectorModal, {
30758
+ }, onRenderSlots())), quantitySelect.isOpen && React.createElement(ItemQuantitySelectorModal, {
30847
30759
  quantitySelect: quantitySelect,
30848
30760
  setQuantitySelect: setQuantitySelect
30849
- })));
30761
+ }));
30850
30762
  };
30851
30763
  var ItemsContainer = /*#__PURE__*/styled.div.withConfig({
30852
30764
  displayName: "ItemContainer__ItemsContainer",