@rpg-engine/long-bow 0.7.68 → 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.
- package/dist/components/Item/Inventory/ItemSlot.d.ts +2 -17
- package/dist/components/Item/Inventory/ItemSlotTooltips.d.ts +10 -7
- package/dist/components/Item/Inventory/context/DraggingContext.d.ts +2 -17
- package/dist/long-bow.cjs.development.js +334 -354
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +335 -355
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemContainer.tsx +2 -2
- package/src/components/Item/Inventory/ItemSlot.tsx +441 -252
- package/src/components/Item/Inventory/ItemSlotTooltips.tsx +22 -18
- package/src/components/Item/Inventory/context/DraggingContext.tsx +5 -31
- package/src/mocks/skills.mocks.ts +0 -4
- package/src/stories/UI/containers/ItemContainer.stories.tsx +3 -30
- package/dist/components/Item/Inventory/hooks/useItemSlotDragAndDrop.d.ts +0 -43
- package/src/components/Item/Inventory/hooks/useItemSlotDragAndDrop.ts +0 -228
|
@@ -27656,293 +27656,76 @@ var Option = /*#__PURE__*/styled__default.button.withConfig({
|
|
|
27656
27656
|
})(["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;}"]);
|
|
27657
27657
|
|
|
27658
27658
|
var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
|
|
27659
|
-
var
|
|
27660
|
-
setTooltipState = _ref.setTooltipState,
|
|
27661
|
-
contextMenuState = _ref.contextMenuState,
|
|
27662
|
-
setContextMenuState = _ref.setContextMenuState,
|
|
27659
|
+
var isTooltipVisible = _ref.isTooltipVisible,
|
|
27663
27660
|
isFocused = _ref.isFocused,
|
|
27661
|
+
isContextMenuVisible = _ref.isContextMenuVisible,
|
|
27664
27662
|
isContextMenuDisabled = _ref.isContextMenuDisabled,
|
|
27665
27663
|
item = _ref.item,
|
|
27666
27664
|
contextActions = _ref.contextActions,
|
|
27665
|
+
contextMenuPosition = _ref.contextMenuPosition,
|
|
27667
27666
|
dragScale = _ref.dragScale,
|
|
27667
|
+
setIsContextMenuVisible = _ref.setIsContextMenuVisible,
|
|
27668
|
+
setIsTooltipMobileVisible = _ref.setIsTooltipMobileVisible,
|
|
27669
|
+
isTooltipMobileVisible = _ref.isTooltipMobileVisible,
|
|
27668
27670
|
_onSelected = _ref.onSelected,
|
|
27669
27671
|
atlasIMG = _ref.atlasIMG,
|
|
27670
27672
|
atlasJSON = _ref.atlasJSON,
|
|
27671
27673
|
equipmentSet = _ref.equipmentSet;
|
|
27672
|
-
return React__default.createElement(React__default.Fragment, null,
|
|
27674
|
+
return React__default.createElement(React__default.Fragment, null, isTooltipVisible && item && !isFocused && React__default.createElement(ItemTooltip, {
|
|
27673
27675
|
item: item,
|
|
27674
27676
|
atlasIMG: atlasIMG,
|
|
27675
27677
|
atlasJSON: atlasJSON,
|
|
27676
27678
|
equipmentSet: equipmentSet
|
|
27677
|
-
}),
|
|
27679
|
+
}), isTooltipMobileVisible && item && React__default.createElement(MobileItemTooltip, {
|
|
27678
27680
|
item: item,
|
|
27679
27681
|
atlasIMG: atlasIMG,
|
|
27680
27682
|
atlasJSON: atlasJSON,
|
|
27681
27683
|
equipmentSet: equipmentSet,
|
|
27682
27684
|
closeTooltip: function closeTooltip() {
|
|
27683
|
-
|
|
27684
|
-
return _extends({}, prev, {
|
|
27685
|
-
mobileVisible: false
|
|
27686
|
-
});
|
|
27687
|
-
});
|
|
27685
|
+
setIsTooltipMobileVisible(false);
|
|
27688
27686
|
},
|
|
27689
27687
|
scale: dragScale,
|
|
27690
27688
|
options: contextActions,
|
|
27691
27689
|
onSelected: function onSelected(optionId) {
|
|
27692
|
-
|
|
27693
|
-
return _extends({}, prev, {
|
|
27694
|
-
visible: false
|
|
27695
|
-
});
|
|
27696
|
-
});
|
|
27690
|
+
setIsContextMenuVisible(false);
|
|
27697
27691
|
if (item) {
|
|
27698
27692
|
_onSelected == null ? void 0 : _onSelected(optionId, item);
|
|
27699
27693
|
}
|
|
27700
27694
|
}
|
|
27701
|
-
}), !isContextMenuDisabled &&
|
|
27695
|
+
}), !isContextMenuDisabled && isContextMenuVisible && contextActions && React__default.createElement(RelativeListMenu, {
|
|
27702
27696
|
options: contextActions,
|
|
27703
27697
|
onSelected: function onSelected(optionId) {
|
|
27704
|
-
|
|
27705
|
-
return _extends({}, prev, {
|
|
27706
|
-
visible: false
|
|
27707
|
-
});
|
|
27708
|
-
});
|
|
27698
|
+
setIsContextMenuVisible(false);
|
|
27709
27699
|
if (item) {
|
|
27710
27700
|
_onSelected == null ? void 0 : _onSelected(optionId, item);
|
|
27711
27701
|
}
|
|
27712
27702
|
},
|
|
27713
27703
|
onOutsideClick: function onOutsideClick() {
|
|
27714
|
-
|
|
27715
|
-
return _extends({}, prev, {
|
|
27716
|
-
visible: false
|
|
27717
|
-
});
|
|
27718
|
-
});
|
|
27704
|
+
setIsContextMenuVisible(false);
|
|
27719
27705
|
},
|
|
27720
|
-
pos:
|
|
27706
|
+
pos: contextMenuPosition
|
|
27721
27707
|
}));
|
|
27722
27708
|
};
|
|
27723
27709
|
|
|
27724
27710
|
var DraggingContext = /*#__PURE__*/React.createContext({
|
|
27725
27711
|
item: null,
|
|
27726
|
-
setDraggingItem: function setDraggingItem() {}
|
|
27727
|
-
dragState: {
|
|
27728
|
-
isFocused: false,
|
|
27729
|
-
wasDragged: false,
|
|
27730
|
-
position: {
|
|
27731
|
-
x: 0,
|
|
27732
|
-
y: 0
|
|
27733
|
-
},
|
|
27734
|
-
dropPosition: null
|
|
27735
|
-
},
|
|
27736
|
-
setDragState: function setDragState() {}
|
|
27712
|
+
setDraggingItem: function setDraggingItem() {}
|
|
27737
27713
|
});
|
|
27714
|
+
var useDragging = function useDragging() {
|
|
27715
|
+
return React.useContext(DraggingContext);
|
|
27716
|
+
};
|
|
27738
27717
|
var DraggingProvider = function DraggingProvider(_ref) {
|
|
27739
27718
|
var children = _ref.children;
|
|
27740
27719
|
var _useState = React.useState(null),
|
|
27741
27720
|
item = _useState[0],
|
|
27742
27721
|
setDraggingItem = _useState[1];
|
|
27743
|
-
var _useState2 = React.useState({
|
|
27744
|
-
isFocused: false,
|
|
27745
|
-
wasDragged: false,
|
|
27746
|
-
position: {
|
|
27747
|
-
x: 0,
|
|
27748
|
-
y: 0
|
|
27749
|
-
},
|
|
27750
|
-
dropPosition: null
|
|
27751
|
-
}),
|
|
27752
|
-
dragState = _useState2[0],
|
|
27753
|
-
setDragState = _useState2[1];
|
|
27754
27722
|
return React__default.createElement(DraggingContext.Provider, {
|
|
27755
27723
|
value: {
|
|
27756
27724
|
item: item,
|
|
27757
|
-
setDraggingItem: setDraggingItem
|
|
27758
|
-
dragState: dragState,
|
|
27759
|
-
setDragState: setDragState
|
|
27725
|
+
setDraggingItem: setDraggingItem
|
|
27760
27726
|
}
|
|
27761
27727
|
}, children);
|
|
27762
27728
|
};
|
|
27763
|
-
var useDragging = function useDragging() {
|
|
27764
|
-
return React.useContext(DraggingContext);
|
|
27765
|
-
};
|
|
27766
|
-
|
|
27767
|
-
var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
27768
|
-
var isDepotSystem = _ref.isDepotSystem,
|
|
27769
|
-
item = _ref.item,
|
|
27770
|
-
onDrop = _ref.onDrop,
|
|
27771
|
-
onDragEnd = _ref.onDragEnd,
|
|
27772
|
-
checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
|
|
27773
|
-
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
27774
|
-
setItemShortcut = _ref.setItemShortcut,
|
|
27775
|
-
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
27776
|
-
onDragStart = _ref.onDragStart,
|
|
27777
|
-
onPointerDown = _ref.onPointerDown,
|
|
27778
|
-
containerType = _ref.containerType,
|
|
27779
|
-
slotIndex = _ref.slotIndex,
|
|
27780
|
-
openQuantitySelector = _ref.openQuantitySelector,
|
|
27781
|
-
isContextMenuDisabled = _ref.isContextMenuDisabled,
|
|
27782
|
-
setTooltipState = _ref.setTooltipState,
|
|
27783
|
-
setContextMenuState = _ref.setContextMenuState;
|
|
27784
|
-
var dragContainer = React.useRef(null);
|
|
27785
|
-
var _useDragging = useDragging(),
|
|
27786
|
-
draggingItem = _useDragging.item,
|
|
27787
|
-
setDraggingItem = _useDragging.setDraggingItem,
|
|
27788
|
-
dragState = _useDragging.dragState,
|
|
27789
|
-
setDragState = _useDragging.setDragState;
|
|
27790
|
-
React.useEffect(function () {
|
|
27791
|
-
setDragState(function (prev) {
|
|
27792
|
-
return _extends({}, prev, {
|
|
27793
|
-
position: {
|
|
27794
|
-
x: 0,
|
|
27795
|
-
y: 0
|
|
27796
|
-
},
|
|
27797
|
-
isFocused: false
|
|
27798
|
-
});
|
|
27799
|
-
});
|
|
27800
|
-
}, [item, isDepotSystem, setDragState]);
|
|
27801
|
-
React.useEffect(function () {
|
|
27802
|
-
if (onDrop && item && dragState.dropPosition) {
|
|
27803
|
-
onDrop(item, dragState.dropPosition);
|
|
27804
|
-
setDragState(function (prev) {
|
|
27805
|
-
return _extends({}, prev, {
|
|
27806
|
-
dropPosition: null
|
|
27807
|
-
});
|
|
27808
|
-
});
|
|
27809
|
-
}
|
|
27810
|
-
}, [dragState.dropPosition, item, onDrop]);
|
|
27811
|
-
var getContainerBounds = React.useCallback(function () {
|
|
27812
|
-
var container = dragContainer.current;
|
|
27813
|
-
if (!container) return {
|
|
27814
|
-
left: 0,
|
|
27815
|
-
top: 0,
|
|
27816
|
-
right: 0,
|
|
27817
|
-
bottom: 0
|
|
27818
|
-
};
|
|
27819
|
-
var rect = container.getBoundingClientRect();
|
|
27820
|
-
return {
|
|
27821
|
-
left: rect.left,
|
|
27822
|
-
top: rect.top,
|
|
27823
|
-
right: window.innerWidth - rect.right,
|
|
27824
|
-
bottom: window.innerHeight - rect.bottom
|
|
27825
|
-
};
|
|
27826
|
-
}, []);
|
|
27827
|
-
var resetDragState = React.useCallback(function () {
|
|
27828
|
-
setDragState(function (prev) {
|
|
27829
|
-
return _extends({}, prev, {
|
|
27830
|
-
wasDragged: false,
|
|
27831
|
-
isFocused: false,
|
|
27832
|
-
position: {
|
|
27833
|
-
x: 0,
|
|
27834
|
-
y: 0
|
|
27835
|
-
}
|
|
27836
|
-
});
|
|
27837
|
-
});
|
|
27838
|
-
}, [setTooltipState, setDragState]);
|
|
27839
|
-
var handleSuccessfulDrag = React.useCallback(function (quantity) {
|
|
27840
|
-
resetDragState();
|
|
27841
|
-
if (quantity !== -1 && item) {
|
|
27842
|
-
onDragEnd == null ? void 0 : onDragEnd(quantity);
|
|
27843
|
-
}
|
|
27844
|
-
}, [item, onDragEnd, resetDragState]);
|
|
27845
|
-
var onDraggableStart = React.useCallback(function () {
|
|
27846
|
-
if (!item || isSelectingShortcut) return;
|
|
27847
|
-
if (onDragStart && containerType) {
|
|
27848
|
-
onDragStart(item, slotIndex, containerType);
|
|
27849
|
-
}
|
|
27850
|
-
}, [item, isSelectingShortcut, onDragStart, containerType, slotIndex]);
|
|
27851
|
-
var onDraggableProgress = React.useCallback(function (_e, data) {
|
|
27852
|
-
var _dragState$position = dragState.position,
|
|
27853
|
-
x = _dragState$position.x,
|
|
27854
|
-
y = _dragState$position.y;
|
|
27855
|
-
if (Math.abs(data.x - x) > 5 || Math.abs(data.y - y) > 5) {
|
|
27856
|
-
setDragState(function (prev) {
|
|
27857
|
-
return _extends({}, prev, {
|
|
27858
|
-
wasDragged: true,
|
|
27859
|
-
isFocused: true
|
|
27860
|
-
});
|
|
27861
|
-
});
|
|
27862
|
-
}
|
|
27863
|
-
if (!draggingItem) {
|
|
27864
|
-
setDraggingItem(item);
|
|
27865
|
-
}
|
|
27866
|
-
}, [dragState.position, draggingItem, item, setDraggingItem, setDragState]);
|
|
27867
|
-
var onDraggableStop = React.useCallback(function (e, data) {
|
|
27868
|
-
setTimeout(function () {
|
|
27869
|
-
setDraggingItem(null);
|
|
27870
|
-
}, 50);
|
|
27871
|
-
var target = e.target;
|
|
27872
|
-
if (!target) return;
|
|
27873
|
-
target.classList.remove('react-draggable-dragging');
|
|
27874
|
-
if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
|
|
27875
|
-
var index = parseInt(target.id.split('_')[1]);
|
|
27876
|
-
if (!isNaN(index)) {
|
|
27877
|
-
setItemShortcut(item, index);
|
|
27878
|
-
}
|
|
27879
|
-
}
|
|
27880
|
-
if (dragState.wasDragged && item && !isSelectingShortcut) {
|
|
27881
|
-
var classes = Array.from(target.classList);
|
|
27882
|
-
var isOutsideDrop = classes.some(function (elm) {
|
|
27883
|
-
return elm.includes('rpgui-content');
|
|
27884
|
-
}) || classes.length === 0;
|
|
27885
|
-
if (isOutsideDrop) {
|
|
27886
|
-
setDragState(function (prev) {
|
|
27887
|
-
return _extends({}, prev, {
|
|
27888
|
-
dropPosition: {
|
|
27889
|
-
x: data.x,
|
|
27890
|
-
y: data.y
|
|
27891
|
-
}
|
|
27892
|
-
});
|
|
27893
|
-
});
|
|
27894
|
-
}
|
|
27895
|
-
setDragState(function (prev) {
|
|
27896
|
-
return _extends({}, prev, {
|
|
27897
|
-
wasDragged: false
|
|
27898
|
-
});
|
|
27899
|
-
});
|
|
27900
|
-
setTimeout(function () {
|
|
27901
|
-
if (checkIfItemCanBeMoved != null && checkIfItemCanBeMoved() && (!checkIfItemShouldDragEnd || checkIfItemShouldDragEnd())) {
|
|
27902
|
-
if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) {
|
|
27903
|
-
openQuantitySelector(item.stackQty, handleSuccessfulDrag);
|
|
27904
|
-
} else {
|
|
27905
|
-
handleSuccessfulDrag(item.stackQty);
|
|
27906
|
-
}
|
|
27907
|
-
} else {
|
|
27908
|
-
resetDragState();
|
|
27909
|
-
}
|
|
27910
|
-
}, 50);
|
|
27911
|
-
} else if (item) {
|
|
27912
|
-
var isTouch = e.type === 'touchend';
|
|
27913
|
-
if (!isContextMenuDisabled && isTouch && !isSelectingShortcut && !draggingItem) {
|
|
27914
|
-
setTooltipState(function (prev) {
|
|
27915
|
-
return _extends({}, prev, {
|
|
27916
|
-
mobileVisible: true
|
|
27917
|
-
});
|
|
27918
|
-
});
|
|
27919
|
-
} else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
|
|
27920
|
-
var event = e;
|
|
27921
|
-
setContextMenuState(function (prev) {
|
|
27922
|
-
return {
|
|
27923
|
-
visible: !prev.visible,
|
|
27924
|
-
position: {
|
|
27925
|
-
x: event.clientX - 10,
|
|
27926
|
-
y: event.clientY - 5
|
|
27927
|
-
}
|
|
27928
|
-
};
|
|
27929
|
-
});
|
|
27930
|
-
}
|
|
27931
|
-
onPointerDown == null ? void 0 : onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
27932
|
-
}
|
|
27933
|
-
}, [dragState.wasDragged, item, isSelectingShortcut, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, handleSuccessfulDrag, resetDragState, isContextMenuDisabled, setTooltipState, setContextMenuState, onPointerDown, containerType, setItemShortcut]);
|
|
27934
|
-
return {
|
|
27935
|
-
dragContainer: dragContainer,
|
|
27936
|
-
dragState: dragState,
|
|
27937
|
-
draggingItem: draggingItem,
|
|
27938
|
-
setDraggingItem: setDraggingItem,
|
|
27939
|
-
getContainerBounds: getContainerBounds,
|
|
27940
|
-
onDraggableStart: onDraggableStart,
|
|
27941
|
-
onDraggableProgress: onDraggableProgress,
|
|
27942
|
-
onDraggableStop: onDraggableStop,
|
|
27943
|
-
resetItem: resetDragState
|
|
27944
|
-
};
|
|
27945
|
-
};
|
|
27946
27729
|
|
|
27947
27730
|
var generateContextMenuListOptions = function generateContextMenuListOptions(actionsByTypeList) {
|
|
27948
27731
|
var contextMenu = actionsByTypeList.map(function (action) {
|
|
@@ -28081,13 +27864,13 @@ var EquipmentSlotSpriteByType = {
|
|
|
28081
27864
|
RightHand: 'shields/plate-shield.png',
|
|
28082
27865
|
Accessory: 'ranged-weapons/arrow.png'
|
|
28083
27866
|
};
|
|
28084
|
-
var ItemSlot = /*#__PURE__*/
|
|
27867
|
+
var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
28085
27868
|
var slotIndex = _ref.slotIndex,
|
|
28086
27869
|
item = _ref.item,
|
|
28087
27870
|
containerType = _ref.itemContainerType,
|
|
28088
27871
|
slotSpriteMask = _ref.slotSpriteMask,
|
|
28089
27872
|
_onMouseOver = _ref.onMouseOver,
|
|
28090
|
-
|
|
27873
|
+
_onMouseOut = _ref.onMouseOut,
|
|
28091
27874
|
onPointerDown = _ref.onPointerDown,
|
|
28092
27875
|
_onSelected = _ref.onSelected,
|
|
28093
27876
|
atlasJSON = _ref.atlasJSON,
|
|
@@ -28100,118 +27883,292 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28100
27883
|
onDrop = _ref.onOutsideDrop,
|
|
28101
27884
|
checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
|
|
28102
27885
|
openQuantitySelector = _ref.openQuantitySelector,
|
|
27886
|
+
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
28103
27887
|
dragScale = _ref.dragScale,
|
|
28104
27888
|
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
28105
27889
|
equipmentSet = _ref.equipmentSet,
|
|
28106
27890
|
setItemShortcut = _ref.setItemShortcut,
|
|
28107
27891
|
isDepotSystem = _ref.isDepotSystem;
|
|
27892
|
+
// Centralized state using a single useState hook
|
|
28108
27893
|
var _useState = React.useState({
|
|
28109
|
-
|
|
28110
|
-
|
|
28111
|
-
|
|
28112
|
-
|
|
28113
|
-
setTooltipState = _useState[1];
|
|
28114
|
-
var _useState2 = React.useState({
|
|
28115
|
-
visible: false,
|
|
28116
|
-
position: {
|
|
27894
|
+
isTooltipVisible: false,
|
|
27895
|
+
isTooltipMobileVisible: false,
|
|
27896
|
+
isContextMenuVisible: false,
|
|
27897
|
+
contextMenuPosition: {
|
|
28117
27898
|
x: 0,
|
|
28118
27899
|
y: 0
|
|
28119
|
-
}
|
|
28120
|
-
|
|
28121
|
-
|
|
28122
|
-
|
|
28123
|
-
|
|
28124
|
-
|
|
28125
|
-
|
|
28126
|
-
|
|
28127
|
-
|
|
28128
|
-
|
|
28129
|
-
onDrop: onDrop != null ? onDrop : function () {},
|
|
28130
|
-
onDragEnd: onDragEnd,
|
|
28131
|
-
checkIfItemCanBeMoved: checkIfItemCanBeMoved,
|
|
28132
|
-
setItemShortcut: setItemShortcut,
|
|
28133
|
-
isSelectingShortcut: isSelectingShortcut,
|
|
28134
|
-
onDragStart: onDragStart,
|
|
28135
|
-
onPointerDown: onPointerDown,
|
|
28136
|
-
containerType: containerType,
|
|
28137
|
-
slotIndex: slotIndex,
|
|
28138
|
-
openQuantitySelector: openQuantitySelector != null ? openQuantitySelector : function () {},
|
|
28139
|
-
isContextMenuDisabled: isContextMenuDisabled,
|
|
28140
|
-
setTooltipState: setTooltipState,
|
|
28141
|
-
contextMenuState: contextMenuState,
|
|
28142
|
-
setContextMenuState: setContextMenuState
|
|
27900
|
+
},
|
|
27901
|
+
isFocused: false,
|
|
27902
|
+
wasDragged: false,
|
|
27903
|
+
dragPosition: {
|
|
27904
|
+
x: 0,
|
|
27905
|
+
y: 0
|
|
27906
|
+
},
|
|
27907
|
+
dropPosition: null,
|
|
27908
|
+
contextActions: [],
|
|
27909
|
+
draggingDistance: 0
|
|
28143
27910
|
}),
|
|
28144
|
-
|
|
28145
|
-
|
|
28146
|
-
|
|
28147
|
-
|
|
28148
|
-
|
|
28149
|
-
|
|
28150
|
-
|
|
27911
|
+
state = _useState[0],
|
|
27912
|
+
setState = _useState[1];
|
|
27913
|
+
var isTooltipVisible = state.isTooltipVisible,
|
|
27914
|
+
isTooltipMobileVisible = state.isTooltipMobileVisible,
|
|
27915
|
+
isContextMenuVisible = state.isContextMenuVisible,
|
|
27916
|
+
contextMenuPosition = state.contextMenuPosition,
|
|
27917
|
+
isFocused = state.isFocused,
|
|
27918
|
+
wasDragged = state.wasDragged,
|
|
27919
|
+
dragPosition = state.dragPosition,
|
|
27920
|
+
dropPosition = state.dropPosition,
|
|
27921
|
+
contextActions = state.contextActions;
|
|
27922
|
+
var dragContainer = React.useRef(null);
|
|
27923
|
+
var _useDragging = useDragging(),
|
|
27924
|
+
draggingItem = _useDragging.item,
|
|
27925
|
+
setDraggingItem = _useDragging.setDraggingItem;
|
|
28151
27926
|
React.useEffect(function () {
|
|
27927
|
+
// Reset drag position and focus when item changes
|
|
27928
|
+
setState(function (prevState) {
|
|
27929
|
+
return _extends({}, prevState, {
|
|
27930
|
+
dragPosition: {
|
|
27931
|
+
x: 0,
|
|
27932
|
+
y: 0
|
|
27933
|
+
},
|
|
27934
|
+
isFocused: false
|
|
27935
|
+
});
|
|
27936
|
+
});
|
|
27937
|
+
// Update context actions when item or depot system changes
|
|
28152
27938
|
if (item && containerType) {
|
|
28153
|
-
|
|
27939
|
+
setState(function (prevState) {
|
|
27940
|
+
return _extends({}, prevState, {
|
|
27941
|
+
contextActions: generateContextMenu(item, containerType, isDepotSystem)
|
|
27942
|
+
});
|
|
27943
|
+
});
|
|
27944
|
+
} else {
|
|
27945
|
+
setState(function (prevState) {
|
|
27946
|
+
return _extends({}, prevState, {
|
|
27947
|
+
contextActions: []
|
|
27948
|
+
});
|
|
27949
|
+
});
|
|
28154
27950
|
}
|
|
28155
27951
|
}, [item, isDepotSystem]);
|
|
28156
|
-
|
|
28157
|
-
|
|
28158
|
-
|
|
28159
|
-
|
|
28160
|
-
|
|
28161
|
-
|
|
28162
|
-
|
|
28163
|
-
|
|
28164
|
-
|
|
28165
|
-
|
|
28166
|
-
|
|
28167
|
-
|
|
27952
|
+
React.useEffect(function () {
|
|
27953
|
+
// Handle outside drop
|
|
27954
|
+
if (onDrop && item && dropPosition) {
|
|
27955
|
+
onDrop(item, dropPosition);
|
|
27956
|
+
}
|
|
27957
|
+
}, [dropPosition]);
|
|
27958
|
+
var resetItem = function resetItem() {
|
|
27959
|
+
setState(function (prevState) {
|
|
27960
|
+
return _extends({}, prevState, {
|
|
27961
|
+
isTooltipVisible: false,
|
|
27962
|
+
wasDragged: false
|
|
27963
|
+
});
|
|
27964
|
+
});
|
|
27965
|
+
};
|
|
27966
|
+
var onSuccessfulDrag = function onSuccessfulDrag(quantity) {
|
|
27967
|
+
resetItem();
|
|
27968
|
+
if (quantity === -1) {
|
|
27969
|
+
setState(function (prevState) {
|
|
27970
|
+
return _extends({}, prevState, {
|
|
27971
|
+
dragPosition: {
|
|
27972
|
+
x: 0,
|
|
27973
|
+
y: 0
|
|
27974
|
+
},
|
|
27975
|
+
isFocused: false
|
|
27976
|
+
});
|
|
27977
|
+
});
|
|
27978
|
+
} else if (item) {
|
|
27979
|
+
onDragEnd == null ? void 0 : onDragEnd(quantity);
|
|
27980
|
+
}
|
|
27981
|
+
};
|
|
27982
|
+
var onDraggableStop = function onDraggableStop(e, data) {
|
|
27983
|
+
console.log('>>> ON_DRAGGABLE_STOP');
|
|
27984
|
+
// Stop the dragging state
|
|
27985
|
+
console.log('setDraggingItem(null)');
|
|
27986
|
+
setDraggingItem(null);
|
|
27987
|
+
var target = e.target;
|
|
27988
|
+
console.log('handleShortcutSetter(target)');
|
|
27989
|
+
handleShortcutSetter(target);
|
|
27990
|
+
console.log('removeDraggingClass(target)');
|
|
27991
|
+
removeDraggingClass(target);
|
|
27992
|
+
console.log('shouldHandleDraggedItem()');
|
|
27993
|
+
if (shouldHandleDraggedItem()) {
|
|
27994
|
+
console.log('handleDraggedItem(e, data)');
|
|
27995
|
+
handleDraggedItem(e, data);
|
|
27996
|
+
} else if (item && !wasDragged) {
|
|
27997
|
+
console.log('handleContextMenuOrTooltip(e)');
|
|
27998
|
+
handleContextMenuOrTooltip(e);
|
|
27999
|
+
}
|
|
28000
|
+
};
|
|
28001
|
+
/**
|
|
28002
|
+
* Handles the shortcut setter logic if the target element is a shortcut setter.
|
|
28003
|
+
*/
|
|
28004
|
+
var handleShortcutSetter = function handleShortcutSetter(target) {
|
|
28005
|
+
if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
|
|
28006
|
+
var index = parseInt(target.id.split('_')[1], 10);
|
|
28007
|
+
if (!isNaN(index)) {
|
|
28008
|
+
setItemShortcut(item, index);
|
|
28168
28009
|
}
|
|
28169
28010
|
}
|
|
28170
|
-
|
|
28171
|
-
|
|
28172
|
-
|
|
28011
|
+
};
|
|
28012
|
+
/**
|
|
28013
|
+
* Removes the dragging CSS class from the target element.
|
|
28014
|
+
*/
|
|
28015
|
+
var removeDraggingClass = function removeDraggingClass(target) {
|
|
28016
|
+
target.classList.remove('react-draggable-dragging');
|
|
28017
|
+
};
|
|
28018
|
+
/**
|
|
28019
|
+
* Determines whether the dragged item should be processed.
|
|
28020
|
+
*/
|
|
28021
|
+
var shouldHandleDraggedItem = function shouldHandleDraggedItem() {
|
|
28022
|
+
console.log("Debug: shouldHandleDraggedItem()", "wasDragged: " + wasDragged, "item: " + item, "isSelectingShortcut: " + isSelectingShortcut);
|
|
28023
|
+
return !!(wasDragged && item && !isSelectingShortcut);
|
|
28024
|
+
};
|
|
28025
|
+
/**
|
|
28026
|
+
* Handles the logic when an item has been dragged.
|
|
28027
|
+
*/
|
|
28028
|
+
var handleDraggedItem = function handleDraggedItem(e, data) {
|
|
28029
|
+
var targetClasses = Array.from(e.target.classList);
|
|
28030
|
+
var isOutsideDrop = targetClasses.some(function (elm) {
|
|
28031
|
+
return elm.includes('rpgui-content');
|
|
28032
|
+
}) || targetClasses.length === 0;
|
|
28033
|
+
if (isOutsideDrop) {
|
|
28034
|
+
setState(function (prevState) {
|
|
28035
|
+
return _extends({}, prevState, {
|
|
28036
|
+
dropPosition: {
|
|
28037
|
+
x: data.x,
|
|
28038
|
+
y: data.y
|
|
28039
|
+
}
|
|
28040
|
+
});
|
|
28041
|
+
});
|
|
28042
|
+
}
|
|
28043
|
+
setState(function (prevState) {
|
|
28044
|
+
return _extends({}, prevState, {
|
|
28045
|
+
wasDragged: false
|
|
28173
28046
|
});
|
|
28174
28047
|
});
|
|
28175
|
-
|
|
28176
|
-
|
|
28177
|
-
|
|
28178
|
-
|
|
28179
|
-
|
|
28180
|
-
|
|
28181
|
-
return _extends({},
|
|
28182
|
-
|
|
28048
|
+
var targetElement = dragContainer.current;
|
|
28049
|
+
if (!targetElement) return;
|
|
28050
|
+
var _getElementTransform = getElementTransform(targetElement),
|
|
28051
|
+
x = _getElementTransform.x,
|
|
28052
|
+
y = _getElementTransform.y;
|
|
28053
|
+
setState(function (prevState) {
|
|
28054
|
+
return _extends({}, prevState, {
|
|
28055
|
+
dragPosition: {
|
|
28056
|
+
x: x,
|
|
28057
|
+
y: y
|
|
28058
|
+
}
|
|
28183
28059
|
});
|
|
28184
28060
|
});
|
|
28185
|
-
|
|
28186
|
-
|
|
28187
|
-
|
|
28188
|
-
|
|
28189
|
-
|
|
28190
|
-
|
|
28191
|
-
|
|
28192
|
-
|
|
28193
|
-
|
|
28194
|
-
|
|
28061
|
+
// Delay to ensure state updates before proceeding
|
|
28062
|
+
setTimeout(function () {
|
|
28063
|
+
processDragEnd(item);
|
|
28064
|
+
}, 50);
|
|
28065
|
+
};
|
|
28066
|
+
/**
|
|
28067
|
+
* Retrieves the current transform position of the dragged element.
|
|
28068
|
+
*/
|
|
28069
|
+
var getElementTransform = function getElementTransform(element) {
|
|
28070
|
+
var style = window.getComputedStyle(element);
|
|
28071
|
+
var matrix = new DOMMatrixReadOnly(style.transform);
|
|
28072
|
+
return {
|
|
28073
|
+
x: matrix.m41,
|
|
28074
|
+
y: matrix.m42
|
|
28075
|
+
};
|
|
28076
|
+
};
|
|
28077
|
+
/**
|
|
28078
|
+
* Processes the end of a drag event, handling quantity selection or resetting state.
|
|
28079
|
+
*/
|
|
28080
|
+
var processDragEnd = function processDragEnd(item) {
|
|
28081
|
+
console.log("Debug: processDragEnd(item)", "item: " + item);
|
|
28082
|
+
if (checkIfItemCanBeMoved != null && checkIfItemCanBeMoved()) {
|
|
28083
|
+
console.log("Debug: checkIfItemCanBeMoved()", "result: " + checkIfItemCanBeMoved());
|
|
28084
|
+
if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd()) return;
|
|
28085
|
+
console.log("Debug: checkIfItemShouldDragEnd()", "result: " + (checkIfItemShouldDragEnd == null ? void 0 : checkIfItemShouldDragEnd()));
|
|
28086
|
+
if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) {
|
|
28087
|
+
console.log("Debug: openQuantitySelector(item.stackQty, onSuccessfulDrag)");
|
|
28088
|
+
openQuantitySelector(item.stackQty, onSuccessfulDrag);
|
|
28089
|
+
} else {
|
|
28090
|
+
console.log("Debug: onSuccessfulDrag(item.stackQty)");
|
|
28091
|
+
onSuccessfulDrag(item.stackQty);
|
|
28092
|
+
}
|
|
28093
|
+
} else {
|
|
28094
|
+
console.log("Debug: resetItem()");
|
|
28095
|
+
resetItem();
|
|
28096
|
+
setState(function (prevState) {
|
|
28097
|
+
return _extends({}, prevState, {
|
|
28098
|
+
isFocused: false,
|
|
28099
|
+
dragPosition: {
|
|
28100
|
+
x: 0,
|
|
28101
|
+
y: 0
|
|
28102
|
+
}
|
|
28103
|
+
});
|
|
28195
28104
|
});
|
|
28196
|
-
(_document$elementFrom = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
|
|
28197
28105
|
}
|
|
28198
|
-
}
|
|
28106
|
+
};
|
|
28107
|
+
/**
|
|
28108
|
+
* Handles the context menu or tooltip display after dragging stops without a drop.
|
|
28109
|
+
*/
|
|
28110
|
+
var handleContextMenuOrTooltip = function handleContextMenuOrTooltip(e) {
|
|
28111
|
+
var isTouchEvent = false;
|
|
28112
|
+
if (!isContextMenuDisabled && e.type === 'touchend' && !isSelectingShortcut) {
|
|
28113
|
+
isTouchEvent = true;
|
|
28114
|
+
setState(function (prevState) {
|
|
28115
|
+
return _extends({}, prevState, {
|
|
28116
|
+
isTooltipMobileVisible: true
|
|
28117
|
+
});
|
|
28118
|
+
});
|
|
28119
|
+
}
|
|
28120
|
+
if (!isContextMenuDisabled && !isSelectingShortcut && !isTouchEvent) {
|
|
28121
|
+
setState(function (prevState) {
|
|
28122
|
+
return _extends({}, prevState, {
|
|
28123
|
+
isContextMenuVisible: !prevState.isContextMenuVisible,
|
|
28124
|
+
contextMenuPosition: {
|
|
28125
|
+
x: e.clientX - 10,
|
|
28126
|
+
y: e.clientY - 5
|
|
28127
|
+
}
|
|
28128
|
+
});
|
|
28129
|
+
});
|
|
28130
|
+
}
|
|
28131
|
+
if (item) {
|
|
28132
|
+
onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
28133
|
+
}
|
|
28134
|
+
};
|
|
28135
|
+
var onDraggableStart = function onDraggableStart() {
|
|
28136
|
+
if (!item || isSelectingShortcut) {
|
|
28137
|
+
return;
|
|
28138
|
+
}
|
|
28139
|
+
if (onDragStart && containerType) {
|
|
28140
|
+
onDragStart(item, slotIndex, containerType);
|
|
28141
|
+
}
|
|
28142
|
+
};
|
|
28143
|
+
var onDraggableProgress = function onDraggableProgress(_e, _data) {
|
|
28144
|
+
// increment draggingDistance by 1
|
|
28145
|
+
setState(function (prevState) {
|
|
28146
|
+
return _extends({}, prevState, {
|
|
28147
|
+
draggingDistance: prevState.draggingDistance + 1
|
|
28148
|
+
});
|
|
28149
|
+
});
|
|
28150
|
+
if (state.draggingDistance > 10) {
|
|
28151
|
+
setState(function (prevState) {
|
|
28152
|
+
return _extends({}, prevState, {
|
|
28153
|
+
wasDragged: true,
|
|
28154
|
+
isFocused: true
|
|
28155
|
+
});
|
|
28156
|
+
});
|
|
28157
|
+
}
|
|
28158
|
+
if (!draggingItem) {
|
|
28159
|
+
setDraggingItem(item);
|
|
28160
|
+
}
|
|
28161
|
+
};
|
|
28199
28162
|
return React__default.createElement(Container$b, {
|
|
28200
28163
|
isDraggingItem: !!draggingItem,
|
|
28201
28164
|
item: item,
|
|
28202
28165
|
className: "rpgui-icon empty-slot",
|
|
28203
|
-
|
|
28204
|
-
onMouseDown: handleInteraction,
|
|
28205
|
-
onTouchStart: handleInteraction,
|
|
28206
|
-
onMouseUp: function onMouseUp(e) {
|
|
28207
|
-
handleInteractionEnd(e);
|
|
28166
|
+
onMouseUp: function onMouseUp() {
|
|
28208
28167
|
var data = item ? item : null;
|
|
28209
|
-
if (onPlaceDrop && containerType
|
|
28210
|
-
onPlaceDrop(data, slotIndex, containerType);
|
|
28211
|
-
}
|
|
28168
|
+
if (onPlaceDrop && containerType) onPlaceDrop(data, slotIndex, containerType);
|
|
28212
28169
|
},
|
|
28213
28170
|
onTouchEnd: function onTouchEnd(e) {
|
|
28214
|
-
var _document$
|
|
28171
|
+
var _document$elementFrom;
|
|
28215
28172
|
var _e$changedTouches$ = e.changedTouches[0],
|
|
28216
28173
|
clientX = _e$changedTouches$.clientX,
|
|
28217
28174
|
clientY = _e$changedTouches$.clientY;
|
|
@@ -28220,12 +28177,12 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28220
28177
|
clientY: clientY,
|
|
28221
28178
|
bubbles: true
|
|
28222
28179
|
});
|
|
28223
|
-
(_document$
|
|
28180
|
+
(_document$elementFrom = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
|
|
28224
28181
|
},
|
|
28225
28182
|
onPointerDown: onDragStart !== undefined && onDragEnd !== undefined ? undefined : function () {
|
|
28226
28183
|
if (item) onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
28227
28184
|
},
|
|
28228
|
-
|
|
28185
|
+
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)
|
|
28229
28186
|
}, React__default.createElement(Draggable, {
|
|
28230
28187
|
axis: isSelectingShortcut ? 'none' : 'both',
|
|
28231
28188
|
defaultClassName: item ? 'draggable' : 'empty-slot',
|
|
@@ -28234,27 +28191,29 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28234
28191
|
onStop: onDraggableStop,
|
|
28235
28192
|
onStart: onDraggableStart,
|
|
28236
28193
|
onDrag: onDraggableProgress,
|
|
28237
|
-
position:
|
|
28194
|
+
position: dragPosition,
|
|
28238
28195
|
cancel: ".empty-slot",
|
|
28239
|
-
bounds:
|
|
28196
|
+
bounds: ".item-container-body, .equipment-container-body"
|
|
28240
28197
|
}, React__default.createElement(ItemContainer, {
|
|
28241
28198
|
ref: dragContainer,
|
|
28242
|
-
isFocused:
|
|
28199
|
+
isFocused: isFocused,
|
|
28243
28200
|
onMouseOver: function onMouseOver(event) {
|
|
28244
28201
|
_onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, event.clientX, event.clientY);
|
|
28245
28202
|
},
|
|
28246
|
-
onMouseOut: onMouseOut
|
|
28203
|
+
onMouseOut: function onMouseOut() {
|
|
28204
|
+
if (_onMouseOut) _onMouseOut();
|
|
28205
|
+
},
|
|
28247
28206
|
onMouseEnter: function onMouseEnter() {
|
|
28248
|
-
|
|
28249
|
-
return _extends({},
|
|
28250
|
-
|
|
28207
|
+
setState(function (prevState) {
|
|
28208
|
+
return _extends({}, prevState, {
|
|
28209
|
+
isTooltipVisible: true
|
|
28251
28210
|
});
|
|
28252
28211
|
});
|
|
28253
28212
|
},
|
|
28254
28213
|
onMouseLeave: function onMouseLeave() {
|
|
28255
|
-
|
|
28256
|
-
return _extends({},
|
|
28257
|
-
|
|
28214
|
+
setState(function (prevState) {
|
|
28215
|
+
return _extends({}, prevState, {
|
|
28216
|
+
isTooltipVisible: false
|
|
28258
28217
|
});
|
|
28259
28218
|
});
|
|
28260
28219
|
}
|
|
@@ -28265,45 +28224,66 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28265
28224
|
atlasJSON: atlasJSON,
|
|
28266
28225
|
containerType: containerType
|
|
28267
28226
|
}))), React__default.createElement(ItemSlotToolTips, {
|
|
28268
|
-
|
|
28269
|
-
|
|
28270
|
-
|
|
28271
|
-
|
|
28272
|
-
|
|
28227
|
+
isTooltipVisible: isTooltipVisible,
|
|
28228
|
+
isTooltipMobileVisible: isTooltipMobileVisible,
|
|
28229
|
+
setIsTooltipMobileVisible: function setIsTooltipMobileVisible(value) {
|
|
28230
|
+
return setState(function (prevState) {
|
|
28231
|
+
return _extends({}, prevState, {
|
|
28232
|
+
isTooltipMobileVisible: value
|
|
28233
|
+
});
|
|
28234
|
+
});
|
|
28235
|
+
},
|
|
28236
|
+
isFocused: isFocused,
|
|
28237
|
+
isContextMenuVisible: isContextMenuVisible,
|
|
28273
28238
|
isContextMenuDisabled: isContextMenuDisabled,
|
|
28274
28239
|
item: item,
|
|
28275
28240
|
contextActions: contextActions,
|
|
28241
|
+
contextMenuPosition: contextMenuPosition,
|
|
28276
28242
|
dragScale: dragScale,
|
|
28243
|
+
setIsContextMenuVisible: function setIsContextMenuVisible(value) {
|
|
28244
|
+
return setState(function (prevState) {
|
|
28245
|
+
return _extends({}, prevState, {
|
|
28246
|
+
isContextMenuVisible: value
|
|
28247
|
+
});
|
|
28248
|
+
});
|
|
28249
|
+
},
|
|
28277
28250
|
onSelected: function onSelected(optionId, item) {
|
|
28278
|
-
|
|
28279
|
-
return _extends({},
|
|
28280
|
-
|
|
28251
|
+
setState(function (prevState) {
|
|
28252
|
+
return _extends({}, prevState, {
|
|
28253
|
+
isContextMenuVisible: false
|
|
28281
28254
|
});
|
|
28282
28255
|
});
|
|
28283
28256
|
if (_onSelected) _onSelected(optionId, item);
|
|
28284
28257
|
},
|
|
28285
28258
|
atlasIMG: atlasIMG,
|
|
28286
28259
|
atlasJSON: atlasJSON,
|
|
28287
|
-
equipmentSet: equipmentSet
|
|
28260
|
+
equipmentSet: equipmentSet,
|
|
28261
|
+
setIsTooltipVisible: function setIsTooltipVisible(value) {
|
|
28262
|
+
return setState(function (prevState) {
|
|
28263
|
+
return _extends({}, prevState, {
|
|
28264
|
+
isTooltipVisible: value
|
|
28265
|
+
});
|
|
28266
|
+
});
|
|
28267
|
+
}
|
|
28288
28268
|
}));
|
|
28289
|
-
})
|
|
28269
|
+
});
|
|
28290
28270
|
var Container$b = /*#__PURE__*/styled__default.div.withConfig({
|
|
28291
28271
|
displayName: "ItemSlot__Container",
|
|
28292
28272
|
componentId: "sc-l2j5ef-0"
|
|
28293
|
-
})(["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 (
|
|
28294
|
-
var isDraggingItem =
|
|
28273
|
+
})(["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) {
|
|
28274
|
+
var isDraggingItem = _ref2.isDraggingItem;
|
|
28295
28275
|
return isDraggingItem ? 0 : 1;
|
|
28276
|
+
}, function (_ref3) {
|
|
28277
|
+
var item = _ref3.item;
|
|
28278
|
+
return rarityColor(item);
|
|
28296
28279
|
}, function (_ref4) {
|
|
28297
28280
|
var item = _ref4.item;
|
|
28298
|
-
return rarityColor(item);
|
|
28281
|
+
return "0 0 5px 2px " + rarityColor(item);
|
|
28299
28282
|
}, function (_ref5) {
|
|
28300
28283
|
var item = _ref5.item;
|
|
28301
|
-
return "0 0 5px 2px " + rarityColor(item);
|
|
28302
|
-
}, function (_ref6) {
|
|
28303
|
-
var item = _ref6.item;
|
|
28304
28284
|
return "0 0 4px 3px " + rarityColor(item);
|
|
28305
|
-
}, function (
|
|
28306
|
-
var isSelectingShortcut =
|
|
28285
|
+
}, function (_ref6) {
|
|
28286
|
+
var isSelectingShortcut = _ref6.isSelectingShortcut;
|
|
28307
28287
|
return isSelectingShortcut ? 'bg-color-change 1s infinite' : 'none';
|
|
28308
28288
|
});
|
|
28309
28289
|
var ItemContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
@@ -30633,6 +30613,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30633
30613
|
_onOutsideDrop = _ref.onOutsideDrop,
|
|
30634
30614
|
checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
|
|
30635
30615
|
initialPosition = _ref.initialPosition,
|
|
30616
|
+
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
30636
30617
|
scale = _ref.scale,
|
|
30637
30618
|
shortcuts = _ref.shortcuts,
|
|
30638
30619
|
setItemShortcut = _ref.setItemShortcut,
|
|
@@ -30681,14 +30662,12 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30681
30662
|
document.removeEventListener('pointermove', handleMouseMove);
|
|
30682
30663
|
}, [handleMouseMove, onItemDragStart, stopScrolling]);
|
|
30683
30664
|
var onDragStart = function onDragStart(item, slotIndex, itemContainerType) {
|
|
30684
|
-
console.log('DRAG START');
|
|
30685
30665
|
if (onItemDragStart) {
|
|
30686
30666
|
onItemDragStart(item, slotIndex, itemContainerType);
|
|
30687
30667
|
}
|
|
30688
30668
|
onDragStartScrollingEvents();
|
|
30689
30669
|
};
|
|
30690
30670
|
var onDragEnd = function onDragEnd(quantity) {
|
|
30691
|
-
console.log('DRAG END');
|
|
30692
30671
|
if (onItemDragEnd) {
|
|
30693
30672
|
onItemDragEnd(quantity);
|
|
30694
30673
|
}
|
|
@@ -30722,6 +30701,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30722
30701
|
onDragEnd: onDragEnd,
|
|
30723
30702
|
dragScale: scale,
|
|
30724
30703
|
checkIfItemCanBeMoved: checkIfItemCanBeMoved,
|
|
30704
|
+
checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
|
|
30725
30705
|
openQuantitySelector: function openQuantitySelector(maxQuantity, callback) {
|
|
30726
30706
|
setQuantitySelect({
|
|
30727
30707
|
isOpen: true,
|