@rpg-engine/long-bow 0.7.39 → 0.7.40
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 +17 -1
- package/dist/components/Item/Inventory/ItemSlotTooltips.d.ts +7 -10
- package/dist/long-bow.cjs.development.js +196 -100
- 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 +197 -101
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemContainer.tsx +3 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +330 -268
- package/src/components/Item/Inventory/ItemSlotTooltips.tsx +18 -22
- package/src/stories/UI/containers/ItemContainer.stories.tsx +11 -1
|
@@ -28,5 +28,21 @@ interface IProps {
|
|
|
28
28
|
setItemShortcut?: (item: IItem, shortcutIndex: number) => void;
|
|
29
29
|
isDepotSystem?: boolean;
|
|
30
30
|
}
|
|
31
|
-
export declare
|
|
31
|
+
export declare type TooltipState = {
|
|
32
|
+
visible: boolean;
|
|
33
|
+
mobileVisible: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare type ContextMenuState = {
|
|
36
|
+
position: IPosition;
|
|
37
|
+
visible: boolean;
|
|
38
|
+
};
|
|
39
|
+
export declare type DragState = {
|
|
40
|
+
isFocused: boolean;
|
|
41
|
+
wasDragged: boolean;
|
|
42
|
+
position: IPosition;
|
|
43
|
+
dropPosition: IPosition | null;
|
|
44
|
+
};
|
|
45
|
+
export declare const ItemSlot: React.MemoExoticComponent<(({ slotIndex, item, itemContainerType: containerType, slotSpriteMask, onMouseOver, onMouseOut, onPointerDown, onSelected, atlasJSON, atlasIMG, isContextMenuDisabled, onDragEnd, onDragStart, onPlaceDrop, onOutsideDrop: onDrop, checkIfItemCanBeMoved, openQuantitySelector, checkIfItemShouldDragEnd, dragScale, isSelectingShortcut, equipmentSet, setItemShortcut, isDepotSystem, }: IProps) => JSX.Element) & {
|
|
46
|
+
displayName: string;
|
|
47
|
+
}>;
|
|
32
48
|
export {};
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { IEquipmentSet, IItem } from '@rpg-engine/shared';
|
|
3
|
-
import
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { IContextMenuItem } from './itemContainerHelper';
|
|
4
|
+
import type { ContextMenuState, TooltipState } from './ItemSlot';
|
|
5
5
|
interface IProps {
|
|
6
|
-
|
|
6
|
+
tooltipState: TooltipState;
|
|
7
|
+
setTooltipState: React.Dispatch<React.SetStateAction<TooltipState>>;
|
|
8
|
+
contextMenuState: ContextMenuState;
|
|
9
|
+
setContextMenuState: React.Dispatch<React.SetStateAction<ContextMenuState>>;
|
|
7
10
|
isFocused: boolean;
|
|
8
|
-
isContextMenuVisible: boolean;
|
|
9
11
|
isContextMenuDisabled: boolean;
|
|
10
12
|
item: IItem | null;
|
|
11
|
-
isTooltipMobileVisible: boolean;
|
|
12
13
|
contextActions: IContextMenuItem[];
|
|
13
|
-
contextMenuPosition: IPosition;
|
|
14
14
|
dragScale: number | undefined;
|
|
15
|
-
setIsContextMenuVisible: (visible: boolean) => void;
|
|
16
|
-
setIsTooltipMobileVisible: (visible: boolean) => void;
|
|
17
|
-
setIsTooltipVisible: (visible: boolean) => void;
|
|
18
15
|
onSelected?: (optionId: string, item: IItem) => void;
|
|
19
16
|
atlasIMG: any;
|
|
20
17
|
atlasJSON: any;
|
|
21
18
|
equipmentSet?: IEquipmentSet | null;
|
|
22
19
|
}
|
|
23
|
-
export declare const ItemSlotToolTips: ({
|
|
20
|
+
export declare const ItemSlotToolTips: ({ tooltipState, setTooltipState, contextMenuState, setContextMenuState, isFocused, isContextMenuDisabled, item, contextActions, dragScale, onSelected, atlasIMG, atlasJSON, equipmentSet, }: IProps) => JSX.Element;
|
|
24
21
|
export {};
|
|
@@ -27657,54 +27657,68 @@ var Option = /*#__PURE__*/styled__default.button.withConfig({
|
|
|
27657
27657
|
})(["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;}"]);
|
|
27658
27658
|
|
|
27659
27659
|
var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
|
|
27660
|
-
var
|
|
27660
|
+
var tooltipState = _ref.tooltipState,
|
|
27661
|
+
setTooltipState = _ref.setTooltipState,
|
|
27662
|
+
contextMenuState = _ref.contextMenuState,
|
|
27663
|
+
setContextMenuState = _ref.setContextMenuState,
|
|
27661
27664
|
isFocused = _ref.isFocused,
|
|
27662
|
-
isContextMenuVisible = _ref.isContextMenuVisible,
|
|
27663
27665
|
isContextMenuDisabled = _ref.isContextMenuDisabled,
|
|
27664
27666
|
item = _ref.item,
|
|
27665
27667
|
contextActions = _ref.contextActions,
|
|
27666
|
-
contextMenuPosition = _ref.contextMenuPosition,
|
|
27667
27668
|
dragScale = _ref.dragScale,
|
|
27668
|
-
setIsContextMenuVisible = _ref.setIsContextMenuVisible,
|
|
27669
|
-
setIsTooltipMobileVisible = _ref.setIsTooltipMobileVisible,
|
|
27670
|
-
isTooltipMobileVisible = _ref.isTooltipMobileVisible,
|
|
27671
27669
|
_onSelected = _ref.onSelected,
|
|
27672
27670
|
atlasIMG = _ref.atlasIMG,
|
|
27673
27671
|
atlasJSON = _ref.atlasJSON,
|
|
27674
27672
|
equipmentSet = _ref.equipmentSet;
|
|
27675
|
-
return React__default.createElement(React__default.Fragment, null,
|
|
27673
|
+
return React__default.createElement(React__default.Fragment, null, tooltipState.visible && item && !isFocused && React__default.createElement(ItemTooltip, {
|
|
27676
27674
|
item: item,
|
|
27677
27675
|
atlasIMG: atlasIMG,
|
|
27678
27676
|
atlasJSON: atlasJSON,
|
|
27679
27677
|
equipmentSet: equipmentSet
|
|
27680
|
-
}),
|
|
27678
|
+
}), tooltipState.mobileVisible && item && React__default.createElement(MobileItemTooltip, {
|
|
27681
27679
|
item: item,
|
|
27682
27680
|
atlasIMG: atlasIMG,
|
|
27683
27681
|
atlasJSON: atlasJSON,
|
|
27684
27682
|
equipmentSet: equipmentSet,
|
|
27685
27683
|
closeTooltip: function closeTooltip() {
|
|
27686
|
-
|
|
27684
|
+
setTooltipState(function (prev) {
|
|
27685
|
+
return _extends({}, prev, {
|
|
27686
|
+
mobileVisible: false
|
|
27687
|
+
});
|
|
27688
|
+
});
|
|
27687
27689
|
},
|
|
27688
27690
|
scale: dragScale,
|
|
27689
27691
|
options: contextActions,
|
|
27690
27692
|
onSelected: function onSelected(optionId) {
|
|
27691
|
-
|
|
27693
|
+
setContextMenuState(function (prev) {
|
|
27694
|
+
return _extends({}, prev, {
|
|
27695
|
+
visible: false
|
|
27696
|
+
});
|
|
27697
|
+
});
|
|
27692
27698
|
if (item) {
|
|
27693
27699
|
_onSelected == null ? void 0 : _onSelected(optionId, item);
|
|
27694
27700
|
}
|
|
27695
27701
|
}
|
|
27696
|
-
}), !isContextMenuDisabled &&
|
|
27702
|
+
}), !isContextMenuDisabled && contextMenuState.visible && contextActions && React__default.createElement(RelativeListMenu, {
|
|
27697
27703
|
options: contextActions,
|
|
27698
27704
|
onSelected: function onSelected(optionId) {
|
|
27699
|
-
|
|
27705
|
+
setContextMenuState(function (prev) {
|
|
27706
|
+
return _extends({}, prev, {
|
|
27707
|
+
visible: false
|
|
27708
|
+
});
|
|
27709
|
+
});
|
|
27700
27710
|
if (item) {
|
|
27701
27711
|
_onSelected == null ? void 0 : _onSelected(optionId, item);
|
|
27702
27712
|
}
|
|
27703
27713
|
},
|
|
27704
27714
|
onOutsideClick: function onOutsideClick() {
|
|
27705
|
-
|
|
27715
|
+
setContextMenuState(function (prev) {
|
|
27716
|
+
return _extends({}, prev, {
|
|
27717
|
+
visible: false
|
|
27718
|
+
});
|
|
27719
|
+
});
|
|
27706
27720
|
},
|
|
27707
|
-
pos:
|
|
27721
|
+
pos: contextMenuState.position
|
|
27708
27722
|
}));
|
|
27709
27723
|
};
|
|
27710
27724
|
|
|
@@ -27865,7 +27879,7 @@ var EquipmentSlotSpriteByType = {
|
|
|
27865
27879
|
RightHand: 'shields/plate-shield.png',
|
|
27866
27880
|
Accessory: 'ranged-weapons/arrow.png'
|
|
27867
27881
|
};
|
|
27868
|
-
var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
27882
|
+
var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
27869
27883
|
var slotIndex = _ref.slotIndex,
|
|
27870
27884
|
item = _ref.item,
|
|
27871
27885
|
containerType = _ref.itemContainerType,
|
|
@@ -27890,70 +27904,103 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27890
27904
|
equipmentSet = _ref.equipmentSet,
|
|
27891
27905
|
setItemShortcut = _ref.setItemShortcut,
|
|
27892
27906
|
isDepotSystem = _ref.isDepotSystem;
|
|
27893
|
-
var _useState = React.useState(
|
|
27894
|
-
|
|
27895
|
-
|
|
27896
|
-
var _useState2 = React.useState(false),
|
|
27897
|
-
isTooltipMobileVisible = _useState2[0],
|
|
27898
|
-
setIsTooltipMobileVisible = _useState2[1];
|
|
27899
|
-
var _useState3 = React.useState(false),
|
|
27900
|
-
isContextMenuVisible = _useState3[0],
|
|
27901
|
-
setIsContextMenuVisible = _useState3[1];
|
|
27902
|
-
var _useState4 = React.useState({
|
|
27903
|
-
x: 0,
|
|
27904
|
-
y: 0
|
|
27907
|
+
var _useState = React.useState({
|
|
27908
|
+
visible: false,
|
|
27909
|
+
mobileVisible: false
|
|
27905
27910
|
}),
|
|
27906
|
-
|
|
27907
|
-
|
|
27908
|
-
var
|
|
27909
|
-
|
|
27910
|
-
|
|
27911
|
-
|
|
27912
|
-
|
|
27913
|
-
|
|
27914
|
-
|
|
27915
|
-
|
|
27916
|
-
|
|
27911
|
+
tooltipState = _useState[0],
|
|
27912
|
+
setTooltipState = _useState[1];
|
|
27913
|
+
var _useState2 = React.useState({
|
|
27914
|
+
visible: false,
|
|
27915
|
+
position: {
|
|
27916
|
+
x: 0,
|
|
27917
|
+
y: 0
|
|
27918
|
+
}
|
|
27919
|
+
}),
|
|
27920
|
+
contextMenuState = _useState2[0],
|
|
27921
|
+
setContextMenuState = _useState2[1];
|
|
27922
|
+
var _useState3 = React.useState({
|
|
27923
|
+
isFocused: false,
|
|
27924
|
+
wasDragged: false,
|
|
27925
|
+
position: {
|
|
27926
|
+
x: 0,
|
|
27927
|
+
y: 0
|
|
27928
|
+
},
|
|
27929
|
+
dropPosition: null
|
|
27917
27930
|
}),
|
|
27918
|
-
|
|
27919
|
-
|
|
27920
|
-
var _useState8 = React.useState(null),
|
|
27921
|
-
dropPosition = _useState8[0],
|
|
27922
|
-
setDropPosition = _useState8[1];
|
|
27931
|
+
dragState = _useState3[0],
|
|
27932
|
+
setDragState = _useState3[1];
|
|
27923
27933
|
var dragContainer = React.useRef(null);
|
|
27924
27934
|
var _useDragging = useDragging(),
|
|
27925
27935
|
draggingItem = _useDragging.item,
|
|
27926
27936
|
setDraggingItem = _useDragging.setDraggingItem;
|
|
27927
|
-
var
|
|
27928
|
-
contextActions =
|
|
27929
|
-
setContextActions =
|
|
27937
|
+
var _useState4 = React.useState([]),
|
|
27938
|
+
contextActions = _useState4[0],
|
|
27939
|
+
setContextActions = _useState4[1];
|
|
27930
27940
|
React.useEffect(function () {
|
|
27931
|
-
|
|
27932
|
-
|
|
27933
|
-
|
|
27941
|
+
setDragState(function (prev) {
|
|
27942
|
+
return _extends({}, prev, {
|
|
27943
|
+
position: {
|
|
27944
|
+
x: 0,
|
|
27945
|
+
y: 0
|
|
27946
|
+
},
|
|
27947
|
+
isFocused: false
|
|
27948
|
+
});
|
|
27934
27949
|
});
|
|
27935
|
-
setIsFocused(false);
|
|
27936
27950
|
if (item && containerType) {
|
|
27937
27951
|
setContextActions(generateContextMenu(item, containerType, isDepotSystem));
|
|
27938
27952
|
}
|
|
27939
27953
|
}, [item, isDepotSystem]);
|
|
27940
27954
|
React.useEffect(function () {
|
|
27941
|
-
if (onDrop && item && dropPosition) {
|
|
27942
|
-
onDrop(item, dropPosition);
|
|
27955
|
+
if (onDrop && item && dragState.dropPosition) {
|
|
27956
|
+
onDrop(item, dragState.dropPosition);
|
|
27957
|
+
setDragState(function (prev) {
|
|
27958
|
+
return _extends({}, prev, {
|
|
27959
|
+
dropPosition: null
|
|
27960
|
+
});
|
|
27961
|
+
});
|
|
27943
27962
|
}
|
|
27944
|
-
}, [dropPosition]);
|
|
27963
|
+
}, [dragState.dropPosition]);
|
|
27964
|
+
var getContainerBounds = React.useCallback(function () {
|
|
27965
|
+
var container = dragContainer.current;
|
|
27966
|
+
if (!container) return {
|
|
27967
|
+
left: 0,
|
|
27968
|
+
top: 0,
|
|
27969
|
+
right: 0,
|
|
27970
|
+
bottom: 0
|
|
27971
|
+
};
|
|
27972
|
+
var rect = container.getBoundingClientRect();
|
|
27973
|
+
return {
|
|
27974
|
+
left: rect.left,
|
|
27975
|
+
top: rect.top,
|
|
27976
|
+
right: window.innerWidth - rect.right,
|
|
27977
|
+
bottom: window.innerHeight - rect.bottom
|
|
27978
|
+
};
|
|
27979
|
+
}, [dragContainer]);
|
|
27945
27980
|
var resetItem = function resetItem() {
|
|
27946
|
-
|
|
27947
|
-
|
|
27981
|
+
setTooltipState(function (prev) {
|
|
27982
|
+
return _extends({}, prev, {
|
|
27983
|
+
visible: false
|
|
27984
|
+
});
|
|
27985
|
+
});
|
|
27986
|
+
setDragState(function (prev) {
|
|
27987
|
+
return _extends({}, prev, {
|
|
27988
|
+
wasDragged: false
|
|
27989
|
+
});
|
|
27990
|
+
});
|
|
27948
27991
|
};
|
|
27949
27992
|
var onSuccessfulDrag = function onSuccessfulDrag(quantity) {
|
|
27950
27993
|
resetItem();
|
|
27951
27994
|
if (quantity === -1) {
|
|
27952
|
-
|
|
27953
|
-
|
|
27954
|
-
|
|
27995
|
+
setDragState(function (prev) {
|
|
27996
|
+
return _extends({}, prev, {
|
|
27997
|
+
position: {
|
|
27998
|
+
x: 0,
|
|
27999
|
+
y: 0
|
|
28000
|
+
},
|
|
28001
|
+
isFocused: false
|
|
28002
|
+
});
|
|
27955
28003
|
});
|
|
27956
|
-
setIsFocused(false);
|
|
27957
28004
|
} else if (item) {
|
|
27958
28005
|
onDragEnd == null ? void 0 : onDragEnd(quantity);
|
|
27959
28006
|
}
|
|
@@ -27961,6 +28008,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27961
28008
|
var onDraggableStop = function onDraggableStop(e, data) {
|
|
27962
28009
|
setDraggingItem(null);
|
|
27963
28010
|
var target = e.target;
|
|
28011
|
+
if (!target) return;
|
|
27964
28012
|
if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
|
|
27965
28013
|
var index = parseInt(target.id.split('_')[1]);
|
|
27966
28014
|
if (!isNaN(index)) {
|
|
@@ -27970,7 +28018,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27970
28018
|
// remove the class react-draggable-dragging from the element
|
|
27971
28019
|
// to prevent the item from being dragged again
|
|
27972
28020
|
target.classList.remove('react-draggable-dragging');
|
|
27973
|
-
if (wasDragged && item && !isSelectingShortcut) {
|
|
28021
|
+
if (dragState.wasDragged && item && !isSelectingShortcut) {
|
|
27974
28022
|
var _e$target;
|
|
27975
28023
|
//@ts-ignore
|
|
27976
28024
|
var classes = Array.from((_e$target = e.target) == null ? void 0 : _e$target.classList);
|
|
@@ -27978,32 +28026,50 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
27978
28026
|
return elm.includes('rpgui-content');
|
|
27979
28027
|
}) || classes.length === 0;
|
|
27980
28028
|
if (isOutsideDrop) {
|
|
27981
|
-
|
|
27982
|
-
|
|
27983
|
-
|
|
28029
|
+
setDragState(function (prev) {
|
|
28030
|
+
return _extends({}, prev, {
|
|
28031
|
+
dropPosition: {
|
|
28032
|
+
x: data.x,
|
|
28033
|
+
y: data.y
|
|
28034
|
+
}
|
|
28035
|
+
});
|
|
27984
28036
|
});
|
|
27985
28037
|
}
|
|
27986
|
-
|
|
28038
|
+
setDragState(function (prev) {
|
|
28039
|
+
return _extends({}, prev, {
|
|
28040
|
+
wasDragged: false
|
|
28041
|
+
});
|
|
28042
|
+
});
|
|
27987
28043
|
var _target = dragContainer.current;
|
|
27988
|
-
if (!_target || !wasDragged) return;
|
|
28044
|
+
if (!_target || !dragState.wasDragged) return;
|
|
27989
28045
|
var style = window.getComputedStyle(_target);
|
|
27990
28046
|
var matrix = new DOMMatrixReadOnly(style.transform);
|
|
27991
28047
|
var x = matrix.m41;
|
|
27992
28048
|
var y = matrix.m42;
|
|
27993
|
-
|
|
27994
|
-
|
|
27995
|
-
|
|
28049
|
+
setDragState(function (prev) {
|
|
28050
|
+
return _extends({}, prev, {
|
|
28051
|
+
position: {
|
|
28052
|
+
x: x,
|
|
28053
|
+
y: y
|
|
28054
|
+
}
|
|
28055
|
+
});
|
|
27996
28056
|
});
|
|
27997
28057
|
setTimeout(function () {
|
|
27998
|
-
if (checkIfItemCanBeMoved
|
|
28058
|
+
if (checkIfItemCanBeMoved && checkIfItemCanBeMoved()) {
|
|
27999
28059
|
if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd()) return;
|
|
28000
|
-
if (item.stackQty && item.stackQty !== 1 && openQuantitySelector)
|
|
28060
|
+
if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) {
|
|
28061
|
+
openQuantitySelector(item.stackQty, onSuccessfulDrag);
|
|
28062
|
+
} else onSuccessfulDrag(item.stackQty);
|
|
28001
28063
|
} else {
|
|
28002
28064
|
resetItem();
|
|
28003
|
-
|
|
28004
|
-
|
|
28005
|
-
|
|
28006
|
-
|
|
28065
|
+
setDragState(function (prev) {
|
|
28066
|
+
return _extends({}, prev, {
|
|
28067
|
+
isFocused: false,
|
|
28068
|
+
position: {
|
|
28069
|
+
x: 0,
|
|
28070
|
+
y: 0
|
|
28071
|
+
}
|
|
28072
|
+
});
|
|
28007
28073
|
});
|
|
28008
28074
|
}
|
|
28009
28075
|
}, 50);
|
|
@@ -28011,15 +28077,27 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
28011
28077
|
var isTouch = false;
|
|
28012
28078
|
if (!isContextMenuDisabled && e.type === 'touchend' && !isSelectingShortcut) {
|
|
28013
28079
|
isTouch = true;
|
|
28014
|
-
|
|
28080
|
+
setTooltipState(function (prev) {
|
|
28081
|
+
return _extends({}, prev, {
|
|
28082
|
+
mobileVisible: true
|
|
28083
|
+
});
|
|
28084
|
+
});
|
|
28015
28085
|
}
|
|
28016
28086
|
if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
|
|
28017
|
-
|
|
28087
|
+
setContextMenuState(function (prev) {
|
|
28088
|
+
return _extends({}, prev, {
|
|
28089
|
+
visible: !contextMenuState.visible
|
|
28090
|
+
});
|
|
28091
|
+
});
|
|
28018
28092
|
var event = e;
|
|
28019
28093
|
if (event.clientX && event.clientY) {
|
|
28020
|
-
|
|
28021
|
-
|
|
28022
|
-
|
|
28094
|
+
setContextMenuState(function (prev) {
|
|
28095
|
+
return _extends({}, prev, {
|
|
28096
|
+
position: {
|
|
28097
|
+
x: event.clientX - 10,
|
|
28098
|
+
y: event.clientY - 5
|
|
28099
|
+
}
|
|
28100
|
+
});
|
|
28023
28101
|
});
|
|
28024
28102
|
}
|
|
28025
28103
|
}
|
|
@@ -28035,21 +28113,28 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
28035
28113
|
}
|
|
28036
28114
|
};
|
|
28037
28115
|
var onDraggableProgress = function onDraggableProgress(_e, data) {
|
|
28038
|
-
if (Math.abs(data.x -
|
|
28039
|
-
|
|
28040
|
-
|
|
28116
|
+
if (Math.abs(data.x - dragState.position.x) > 5 || Math.abs(data.y - dragState.position.y) > 5) {
|
|
28117
|
+
setDragState(function (prev) {
|
|
28118
|
+
return _extends({}, prev, {
|
|
28119
|
+
wasDragged: true,
|
|
28120
|
+
isFocused: true
|
|
28121
|
+
});
|
|
28122
|
+
});
|
|
28041
28123
|
}
|
|
28042
28124
|
if (!draggingItem) {
|
|
28043
28125
|
setDraggingItem(item);
|
|
28044
28126
|
}
|
|
28045
28127
|
};
|
|
28128
|
+
var bounds = getContainerBounds();
|
|
28046
28129
|
return React__default.createElement(Container$b, {
|
|
28047
28130
|
isDraggingItem: !!draggingItem,
|
|
28048
28131
|
item: item,
|
|
28049
28132
|
className: "rpgui-icon empty-slot",
|
|
28050
28133
|
onMouseUp: function onMouseUp() {
|
|
28051
28134
|
var data = item ? item : null;
|
|
28052
|
-
if (onPlaceDrop && containerType)
|
|
28135
|
+
if (onPlaceDrop && containerType) {
|
|
28136
|
+
onPlaceDrop(data, slotIndex, containerType);
|
|
28137
|
+
}
|
|
28053
28138
|
},
|
|
28054
28139
|
onTouchEnd: function onTouchEnd(e) {
|
|
28055
28140
|
var _document$elementFrom;
|
|
@@ -28075,12 +28160,12 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
28075
28160
|
onStop: onDraggableStop,
|
|
28076
28161
|
onStart: onDraggableStart,
|
|
28077
28162
|
onDrag: onDraggableProgress,
|
|
28078
|
-
position:
|
|
28163
|
+
position: dragState.position,
|
|
28079
28164
|
cancel: ".empty-slot",
|
|
28080
|
-
bounds:
|
|
28165
|
+
bounds: bounds
|
|
28081
28166
|
}, React__default.createElement(ItemContainer, {
|
|
28082
28167
|
ref: dragContainer,
|
|
28083
|
-
isFocused: isFocused,
|
|
28168
|
+
isFocused: dragState.isFocused,
|
|
28084
28169
|
onMouseOver: function onMouseOver(event) {
|
|
28085
28170
|
_onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, event.clientX, event.clientY);
|
|
28086
28171
|
},
|
|
@@ -28088,10 +28173,18 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
28088
28173
|
if (_onMouseOut) _onMouseOut();
|
|
28089
28174
|
},
|
|
28090
28175
|
onMouseEnter: function onMouseEnter() {
|
|
28091
|
-
|
|
28176
|
+
setTooltipState(function (prev) {
|
|
28177
|
+
return _extends({}, prev, {
|
|
28178
|
+
visible: true
|
|
28179
|
+
});
|
|
28180
|
+
});
|
|
28092
28181
|
},
|
|
28093
28182
|
onMouseLeave: function onMouseLeave() {
|
|
28094
|
-
|
|
28183
|
+
setTooltipState(function (prev) {
|
|
28184
|
+
return _extends({}, prev, {
|
|
28185
|
+
visible: false
|
|
28186
|
+
});
|
|
28187
|
+
});
|
|
28095
28188
|
}
|
|
28096
28189
|
}, React__default.createElement(ItemSlotRenderer, {
|
|
28097
28190
|
item: item,
|
|
@@ -28100,27 +28193,28 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
28100
28193
|
atlasJSON: atlasJSON,
|
|
28101
28194
|
containerType: containerType
|
|
28102
28195
|
}))), React__default.createElement(ItemSlotToolTips, {
|
|
28103
|
-
|
|
28104
|
-
|
|
28105
|
-
|
|
28106
|
-
|
|
28107
|
-
|
|
28196
|
+
tooltipState: tooltipState,
|
|
28197
|
+
setTooltipState: setTooltipState,
|
|
28198
|
+
contextMenuState: contextMenuState,
|
|
28199
|
+
setContextMenuState: setContextMenuState,
|
|
28200
|
+
isFocused: dragState.isFocused,
|
|
28108
28201
|
isContextMenuDisabled: isContextMenuDisabled,
|
|
28109
28202
|
item: item,
|
|
28110
28203
|
contextActions: contextActions,
|
|
28111
|
-
contextMenuPosition: contextMenuPosition,
|
|
28112
28204
|
dragScale: dragScale,
|
|
28113
|
-
setIsContextMenuVisible: setIsContextMenuVisible,
|
|
28114
28205
|
onSelected: function onSelected(optionId, item) {
|
|
28115
|
-
|
|
28206
|
+
setContextMenuState(function (prev) {
|
|
28207
|
+
return _extends({}, prev, {
|
|
28208
|
+
visible: false
|
|
28209
|
+
});
|
|
28210
|
+
});
|
|
28116
28211
|
if (_onSelected) _onSelected(optionId, item);
|
|
28117
28212
|
},
|
|
28118
28213
|
atlasIMG: atlasIMG,
|
|
28119
28214
|
atlasJSON: atlasJSON,
|
|
28120
|
-
equipmentSet: equipmentSet
|
|
28121
|
-
setIsTooltipVisible: setTooltipVisible
|
|
28215
|
+
equipmentSet: equipmentSet
|
|
28122
28216
|
}));
|
|
28123
|
-
});
|
|
28217
|
+
}));
|
|
28124
28218
|
var Container$b = /*#__PURE__*/styled__default.div.withConfig({
|
|
28125
28219
|
displayName: "ItemSlot__Container",
|
|
28126
28220
|
componentId: "sc-l2j5ef-0"
|
|
@@ -30546,7 +30640,9 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30546
30640
|
if (settingShortcutIndex !== -1) {
|
|
30547
30641
|
setSettingShortcutIndex(-1);
|
|
30548
30642
|
handleSetShortcut(item, settingShortcutIndex);
|
|
30549
|
-
} else if (onItemClick)
|
|
30643
|
+
} else if (onItemClick) {
|
|
30644
|
+
onItemClick(item, itemType, containerType);
|
|
30645
|
+
}
|
|
30550
30646
|
},
|
|
30551
30647
|
onSelected: function onSelected(optionId, item) {
|
|
30552
30648
|
if (_onSelected) _onSelected(optionId, item);
|