@rpg-engine/long-bow 0.7.67 → 0.7.70
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 -4
- package/dist/components/Item/Inventory/ItemSlotTooltips.d.ts +2 -13
- package/dist/components/Item/Inventory/context/ItemSlotDraggingContext.d.ts +26 -0
- package/dist/components/Item/Inventory/context/ItemSlotTooltipContext.d.ts +28 -0
- package/dist/components/Item/Inventory/hooks/useItemSlotDragAndDrop.d.ts +2 -6
- package/dist/hooks/useCursorPosition.d.ts +1 -1
- package/dist/long-bow.cjs.development.js +465 -421
- 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 +467 -423
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Equipment/EquipmentSet.tsx +61 -29
- package/src/components/Item/Inventory/DraggedItem.tsx +2 -2
- package/src/components/Item/Inventory/ItemContainer.tsx +68 -44
- package/src/components/Item/Inventory/ItemSlot.tsx +48 -100
- package/src/components/Item/Inventory/ItemSlotTooltips.tsx +47 -49
- package/src/components/Item/Inventory/context/ItemSlotDraggingContext.tsx +52 -0
- package/src/components/Item/Inventory/context/ItemSlotTooltipContext.tsx +95 -0
- package/src/components/Item/Inventory/hooks/useItemSlotDragAndDrop.ts +57 -40
- package/src/hooks/useCursorPosition.ts +29 -20
- package/src/mocks/skills.mocks.ts +0 -4
- package/dist/components/Item/Inventory/context/DraggingContext.d.ts +0 -11
- package/src/components/Item/Inventory/context/DraggingContext.tsx +0 -26
|
@@ -27377,6 +27377,57 @@ var Container$8 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
27377
27377
|
componentId: "sc-dgmp04-0"
|
|
27378
27378
|
})(["position:static !important;"]);
|
|
27379
27379
|
|
|
27380
|
+
var useCursorPosition = function useCursorPosition(_ref) {
|
|
27381
|
+
var _ref$scale = _ref.scale,
|
|
27382
|
+
scale = _ref$scale === void 0 ? 1 : _ref$scale;
|
|
27383
|
+
var _useState = React.useState({
|
|
27384
|
+
x: 0,
|
|
27385
|
+
y: 0
|
|
27386
|
+
}),
|
|
27387
|
+
position = _useState[0],
|
|
27388
|
+
setPosition = _useState[1];
|
|
27389
|
+
var scalePosition = React.useCallback(function (x, y) {
|
|
27390
|
+
return {
|
|
27391
|
+
x: (x - shared.GRID_WIDTH / 2) / scale + shared.GRID_WIDTH / 2,
|
|
27392
|
+
y: (y - shared.GRID_HEIGHT / 2) / scale + shared.GRID_HEIGHT / 2
|
|
27393
|
+
};
|
|
27394
|
+
}, [scale]);
|
|
27395
|
+
var setFromEvent = React.useCallback(function (e) {
|
|
27396
|
+
var x, y;
|
|
27397
|
+
if ('touches' in e) {
|
|
27398
|
+
x = e.touches[0].clientX;
|
|
27399
|
+
y = e.touches[0].clientY;
|
|
27400
|
+
} else {
|
|
27401
|
+
x = e.clientX;
|
|
27402
|
+
y = e.clientY;
|
|
27403
|
+
}
|
|
27404
|
+
var scaledPosition = scalePosition(x, y);
|
|
27405
|
+
setPosition(scaledPosition);
|
|
27406
|
+
}, [scale, scalePosition]);
|
|
27407
|
+
var cleanup = React.useCallback(function () {
|
|
27408
|
+
setPosition({
|
|
27409
|
+
x: 0,
|
|
27410
|
+
y: 0
|
|
27411
|
+
});
|
|
27412
|
+
}, []);
|
|
27413
|
+
React.useEffect(function () {
|
|
27414
|
+
var handleEvent = function handleEvent(e) {
|
|
27415
|
+
return setFromEvent(e);
|
|
27416
|
+
};
|
|
27417
|
+
window.addEventListener('mousemove', handleEvent);
|
|
27418
|
+
window.addEventListener('touchmove', handleEvent);
|
|
27419
|
+
window.addEventListener('mouseup', cleanup);
|
|
27420
|
+
window.addEventListener('touchend', cleanup);
|
|
27421
|
+
return function () {
|
|
27422
|
+
window.removeEventListener('mousemove', handleEvent);
|
|
27423
|
+
window.removeEventListener('touchmove', handleEvent);
|
|
27424
|
+
window.removeEventListener('mouseup', cleanup);
|
|
27425
|
+
window.removeEventListener('touchend', cleanup);
|
|
27426
|
+
};
|
|
27427
|
+
}, [setFromEvent, cleanup]);
|
|
27428
|
+
return position;
|
|
27429
|
+
};
|
|
27430
|
+
|
|
27380
27431
|
var rarityColor = function rarityColor(item) {
|
|
27381
27432
|
switch (item == null ? void 0 : item.rarity) {
|
|
27382
27433
|
case shared.ItemRarities.Uncommon:
|
|
@@ -27545,205 +27596,108 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
|
|
|
27545
27596
|
return React__default.createElement(React__default.Fragment, null, onRenderSlot(item));
|
|
27546
27597
|
};
|
|
27547
27598
|
|
|
27548
|
-
|
|
27549
|
-
|
|
27550
|
-
|
|
27551
|
-
|
|
27552
|
-
|
|
27553
|
-
|
|
27554
|
-
|
|
27555
|
-
|
|
27556
|
-
|
|
27599
|
+
// Set default state with clearly defined initial values
|
|
27600
|
+
var defaultItemDetails = {
|
|
27601
|
+
item: null,
|
|
27602
|
+
tooltip: {
|
|
27603
|
+
visible: false,
|
|
27604
|
+
mobileVisible: false
|
|
27605
|
+
},
|
|
27606
|
+
contextMenu: {
|
|
27607
|
+
visible: false,
|
|
27608
|
+
position: {
|
|
27609
|
+
x: 0,
|
|
27610
|
+
y: 0
|
|
27611
|
+
},
|
|
27612
|
+
actions: []
|
|
27613
|
+
}
|
|
27614
|
+
};
|
|
27615
|
+
// Create context with default values
|
|
27616
|
+
var ItemSlotTooltipContext = /*#__PURE__*/React.createContext({
|
|
27617
|
+
itemDetails: defaultItemDetails,
|
|
27618
|
+
updateItemDetails: function updateItemDetails() {},
|
|
27619
|
+
clearItemDetails: function clearItemDetails() {}
|
|
27620
|
+
});
|
|
27621
|
+
// Provider component
|
|
27622
|
+
var ItemSlotTooltipProvider = function ItemSlotTooltipProvider(_ref) {
|
|
27623
|
+
var children = _ref.children;
|
|
27624
|
+
var _useState = React.useState(defaultItemDetails),
|
|
27625
|
+
itemDetails = _useState[0],
|
|
27626
|
+
setItemDetails = _useState[1];
|
|
27557
27627
|
React.useEffect(function () {
|
|
27558
|
-
|
|
27559
|
-
|
|
27560
|
-
|
|
27561
|
-
|
|
27562
|
-
|
|
27563
|
-
|
|
27564
|
-
}
|
|
27628
|
+
console.log('itemDetails', itemDetails);
|
|
27629
|
+
}, [itemDetails]);
|
|
27630
|
+
// Memoize the update function to optimize performance
|
|
27631
|
+
var updateItemDetails = React.useCallback(function (updates) {
|
|
27632
|
+
setItemDetails(function (prev) {
|
|
27633
|
+
var _updates$contextMenu$, _updates$contextMenu, _prev$contextMenu;
|
|
27634
|
+
return _extends({}, prev, updates, {
|
|
27635
|
+
tooltip: _extends({}, prev.tooltip, updates.tooltip),
|
|
27636
|
+
contextMenu: _extends({}, prev.contextMenu, updates.contextMenu, {
|
|
27637
|
+
// Ensure actions are properly merged or overridden
|
|
27638
|
+
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
|
|
27639
|
+
})
|
|
27640
|
+
});
|
|
27565
27641
|
});
|
|
27566
|
-
return function () {
|
|
27567
|
-
document.removeEventListener('clickOutside', function (_e) {});
|
|
27568
|
-
};
|
|
27569
27642
|
}, []);
|
|
27570
|
-
|
|
27571
|
-
|
|
27572
|
-
|
|
27573
|
-
|
|
27574
|
-
|
|
27575
|
-
|
|
27576
|
-
|
|
27643
|
+
var clearItemDetails = React.useCallback(function () {
|
|
27644
|
+
setItemDetails(defaultItemDetails);
|
|
27645
|
+
}, []);
|
|
27646
|
+
return React__default.createElement(ItemSlotTooltipContext.Provider, {
|
|
27647
|
+
value: {
|
|
27648
|
+
itemDetails: itemDetails,
|
|
27649
|
+
updateItemDetails: updateItemDetails,
|
|
27650
|
+
clearItemDetails: clearItemDetails
|
|
27577
27651
|
}
|
|
27578
|
-
},
|
|
27579
|
-
return React__default.createElement(ListElement$2, {
|
|
27580
|
-
key: (params == null ? void 0 : params.id) || index,
|
|
27581
|
-
onPointerDown: function onPointerDown() {
|
|
27582
|
-
onSelected(params == null ? void 0 : params.id);
|
|
27583
|
-
}
|
|
27584
|
-
}, (params == null ? void 0 : params.text) || 'No text');
|
|
27585
|
-
}))));
|
|
27586
|
-
};
|
|
27587
|
-
var Container$9 = /*#__PURE__*/styled__default.div.withConfig({
|
|
27588
|
-
displayName: "RelativeListMenu__Container",
|
|
27589
|
-
componentId: "sc-7hohf-0"
|
|
27590
|
-
})(["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) {
|
|
27591
|
-
return props.y;
|
|
27592
|
-
}, function (props) {
|
|
27593
|
-
return props.x;
|
|
27594
|
-
}, function (props) {
|
|
27595
|
-
return props.fontSize;
|
|
27596
|
-
});
|
|
27597
|
-
var ListElement$2 = /*#__PURE__*/styled__default.li.withConfig({
|
|
27598
|
-
displayName: "RelativeListMenu__ListElement",
|
|
27599
|
-
componentId: "sc-7hohf-1"
|
|
27600
|
-
})(["margin-right:0.5rem;"]);
|
|
27601
|
-
|
|
27602
|
-
var MobileItemTooltip = function MobileItemTooltip(_ref) {
|
|
27603
|
-
var item = _ref.item,
|
|
27604
|
-
atlasIMG = _ref.atlasIMG,
|
|
27605
|
-
atlasJSON = _ref.atlasJSON,
|
|
27606
|
-
closeTooltip = _ref.closeTooltip,
|
|
27607
|
-
equipmentSet = _ref.equipmentSet,
|
|
27608
|
-
_ref$scale = _ref.scale,
|
|
27609
|
-
scale = _ref$scale === void 0 ? 1 : _ref$scale,
|
|
27610
|
-
options = _ref.options,
|
|
27611
|
-
onSelected = _ref.onSelected;
|
|
27612
|
-
var ref = React.useRef(null);
|
|
27613
|
-
var handleFadeOut = function handleFadeOut() {
|
|
27614
|
-
var _ref$current;
|
|
27615
|
-
(_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
|
|
27616
|
-
};
|
|
27617
|
-
return React__default.createElement(ModalPortal, null, React__default.createElement(Container$a, {
|
|
27618
|
-
ref: ref,
|
|
27619
|
-
onTouchEnd: function onTouchEnd() {
|
|
27620
|
-
handleFadeOut();
|
|
27621
|
-
setTimeout(function () {
|
|
27622
|
-
closeTooltip();
|
|
27623
|
-
}, 100);
|
|
27624
|
-
},
|
|
27625
|
-
scale: scale
|
|
27626
|
-
}, React__default.createElement(ItemInfoDisplay, {
|
|
27627
|
-
item: item,
|
|
27628
|
-
atlasIMG: atlasIMG,
|
|
27629
|
-
atlasJSON: atlasJSON,
|
|
27630
|
-
equipmentSet: equipmentSet,
|
|
27631
|
-
isMobile: true
|
|
27632
|
-
}), React__default.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
|
|
27633
|
-
return React__default.createElement(Option, {
|
|
27634
|
-
key: option.id,
|
|
27635
|
-
onTouchEnd: function onTouchEnd() {
|
|
27636
|
-
handleFadeOut();
|
|
27637
|
-
setTimeout(function () {
|
|
27638
|
-
onSelected == null ? void 0 : onSelected(option.id);
|
|
27639
|
-
closeTooltip();
|
|
27640
|
-
}, 100);
|
|
27641
|
-
}
|
|
27642
|
-
}, option.text);
|
|
27643
|
-
}))));
|
|
27652
|
+
}, children);
|
|
27644
27653
|
};
|
|
27645
|
-
|
|
27646
|
-
|
|
27647
|
-
|
|
27648
|
-
})(["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;}"]);
|
|
27649
|
-
var OptionsContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
27650
|
-
displayName: "MobileItemTooltip__OptionsContainer",
|
|
27651
|
-
componentId: "sc-ku4p1j-1"
|
|
27652
|
-
})(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
|
|
27653
|
-
var Option = /*#__PURE__*/styled__default.button.withConfig({
|
|
27654
|
-
displayName: "MobileItemTooltip__Option",
|
|
27655
|
-
componentId: "sc-ku4p1j-2"
|
|
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
|
-
|
|
27658
|
-
var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
|
|
27659
|
-
var tooltipState = _ref.tooltipState,
|
|
27660
|
-
setTooltipState = _ref.setTooltipState,
|
|
27661
|
-
contextMenuState = _ref.contextMenuState,
|
|
27662
|
-
setContextMenuState = _ref.setContextMenuState,
|
|
27663
|
-
isFocused = _ref.isFocused,
|
|
27664
|
-
isContextMenuDisabled = _ref.isContextMenuDisabled,
|
|
27665
|
-
item = _ref.item,
|
|
27666
|
-
contextActions = _ref.contextActions,
|
|
27667
|
-
dragScale = _ref.dragScale,
|
|
27668
|
-
_onSelected = _ref.onSelected,
|
|
27669
|
-
atlasIMG = _ref.atlasIMG,
|
|
27670
|
-
atlasJSON = _ref.atlasJSON,
|
|
27671
|
-
equipmentSet = _ref.equipmentSet,
|
|
27672
|
-
isDragging = _ref.isDragging,
|
|
27673
|
-
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
27674
|
-
showTooltipDelayed = _ref.showTooltipDelayed;
|
|
27675
|
-
var canShow = !isDragging || !isSelectingShortcut || showTooltipDelayed;
|
|
27676
|
-
return React__default.createElement(React__default.Fragment, null, tooltipState.visible && item && !isFocused && canShow && React__default.createElement(ItemTooltip, {
|
|
27677
|
-
item: item,
|
|
27678
|
-
atlasIMG: atlasIMG,
|
|
27679
|
-
atlasJSON: atlasJSON,
|
|
27680
|
-
equipmentSet: equipmentSet
|
|
27681
|
-
}), tooltipState.mobileVisible && item && canShow && React__default.createElement(MobileItemTooltip, {
|
|
27682
|
-
item: item,
|
|
27683
|
-
atlasIMG: atlasIMG,
|
|
27684
|
-
atlasJSON: atlasJSON,
|
|
27685
|
-
equipmentSet: equipmentSet,
|
|
27686
|
-
closeTooltip: function closeTooltip() {
|
|
27687
|
-
setTooltipState(function (prev) {
|
|
27688
|
-
return _extends({}, prev, {
|
|
27689
|
-
mobileVisible: false
|
|
27690
|
-
});
|
|
27691
|
-
});
|
|
27692
|
-
},
|
|
27693
|
-
scale: dragScale,
|
|
27694
|
-
options: contextActions,
|
|
27695
|
-
onSelected: function onSelected(optionId) {
|
|
27696
|
-
setContextMenuState(function (prev) {
|
|
27697
|
-
return _extends({}, prev, {
|
|
27698
|
-
visible: false
|
|
27699
|
-
});
|
|
27700
|
-
});
|
|
27701
|
-
if (item) {
|
|
27702
|
-
_onSelected == null ? void 0 : _onSelected(optionId, item);
|
|
27703
|
-
}
|
|
27704
|
-
}
|
|
27705
|
-
}), !isContextMenuDisabled && contextMenuState.visible && contextActions && canShow && React__default.createElement(RelativeListMenu, {
|
|
27706
|
-
options: contextActions,
|
|
27707
|
-
onSelected: function onSelected(optionId) {
|
|
27708
|
-
setContextMenuState(function (prev) {
|
|
27709
|
-
return _extends({}, prev, {
|
|
27710
|
-
visible: false
|
|
27711
|
-
});
|
|
27712
|
-
});
|
|
27713
|
-
if (item) {
|
|
27714
|
-
_onSelected == null ? void 0 : _onSelected(optionId, item);
|
|
27715
|
-
}
|
|
27716
|
-
},
|
|
27717
|
-
onOutsideClick: function onOutsideClick() {
|
|
27718
|
-
setContextMenuState(function (prev) {
|
|
27719
|
-
return _extends({}, prev, {
|
|
27720
|
-
visible: false
|
|
27721
|
-
});
|
|
27722
|
-
});
|
|
27723
|
-
},
|
|
27724
|
-
pos: contextMenuState.position
|
|
27725
|
-
}));
|
|
27654
|
+
// Custom hook for consuming the context
|
|
27655
|
+
var useItemSlotTooltip = function useItemSlotTooltip() {
|
|
27656
|
+
return React.useContext(ItemSlotTooltipContext);
|
|
27726
27657
|
};
|
|
27727
27658
|
|
|
27728
|
-
var
|
|
27659
|
+
var ItemSlotDraggingContext = /*#__PURE__*/React.createContext({
|
|
27729
27660
|
item: null,
|
|
27730
|
-
setDraggingItem: function setDraggingItem() {}
|
|
27661
|
+
setDraggingItem: function setDraggingItem() {},
|
|
27662
|
+
dragState: {
|
|
27663
|
+
isFocused: false,
|
|
27664
|
+
wasDragged: false,
|
|
27665
|
+
position: {
|
|
27666
|
+
x: 0,
|
|
27667
|
+
y: 0
|
|
27668
|
+
},
|
|
27669
|
+
dropPosition: null
|
|
27670
|
+
},
|
|
27671
|
+
setDragState: function setDragState() {}
|
|
27731
27672
|
});
|
|
27732
|
-
var
|
|
27733
|
-
return React.useContext(DraggingContext);
|
|
27734
|
-
};
|
|
27735
|
-
var DraggingProvider = function DraggingProvider(_ref) {
|
|
27673
|
+
var ItemSlotDraggingProvider = function ItemSlotDraggingProvider(_ref) {
|
|
27736
27674
|
var children = _ref.children;
|
|
27737
27675
|
var _useState = React.useState(null),
|
|
27738
27676
|
item = _useState[0],
|
|
27739
27677
|
setDraggingItem = _useState[1];
|
|
27740
|
-
|
|
27678
|
+
var _useState2 = React.useState({
|
|
27679
|
+
isFocused: false,
|
|
27680
|
+
wasDragged: false,
|
|
27681
|
+
position: {
|
|
27682
|
+
x: 0,
|
|
27683
|
+
y: 0
|
|
27684
|
+
},
|
|
27685
|
+
dropPosition: null
|
|
27686
|
+
}),
|
|
27687
|
+
dragState = _useState2[0],
|
|
27688
|
+
setDragState = _useState2[1];
|
|
27689
|
+
return React__default.createElement(ItemSlotDraggingContext.Provider, {
|
|
27741
27690
|
value: {
|
|
27742
27691
|
item: item,
|
|
27743
|
-
setDraggingItem: setDraggingItem
|
|
27692
|
+
setDraggingItem: setDraggingItem,
|
|
27693
|
+
dragState: dragState,
|
|
27694
|
+
setDragState: setDragState
|
|
27744
27695
|
}
|
|
27745
27696
|
}, children);
|
|
27746
27697
|
};
|
|
27698
|
+
var useItemSlotDragging = function useItemSlotDragging() {
|
|
27699
|
+
return React.useContext(ItemSlotDraggingContext);
|
|
27700
|
+
};
|
|
27747
27701
|
|
|
27748
27702
|
var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
27749
27703
|
var isDepotSystem = _ref.isDepotSystem,
|
|
@@ -27759,24 +27713,16 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27759
27713
|
containerType = _ref.containerType,
|
|
27760
27714
|
slotIndex = _ref.slotIndex,
|
|
27761
27715
|
openQuantitySelector = _ref.openQuantitySelector,
|
|
27762
|
-
isContextMenuDisabled = _ref.isContextMenuDisabled
|
|
27763
|
-
setTooltipState = _ref.setTooltipState,
|
|
27764
|
-
setContextMenuState = _ref.setContextMenuState;
|
|
27716
|
+
isContextMenuDisabled = _ref.isContextMenuDisabled;
|
|
27765
27717
|
var dragContainer = React.useRef(null);
|
|
27766
|
-
var
|
|
27767
|
-
draggingItem =
|
|
27768
|
-
setDraggingItem =
|
|
27769
|
-
|
|
27770
|
-
|
|
27771
|
-
|
|
27772
|
-
|
|
27773
|
-
|
|
27774
|
-
y: 0
|
|
27775
|
-
},
|
|
27776
|
-
dropPosition: null
|
|
27777
|
-
}),
|
|
27778
|
-
dragState = _useState[0],
|
|
27779
|
-
setDragState = _useState[1];
|
|
27718
|
+
var _useItemSlotDragging = useItemSlotDragging(),
|
|
27719
|
+
draggingItem = _useItemSlotDragging.item,
|
|
27720
|
+
setDraggingItem = _useItemSlotDragging.setDraggingItem,
|
|
27721
|
+
dragState = _useItemSlotDragging.dragState,
|
|
27722
|
+
setDragState = _useItemSlotDragging.setDragState;
|
|
27723
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
27724
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails,
|
|
27725
|
+
itemDetails = _useItemSlotTooltip.itemDetails;
|
|
27780
27726
|
React.useEffect(function () {
|
|
27781
27727
|
setDragState(function (prev) {
|
|
27782
27728
|
return _extends({}, prev, {
|
|
@@ -27787,7 +27733,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27787
27733
|
isFocused: false
|
|
27788
27734
|
});
|
|
27789
27735
|
});
|
|
27790
|
-
}, [item, isDepotSystem]);
|
|
27736
|
+
}, [item, isDepotSystem, setDragState]);
|
|
27791
27737
|
React.useEffect(function () {
|
|
27792
27738
|
if (onDrop && item && dragState.dropPosition) {
|
|
27793
27739
|
onDrop(item, dragState.dropPosition);
|
|
@@ -27815,11 +27761,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27815
27761
|
};
|
|
27816
27762
|
}, []);
|
|
27817
27763
|
var resetDragState = React.useCallback(function () {
|
|
27818
|
-
|
|
27819
|
-
return _extends({}, prev, {
|
|
27820
|
-
visible: false
|
|
27821
|
-
});
|
|
27822
|
-
});
|
|
27764
|
+
console.log('RESET_DRAG_STATE!');
|
|
27823
27765
|
setDragState(function (prev) {
|
|
27824
27766
|
return _extends({}, prev, {
|
|
27825
27767
|
wasDragged: false,
|
|
@@ -27830,20 +27772,35 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27830
27772
|
}
|
|
27831
27773
|
});
|
|
27832
27774
|
});
|
|
27833
|
-
|
|
27775
|
+
setDraggingItem(null);
|
|
27776
|
+
// Reset tooltip visibility
|
|
27777
|
+
updateItemDetails({
|
|
27778
|
+
tooltip: {
|
|
27779
|
+
visible: false,
|
|
27780
|
+
mobileVisible: false
|
|
27781
|
+
}
|
|
27782
|
+
});
|
|
27783
|
+
}, [updateItemDetails, setDragState]);
|
|
27834
27784
|
var handleSuccessfulDrag = React.useCallback(function (quantity) {
|
|
27785
|
+
console.log('HANDLE_SUCCESSFUL_DRAG!');
|
|
27835
27786
|
resetDragState();
|
|
27836
27787
|
if (quantity !== -1 && item) {
|
|
27837
27788
|
onDragEnd == null ? void 0 : onDragEnd(quantity);
|
|
27838
27789
|
}
|
|
27839
27790
|
}, [item, onDragEnd, resetDragState]);
|
|
27840
27791
|
var onDraggableStart = React.useCallback(function () {
|
|
27792
|
+
console.log('ON_DRAGGABLE_START!');
|
|
27841
27793
|
if (!item || isSelectingShortcut) return;
|
|
27842
27794
|
if (onDragStart && containerType) {
|
|
27843
27795
|
onDragStart(item, slotIndex, containerType);
|
|
27844
27796
|
}
|
|
27797
|
+
if (!draggingItem && item) {
|
|
27798
|
+
console.log('!!! SETTING DRAGGING ITEM ', item._id);
|
|
27799
|
+
setDraggingItem(item);
|
|
27800
|
+
}
|
|
27845
27801
|
}, [item, isSelectingShortcut, onDragStart, containerType, slotIndex]);
|
|
27846
27802
|
var onDraggableProgress = React.useCallback(function (_e, data) {
|
|
27803
|
+
console.log('ON_DRAGGABLE_PROGRESS!');
|
|
27847
27804
|
var _dragState$position = dragState.position,
|
|
27848
27805
|
x = _dragState$position.x,
|
|
27849
27806
|
y = _dragState$position.y;
|
|
@@ -27855,14 +27812,9 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27855
27812
|
});
|
|
27856
27813
|
});
|
|
27857
27814
|
}
|
|
27858
|
-
|
|
27859
|
-
setDraggingItem(item);
|
|
27860
|
-
}
|
|
27861
|
-
}, [dragState.position, draggingItem, item, setDraggingItem]);
|
|
27815
|
+
}, [dragState.position, draggingItem, item, setDraggingItem, setDragState]);
|
|
27862
27816
|
var onDraggableStop = React.useCallback(function (e, data) {
|
|
27863
|
-
|
|
27864
|
-
setDraggingItem(null);
|
|
27865
|
-
}, 50);
|
|
27817
|
+
console.log('ON_DRAGGABLE_STOP!');
|
|
27866
27818
|
var target = e.target;
|
|
27867
27819
|
if (!target) return;
|
|
27868
27820
|
target.classList.remove('react-draggable-dragging');
|
|
@@ -27905,27 +27857,33 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27905
27857
|
}, 50);
|
|
27906
27858
|
} else if (item) {
|
|
27907
27859
|
var isTouch = e.type === 'touchend';
|
|
27908
|
-
|
|
27909
|
-
|
|
27910
|
-
|
|
27860
|
+
console.log("Debug: \n isTouch: " + isTouch + ",\n isSelectingShortcut: " + isSelectingShortcut + ",\n draggingItem: " + draggingItem + ",\n dragginState: " + JSON.stringify(dragState) + "\n ");
|
|
27861
|
+
if (!isContextMenuDisabled && isTouch && !isSelectingShortcut) {
|
|
27862
|
+
updateItemDetails({
|
|
27863
|
+
item: item,
|
|
27864
|
+
tooltip: {
|
|
27911
27865
|
mobileVisible: true
|
|
27912
|
-
}
|
|
27866
|
+
}
|
|
27913
27867
|
});
|
|
27914
27868
|
} else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
|
|
27869
|
+
var _itemDetails$contextM;
|
|
27915
27870
|
var event = e;
|
|
27916
|
-
|
|
27917
|
-
|
|
27918
|
-
|
|
27871
|
+
updateItemDetails({
|
|
27872
|
+
item: item,
|
|
27873
|
+
contextMenu: {
|
|
27874
|
+
visible: !(itemDetails != null && (_itemDetails$contextM = itemDetails.contextMenu) != null && _itemDetails$contextM.visible),
|
|
27919
27875
|
position: {
|
|
27920
27876
|
x: event.clientX - 10,
|
|
27921
27877
|
y: event.clientY - 5
|
|
27922
27878
|
}
|
|
27923
|
-
}
|
|
27879
|
+
}
|
|
27924
27880
|
});
|
|
27925
27881
|
}
|
|
27926
27882
|
onPointerDown == null ? void 0 : onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
27927
27883
|
}
|
|
27928
|
-
|
|
27884
|
+
console.log('setting draggingItem to null');
|
|
27885
|
+
setDraggingItem(null);
|
|
27886
|
+
}, [dragState.wasDragged, item, isSelectingShortcut, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, handleSuccessfulDrag, resetDragState, isContextMenuDisabled, onPointerDown, containerType, setItemShortcut]);
|
|
27929
27887
|
return {
|
|
27930
27888
|
dragContainer: dragContainer,
|
|
27931
27889
|
dragState: dragState,
|
|
@@ -28084,7 +28042,6 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28084
28042
|
_onMouseOver = _ref.onMouseOver,
|
|
28085
28043
|
onMouseOut = _ref.onMouseOut,
|
|
28086
28044
|
onPointerDown = _ref.onPointerDown,
|
|
28087
|
-
_onSelected = _ref.onSelected,
|
|
28088
28045
|
atlasJSON = _ref.atlasJSON,
|
|
28089
28046
|
atlasIMG = _ref.atlasIMG,
|
|
28090
28047
|
_ref$isContextMenuDis = _ref.isContextMenuDisabled,
|
|
@@ -28097,33 +28054,8 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28097
28054
|
openQuantitySelector = _ref.openQuantitySelector,
|
|
28098
28055
|
dragScale = _ref.dragScale,
|
|
28099
28056
|
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
28100
|
-
equipmentSet = _ref.equipmentSet,
|
|
28101
28057
|
setItemShortcut = _ref.setItemShortcut,
|
|
28102
28058
|
isDepotSystem = _ref.isDepotSystem;
|
|
28103
|
-
var _useState = React.useState({
|
|
28104
|
-
visible: false,
|
|
28105
|
-
mobileVisible: false
|
|
28106
|
-
}),
|
|
28107
|
-
tooltipState = _useState[0],
|
|
28108
|
-
setTooltipState = _useState[1];
|
|
28109
|
-
var _useState2 = React.useState({
|
|
28110
|
-
visible: false,
|
|
28111
|
-
position: {
|
|
28112
|
-
x: 0,
|
|
28113
|
-
y: 0
|
|
28114
|
-
}
|
|
28115
|
-
}),
|
|
28116
|
-
contextMenuState = _useState2[0],
|
|
28117
|
-
setContextMenuState = _useState2[1];
|
|
28118
|
-
var _useState3 = React.useState([]),
|
|
28119
|
-
contextActions = _useState3[0],
|
|
28120
|
-
setContextActions = _useState3[1];
|
|
28121
|
-
var isDraggingDisabled = React.useMemo(function () {
|
|
28122
|
-
return contextMenuState.visible || onDragStart === undefined || onDragEnd === undefined;
|
|
28123
|
-
}, [contextMenuState.visible, onDragStart, onDragEnd]);
|
|
28124
|
-
React.useEffect(function () {
|
|
28125
|
-
console.log('isDraggingDisabled', isDraggingDisabled);
|
|
28126
|
-
}, [isDraggingDisabled]);
|
|
28127
28059
|
var _useItemSlotDragAndDr = useItemSlotDragAndDrop({
|
|
28128
28060
|
isDepotSystem: !!isDepotSystem,
|
|
28129
28061
|
item: item,
|
|
@@ -28137,10 +28069,7 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28137
28069
|
containerType: containerType,
|
|
28138
28070
|
slotIndex: slotIndex,
|
|
28139
28071
|
openQuantitySelector: openQuantitySelector != null ? openQuantitySelector : function () {},
|
|
28140
|
-
isContextMenuDisabled: isContextMenuDisabled
|
|
28141
|
-
setTooltipState: setTooltipState,
|
|
28142
|
-
contextMenuState: contextMenuState,
|
|
28143
|
-
setContextMenuState: setContextMenuState
|
|
28072
|
+
isContextMenuDisabled: isContextMenuDisabled
|
|
28144
28073
|
}),
|
|
28145
28074
|
dragContainer = _useItemSlotDragAndDr.dragContainer,
|
|
28146
28075
|
dragState = _useItemSlotDragAndDr.dragState,
|
|
@@ -28149,17 +28078,28 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28149
28078
|
onDraggableStart = _useItemSlotDragAndDr.onDraggableStart,
|
|
28150
28079
|
onDraggableProgress = _useItemSlotDragAndDr.onDraggableProgress,
|
|
28151
28080
|
onDraggableStop = _useItemSlotDragAndDr.onDraggableStop;
|
|
28081
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
28082
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails,
|
|
28083
|
+
itemDetails = _useItemSlotTooltip.itemDetails;
|
|
28084
|
+
var _useCursorPosition = useCursorPosition({
|
|
28085
|
+
scale: dragScale
|
|
28086
|
+
}),
|
|
28087
|
+
cursorX = _useCursorPosition.x,
|
|
28088
|
+
cursorY = _useCursorPosition.y;
|
|
28152
28089
|
React.useEffect(function () {
|
|
28153
28090
|
if (item && containerType) {
|
|
28154
|
-
|
|
28091
|
+
updateItemDetails({
|
|
28092
|
+
item: item,
|
|
28093
|
+
contextMenu: {
|
|
28094
|
+
actions: generateContextMenu(item, containerType, isDepotSystem)
|
|
28095
|
+
}
|
|
28096
|
+
});
|
|
28155
28097
|
}
|
|
28156
28098
|
}, [item, isDepotSystem]);
|
|
28157
28099
|
var bounds = getContainerBounds();
|
|
28158
28100
|
var handleInteraction = React.useCallback(function (event) {
|
|
28159
28101
|
event.stopPropagation();
|
|
28160
|
-
|
|
28161
|
-
clientX = _ref2.clientX,
|
|
28162
|
-
clientY = _ref2.clientY;
|
|
28102
|
+
console.log('handleInteraction');
|
|
28163
28103
|
if (item && containerType) {
|
|
28164
28104
|
if (onPlaceDrop && draggingItem) {
|
|
28165
28105
|
onPlaceDrop(item, slotIndex, containerType);
|
|
@@ -28168,52 +28108,31 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28168
28108
|
onPointerDown(item.type, containerType, item);
|
|
28169
28109
|
}
|
|
28170
28110
|
}
|
|
28171
|
-
|
|
28172
|
-
|
|
28173
|
-
visible: true
|
|
28174
|
-
});
|
|
28175
|
-
});
|
|
28176
|
-
_onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, clientX, clientY);
|
|
28177
|
-
}, [item, containerType, slotIndex, onPlaceDrop, onPointerDown, _onMouseOver, onDragStart, onDragEnd]);
|
|
28111
|
+
_onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, cursorX, cursorY);
|
|
28112
|
+
}, [item, containerType, slotIndex, onPlaceDrop, onPointerDown, _onMouseOver, onDragStart, onDragEnd, cursorX, cursorY]);
|
|
28178
28113
|
var handleInteractionEnd = React.useCallback(function (event) {
|
|
28179
28114
|
event.preventDefault();
|
|
28180
28115
|
event.stopPropagation();
|
|
28181
|
-
|
|
28182
|
-
|
|
28183
|
-
visible: false
|
|
28184
|
-
});
|
|
28185
|
-
});
|
|
28116
|
+
console.log('handleInteractionEnd');
|
|
28117
|
+
console.log('itemDetails', itemDetails);
|
|
28186
28118
|
onMouseOut == null ? void 0 : onMouseOut();
|
|
28187
|
-
if (event.type === 'touchend'
|
|
28119
|
+
if (event.type === 'touchend') {
|
|
28188
28120
|
var _document$elementFrom;
|
|
28189
|
-
var _event$changedTouches = event.changedTouches[0],
|
|
28190
|
-
clientX = _event$changedTouches.clientX,
|
|
28191
|
-
clientY = _event$changedTouches.clientY;
|
|
28192
28121
|
var simulatedEvent = new MouseEvent('mouseup', {
|
|
28193
|
-
clientX:
|
|
28194
|
-
clientY:
|
|
28122
|
+
clientX: cursorX,
|
|
28123
|
+
clientY: cursorY,
|
|
28195
28124
|
bubbles: true
|
|
28196
28125
|
});
|
|
28197
|
-
(_document$elementFrom = document.elementFromPoint(
|
|
28198
|
-
|
|
28199
|
-
|
|
28200
|
-
|
|
28201
|
-
|
|
28202
|
-
|
|
28203
|
-
|
|
28204
|
-
React.useEffect(function () {
|
|
28205
|
-
if (tooltipState.visible && !isDraggingDisabled) {
|
|
28206
|
-
var timer = setTimeout(function () {
|
|
28207
|
-
return setShowTooltipDelayed(true);
|
|
28208
|
-
}, 50);
|
|
28209
|
-
return function () {
|
|
28210
|
-
return clearTimeout(timer);
|
|
28211
|
-
};
|
|
28212
|
-
} else {
|
|
28213
|
-
setShowTooltipDelayed(false);
|
|
28126
|
+
(_document$elementFrom = document.elementFromPoint(cursorX, cursorY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
|
|
28127
|
+
updateItemDetails({
|
|
28128
|
+
item: item,
|
|
28129
|
+
tooltip: {
|
|
28130
|
+
visible: false
|
|
28131
|
+
}
|
|
28132
|
+
});
|
|
28214
28133
|
}
|
|
28215
|
-
}, [
|
|
28216
|
-
return React__default.createElement(Container$
|
|
28134
|
+
}, [onMouseOut, cursorX, cursorY]);
|
|
28135
|
+
return React__default.createElement(Container$9, {
|
|
28217
28136
|
isDraggingItem: !!draggingItem,
|
|
28218
28137
|
item: item,
|
|
28219
28138
|
className: "rpgui-icon empty-slot",
|
|
@@ -28229,7 +28148,6 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28229
28148
|
},
|
|
28230
28149
|
onTouchEnd: function onTouchEnd(e) {
|
|
28231
28150
|
var _document$elementFrom2;
|
|
28232
|
-
handleInteractionEnd(e);
|
|
28233
28151
|
var _e$changedTouches$ = e.changedTouches[0],
|
|
28234
28152
|
clientX = _e$changedTouches$.clientX,
|
|
28235
28153
|
clientY = _e$changedTouches$.clientY;
|
|
@@ -28248,7 +28166,7 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28248
28166
|
axis: isSelectingShortcut ? 'none' : 'both',
|
|
28249
28167
|
defaultClassName: item ? 'draggable' : 'empty-slot',
|
|
28250
28168
|
scale: dragScale,
|
|
28251
|
-
disabled:
|
|
28169
|
+
disabled: onDragStart === undefined || onDragEnd === undefined,
|
|
28252
28170
|
onStop: onDraggableStop,
|
|
28253
28171
|
onStart: onDraggableStart,
|
|
28254
28172
|
onDrag: onDraggableProgress,
|
|
@@ -28258,26 +28176,25 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28258
28176
|
}, React__default.createElement(ItemContainer, {
|
|
28259
28177
|
ref: dragContainer,
|
|
28260
28178
|
isFocused: dragState.isFocused,
|
|
28261
|
-
onMouseOver: function onMouseOver(
|
|
28262
|
-
_onMouseOver == null ? void 0 : _onMouseOver(
|
|
28179
|
+
onMouseOver: function onMouseOver() {
|
|
28180
|
+
_onMouseOver == null ? void 0 : _onMouseOver({}, slotIndex, item, cursorX, cursorY);
|
|
28263
28181
|
},
|
|
28264
28182
|
onMouseOut: onMouseOut,
|
|
28265
28183
|
onMouseEnter: function onMouseEnter() {
|
|
28266
|
-
|
|
28267
|
-
|
|
28184
|
+
updateItemDetails({
|
|
28185
|
+
item: item,
|
|
28186
|
+
tooltip: {
|
|
28268
28187
|
visible: true
|
|
28269
|
-
}
|
|
28188
|
+
}
|
|
28270
28189
|
});
|
|
28271
28190
|
},
|
|
28272
|
-
onMouseLeave: function onMouseLeave(
|
|
28273
|
-
|
|
28274
|
-
|
|
28275
|
-
|
|
28276
|
-
|
|
28277
|
-
|
|
28278
|
-
|
|
28279
|
-
});
|
|
28280
|
-
}
|
|
28191
|
+
onMouseLeave: function onMouseLeave() {
|
|
28192
|
+
updateItemDetails({
|
|
28193
|
+
item: item,
|
|
28194
|
+
tooltip: {
|
|
28195
|
+
visible: false
|
|
28196
|
+
}
|
|
28197
|
+
});
|
|
28281
28198
|
}
|
|
28282
28199
|
}, React__default.createElement(ItemSlotRenderer, {
|
|
28283
28200
|
item: item,
|
|
@@ -28285,49 +28202,25 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
|
|
|
28285
28202
|
atlasIMG: atlasIMG,
|
|
28286
28203
|
atlasJSON: atlasJSON,
|
|
28287
28204
|
containerType: containerType
|
|
28288
|
-
})))
|
|
28289
|
-
tooltipState: tooltipState,
|
|
28290
|
-
setTooltipState: setTooltipState,
|
|
28291
|
-
contextMenuState: contextMenuState,
|
|
28292
|
-
setContextMenuState: setContextMenuState,
|
|
28293
|
-
isFocused: dragState.isFocused,
|
|
28294
|
-
isContextMenuDisabled: isContextMenuDisabled,
|
|
28295
|
-
item: item,
|
|
28296
|
-
contextActions: contextActions,
|
|
28297
|
-
dragScale: dragScale,
|
|
28298
|
-
onSelected: function onSelected(optionId, item) {
|
|
28299
|
-
setContextMenuState(function (prev) {
|
|
28300
|
-
return _extends({}, prev, {
|
|
28301
|
-
visible: false
|
|
28302
|
-
});
|
|
28303
|
-
});
|
|
28304
|
-
if (_onSelected) _onSelected(optionId, item);
|
|
28305
|
-
},
|
|
28306
|
-
atlasIMG: atlasIMG,
|
|
28307
|
-
atlasJSON: atlasJSON,
|
|
28308
|
-
equipmentSet: equipmentSet,
|
|
28309
|
-
isDragging: !!draggingItem,
|
|
28310
|
-
isSelectingShortcut: !!isSelectingShortcut,
|
|
28311
|
-
showTooltipDelayed: showTooltipDelayed
|
|
28312
|
-
}));
|
|
28205
|
+
}))));
|
|
28313
28206
|
}));
|
|
28314
|
-
var Container$
|
|
28207
|
+
var Container$9 = /*#__PURE__*/styled__default.div.withConfig({
|
|
28315
28208
|
displayName: "ItemSlot__Container",
|
|
28316
28209
|
componentId: "sc-l2j5ef-0"
|
|
28317
|
-
})(["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 (
|
|
28318
|
-
var isDraggingItem =
|
|
28210
|
+
})(["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) {
|
|
28211
|
+
var isDraggingItem = _ref2.isDraggingItem;
|
|
28319
28212
|
return isDraggingItem ? 0 : 1;
|
|
28213
|
+
}, function (_ref3) {
|
|
28214
|
+
var item = _ref3.item;
|
|
28215
|
+
return rarityColor(item);
|
|
28320
28216
|
}, function (_ref4) {
|
|
28321
28217
|
var item = _ref4.item;
|
|
28322
|
-
return rarityColor(item);
|
|
28218
|
+
return "0 0 5px 2px " + rarityColor(item);
|
|
28323
28219
|
}, function (_ref5) {
|
|
28324
28220
|
var item = _ref5.item;
|
|
28325
|
-
return "0 0 5px 2px " + rarityColor(item);
|
|
28326
|
-
}, function (_ref6) {
|
|
28327
|
-
var item = _ref6.item;
|
|
28328
28221
|
return "0 0 4px 3px " + rarityColor(item);
|
|
28329
|
-
}, function (
|
|
28330
|
-
var isSelectingShortcut =
|
|
28222
|
+
}, function (_ref6) {
|
|
28223
|
+
var isSelectingShortcut = _ref6.isSelectingShortcut;
|
|
28331
28224
|
return isSelectingShortcut ? 'bg-color-change 1s infinite' : 'none';
|
|
28332
28225
|
});
|
|
28333
28226
|
var ItemContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
@@ -28427,7 +28320,7 @@ var ItemInfo = function ItemInfo(_ref) {
|
|
|
28427
28320
|
});
|
|
28428
28321
|
};
|
|
28429
28322
|
var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
|
|
28430
|
-
return React__default.createElement(Container$
|
|
28323
|
+
return React__default.createElement(Container$a, {
|
|
28431
28324
|
item: item
|
|
28432
28325
|
}, React__default.createElement(Header, null, React__default.createElement("div", null, React__default.createElement(Title$1, null, item.name), item.rarity !== 'Common' && React__default.createElement(Rarity, {
|
|
28433
28326
|
item: item
|
|
@@ -28441,7 +28334,7 @@ var ItemInfo = function ItemInfo(_ref) {
|
|
|
28441
28334
|
"$isSpecial": true
|
|
28442
28335
|
}, "Two handed"), React__default.createElement(Description, null, item.description), item.maxStackSize && item.maxStackSize !== 1 && React__default.createElement(StackInfo, null, "x", Math.round(((_item$stackQty = item.stackQty) != null ? _item$stackQty : 1) * 100) / 100, "(", item.maxStackSize, ")"), renderMissingStatistic().length > 0 && React__default.createElement(MissingStatistics, null, React__default.createElement(Statistic, null, "Equipped Diff"), itemToCompare && renderMissingStatistic()));
|
|
28443
28336
|
};
|
|
28444
|
-
var Container$
|
|
28337
|
+
var Container$a = /*#__PURE__*/styled__default.div.withConfig({
|
|
28445
28338
|
displayName: "ItemInfo__Container",
|
|
28446
28339
|
componentId: "sc-1xm4q8k-0"
|
|
28447
28340
|
})(["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) {
|
|
@@ -28587,7 +28480,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
|
|
|
28587
28480
|
}
|
|
28588
28481
|
return;
|
|
28589
28482
|
}, []);
|
|
28590
|
-
return React__default.createElement(ModalPortal, null, React__default.createElement(Container$
|
|
28483
|
+
return React__default.createElement(ModalPortal, null, React__default.createElement(Container$b, {
|
|
28591
28484
|
ref: ref
|
|
28592
28485
|
}, React__default.createElement(ItemInfoDisplay, {
|
|
28593
28486
|
item: item,
|
|
@@ -28596,11 +28489,67 @@ var ItemTooltip = function ItemTooltip(_ref) {
|
|
|
28596
28489
|
equipmentSet: equipmentSet
|
|
28597
28490
|
})));
|
|
28598
28491
|
};
|
|
28599
|
-
var Container$
|
|
28492
|
+
var Container$b = /*#__PURE__*/styled__default.div.withConfig({
|
|
28600
28493
|
displayName: "ItemTooltip__Container",
|
|
28601
28494
|
componentId: "sc-11d9r7x-0"
|
|
28602
28495
|
})(["position:absolute;z-index:100;pointer-events:none;left:0;top:0;opacity:0;transition:opacity 0.08s;"]);
|
|
28603
28496
|
|
|
28497
|
+
var MobileItemTooltip = function MobileItemTooltip(_ref) {
|
|
28498
|
+
var item = _ref.item,
|
|
28499
|
+
atlasIMG = _ref.atlasIMG,
|
|
28500
|
+
atlasJSON = _ref.atlasJSON,
|
|
28501
|
+
closeTooltip = _ref.closeTooltip,
|
|
28502
|
+
equipmentSet = _ref.equipmentSet,
|
|
28503
|
+
_ref$scale = _ref.scale,
|
|
28504
|
+
scale = _ref$scale === void 0 ? 1 : _ref$scale,
|
|
28505
|
+
options = _ref.options,
|
|
28506
|
+
onSelected = _ref.onSelected;
|
|
28507
|
+
var ref = React.useRef(null);
|
|
28508
|
+
var handleFadeOut = function handleFadeOut() {
|
|
28509
|
+
var _ref$current;
|
|
28510
|
+
(_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
|
|
28511
|
+
};
|
|
28512
|
+
return React__default.createElement(ModalPortal, null, React__default.createElement(Container$c, {
|
|
28513
|
+
ref: ref,
|
|
28514
|
+
onTouchEnd: function onTouchEnd() {
|
|
28515
|
+
handleFadeOut();
|
|
28516
|
+
setTimeout(function () {
|
|
28517
|
+
closeTooltip();
|
|
28518
|
+
}, 100);
|
|
28519
|
+
},
|
|
28520
|
+
scale: scale
|
|
28521
|
+
}, React__default.createElement(ItemInfoDisplay, {
|
|
28522
|
+
item: item,
|
|
28523
|
+
atlasIMG: atlasIMG,
|
|
28524
|
+
atlasJSON: atlasJSON,
|
|
28525
|
+
equipmentSet: equipmentSet,
|
|
28526
|
+
isMobile: true
|
|
28527
|
+
}), React__default.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
|
|
28528
|
+
return React__default.createElement(Option, {
|
|
28529
|
+
key: option.id,
|
|
28530
|
+
onTouchEnd: function onTouchEnd() {
|
|
28531
|
+
handleFadeOut();
|
|
28532
|
+
setTimeout(function () {
|
|
28533
|
+
onSelected == null ? void 0 : onSelected(option.id);
|
|
28534
|
+
closeTooltip();
|
|
28535
|
+
}, 100);
|
|
28536
|
+
}
|
|
28537
|
+
}, option.text);
|
|
28538
|
+
}))));
|
|
28539
|
+
};
|
|
28540
|
+
var Container$c = /*#__PURE__*/styled__default.div.withConfig({
|
|
28541
|
+
displayName: "MobileItemTooltip__Container",
|
|
28542
|
+
componentId: "sc-ku4p1j-0"
|
|
28543
|
+
})(["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;}"]);
|
|
28544
|
+
var OptionsContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
28545
|
+
displayName: "MobileItemTooltip__OptionsContainer",
|
|
28546
|
+
componentId: "sc-ku4p1j-1"
|
|
28547
|
+
})(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
|
|
28548
|
+
var Option = /*#__PURE__*/styled__default.button.withConfig({
|
|
28549
|
+
displayName: "MobileItemTooltip__Option",
|
|
28550
|
+
componentId: "sc-ku4p1j-2"
|
|
28551
|
+
})(["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;}"]);
|
|
28552
|
+
|
|
28604
28553
|
var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
|
|
28605
28554
|
var children = _ref.children,
|
|
28606
28555
|
atlasIMG = _ref.atlasIMG,
|
|
@@ -28955,7 +28904,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
28955
28904
|
onChange(selectedValue);
|
|
28956
28905
|
}
|
|
28957
28906
|
}, [selectedValue]);
|
|
28958
|
-
return React__default.createElement(Container$
|
|
28907
|
+
return React__default.createElement(Container$d, {
|
|
28959
28908
|
onMouseLeave: function onMouseLeave() {
|
|
28960
28909
|
return setOpened(false);
|
|
28961
28910
|
},
|
|
@@ -28983,7 +28932,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
28983
28932
|
}, option.option);
|
|
28984
28933
|
})));
|
|
28985
28934
|
};
|
|
28986
|
-
var Container$
|
|
28935
|
+
var Container$d = /*#__PURE__*/styled__default.div.withConfig({
|
|
28987
28936
|
displayName: "Dropdown__Container",
|
|
28988
28937
|
componentId: "sc-8arn65-0"
|
|
28989
28938
|
})(["position:relative;width:", ";"], function (props) {
|
|
@@ -29025,57 +28974,6 @@ var Details = /*#__PURE__*/styled__default.p.withConfig({
|
|
|
29025
28974
|
componentId: "sc-kaa0h9-0"
|
|
29026
28975
|
})(["font-size:", " !important;"], uiFonts.size.xsmall);
|
|
29027
28976
|
|
|
29028
|
-
var useCursorPosition = function useCursorPosition(_ref) {
|
|
29029
|
-
var _ref$scale = _ref.scale,
|
|
29030
|
-
scale = _ref$scale === void 0 ? 1 : _ref$scale;
|
|
29031
|
-
var _useState = React.useState({
|
|
29032
|
-
x: 0,
|
|
29033
|
-
y: 0
|
|
29034
|
-
}),
|
|
29035
|
-
position = _useState[0],
|
|
29036
|
-
setPosition = _useState[1];
|
|
29037
|
-
var scalePosition = React.useCallback(function (x, y) {
|
|
29038
|
-
return {
|
|
29039
|
-
x: (x - shared.GRID_WIDTH / 2) / scale + shared.GRID_WIDTH / 2,
|
|
29040
|
-
y: (y - shared.GRID_HEIGHT / 2) / scale + shared.GRID_HEIGHT / 2
|
|
29041
|
-
};
|
|
29042
|
-
}, [scale]);
|
|
29043
|
-
var setFromEvent = React.useCallback(function (e) {
|
|
29044
|
-
var x, y;
|
|
29045
|
-
if ('touches' in e) {
|
|
29046
|
-
x = e.touches[0].clientX;
|
|
29047
|
-
y = e.touches[0].clientY;
|
|
29048
|
-
} else {
|
|
29049
|
-
x = e.clientX;
|
|
29050
|
-
y = e.clientY;
|
|
29051
|
-
}
|
|
29052
|
-
var scaledPosition = scalePosition(x, y);
|
|
29053
|
-
setPosition(scaledPosition);
|
|
29054
|
-
}, [scale, scalePosition]);
|
|
29055
|
-
var cleanup = React.useCallback(function () {
|
|
29056
|
-
setPosition({
|
|
29057
|
-
x: 0,
|
|
29058
|
-
y: 0
|
|
29059
|
-
});
|
|
29060
|
-
}, []);
|
|
29061
|
-
React.useEffect(function () {
|
|
29062
|
-
var handleEvent = function handleEvent(e) {
|
|
29063
|
-
return setFromEvent(e);
|
|
29064
|
-
};
|
|
29065
|
-
window.addEventListener('mousemove', handleEvent);
|
|
29066
|
-
window.addEventListener('touchmove', handleEvent);
|
|
29067
|
-
window.addEventListener('mouseup', cleanup);
|
|
29068
|
-
window.addEventListener('touchend', cleanup);
|
|
29069
|
-
return function () {
|
|
29070
|
-
window.removeEventListener('mousemove', handleEvent);
|
|
29071
|
-
window.removeEventListener('touchmove', handleEvent);
|
|
29072
|
-
window.removeEventListener('mouseup', cleanup);
|
|
29073
|
-
window.removeEventListener('touchend', cleanup);
|
|
29074
|
-
};
|
|
29075
|
-
}, [setFromEvent, cleanup]);
|
|
29076
|
-
return position;
|
|
29077
|
-
};
|
|
29078
|
-
|
|
29079
28977
|
var CONTAINER_SIZE = 32;
|
|
29080
28978
|
var OFFSET = CONTAINER_SIZE / 2;
|
|
29081
28979
|
var DraggedItem = function DraggedItem(_ref) {
|
|
@@ -29083,8 +28981,8 @@ var DraggedItem = function DraggedItem(_ref) {
|
|
|
29083
28981
|
var atlasJSON = _ref.atlasJSON,
|
|
29084
28982
|
atlasIMG = _ref.atlasIMG,
|
|
29085
28983
|
scale = _ref.scale;
|
|
29086
|
-
var
|
|
29087
|
-
item =
|
|
28984
|
+
var _useItemSlotDragging = useItemSlotDragging(),
|
|
28985
|
+
item = _useItemSlotDragging.item;
|
|
29088
28986
|
var _useCursorPosition = useCursorPosition({
|
|
29089
28987
|
scale: scale
|
|
29090
28988
|
}),
|
|
@@ -29099,7 +28997,7 @@ var DraggedItem = function DraggedItem(_ref) {
|
|
|
29099
28997
|
var centeredX = x - OFFSET;
|
|
29100
28998
|
var centeredY = y - OFFSET;
|
|
29101
28999
|
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);
|
|
29102
|
-
return React__default.createElement(Container$
|
|
29000
|
+
return React__default.createElement(Container$e, null, React__default.createElement(SpriteContainer, {
|
|
29103
29001
|
x: centeredX,
|
|
29104
29002
|
y: centeredY
|
|
29105
29003
|
}, React__default.createElement(SpriteFromAtlas, {
|
|
@@ -29117,7 +29015,7 @@ var DraggedItem = function DraggedItem(_ref) {
|
|
|
29117
29015
|
}), stackInfo));
|
|
29118
29016
|
};
|
|
29119
29017
|
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";
|
|
29120
|
-
var Container$
|
|
29018
|
+
var Container$e = /*#__PURE__*/styled__default.div.withConfig({
|
|
29121
29019
|
displayName: "DraggedItem__Container",
|
|
29122
29020
|
componentId: "sc-mlzzcp-0"
|
|
29123
29021
|
})(["position:relative;"]);
|
|
@@ -29133,11 +29031,127 @@ var SpriteContainer = /*#__PURE__*/styled__default.div.attrs(function (props) {
|
|
|
29133
29031
|
componentId: "sc-mlzzcp-1"
|
|
29134
29032
|
})(["", " 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);
|
|
29135
29033
|
|
|
29034
|
+
var RelativeListMenu = function RelativeListMenu(_ref) {
|
|
29035
|
+
var options = _ref.options,
|
|
29036
|
+
onSelected = _ref.onSelected,
|
|
29037
|
+
onOutsideClick = _ref.onOutsideClick,
|
|
29038
|
+
_ref$fontSize = _ref.fontSize,
|
|
29039
|
+
fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
|
|
29040
|
+
pos = _ref.pos;
|
|
29041
|
+
var ref = React.useRef(null);
|
|
29042
|
+
useOutsideClick(ref, 'relative-context-menu');
|
|
29043
|
+
React.useEffect(function () {
|
|
29044
|
+
document.addEventListener('clickOutside', function (event) {
|
|
29045
|
+
var e = event;
|
|
29046
|
+
if (e.detail.id === 'relative-context-menu') {
|
|
29047
|
+
if (onOutsideClick) {
|
|
29048
|
+
onOutsideClick();
|
|
29049
|
+
}
|
|
29050
|
+
}
|
|
29051
|
+
});
|
|
29052
|
+
return function () {
|
|
29053
|
+
document.removeEventListener('clickOutside', function (_e) {});
|
|
29054
|
+
};
|
|
29055
|
+
}, []);
|
|
29056
|
+
return React__default.createElement(ModalPortal, null, React__default.createElement(Container$f, Object.assign({
|
|
29057
|
+
fontSize: fontSize,
|
|
29058
|
+
ref: ref
|
|
29059
|
+
}, pos), React__default.createElement("ul", {
|
|
29060
|
+
className: "rpgui-list-imp",
|
|
29061
|
+
style: {
|
|
29062
|
+
overflow: 'hidden'
|
|
29063
|
+
}
|
|
29064
|
+
}, options.map(function (params, index) {
|
|
29065
|
+
return React__default.createElement(ListElement$2, {
|
|
29066
|
+
key: (params == null ? void 0 : params.id) || index,
|
|
29067
|
+
onPointerDown: function onPointerDown() {
|
|
29068
|
+
onSelected(params == null ? void 0 : params.id);
|
|
29069
|
+
}
|
|
29070
|
+
}, (params == null ? void 0 : params.text) || 'No text');
|
|
29071
|
+
}))));
|
|
29072
|
+
};
|
|
29073
|
+
var Container$f = /*#__PURE__*/styled__default.div.withConfig({
|
|
29074
|
+
displayName: "RelativeListMenu__Container",
|
|
29075
|
+
componentId: "sc-7hohf-0"
|
|
29076
|
+
})(["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) {
|
|
29077
|
+
return props.y;
|
|
29078
|
+
}, function (props) {
|
|
29079
|
+
return props.x;
|
|
29080
|
+
}, function (props) {
|
|
29081
|
+
return props.fontSize;
|
|
29082
|
+
});
|
|
29083
|
+
var ListElement$2 = /*#__PURE__*/styled__default.li.withConfig({
|
|
29084
|
+
displayName: "RelativeListMenu__ListElement",
|
|
29085
|
+
componentId: "sc-7hohf-1"
|
|
29086
|
+
})(["margin-right:0.5rem;"]);
|
|
29087
|
+
|
|
29088
|
+
var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
|
|
29089
|
+
var _itemDetails$tooltip, _itemDetails$tooltip2, _itemDetails$contextM, _itemDetails$contextM2;
|
|
29090
|
+
var isFocused = _ref.isFocused,
|
|
29091
|
+
isContextMenuDisabled = _ref.isContextMenuDisabled,
|
|
29092
|
+
dragScale = _ref.dragScale,
|
|
29093
|
+
onSelected = _ref.onSelected,
|
|
29094
|
+
atlasIMG = _ref.atlasIMG,
|
|
29095
|
+
atlasJSON = _ref.atlasJSON,
|
|
29096
|
+
equipmentSet = _ref.equipmentSet;
|
|
29097
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
29098
|
+
itemDetails = _useItemSlotTooltip.itemDetails,
|
|
29099
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails;
|
|
29100
|
+
var item = itemDetails.item;
|
|
29101
|
+
var handleCloseTooltip = function handleCloseTooltip() {
|
|
29102
|
+
updateItemDetails({
|
|
29103
|
+
item: item,
|
|
29104
|
+
tooltip: {
|
|
29105
|
+
mobileVisible: false
|
|
29106
|
+
}
|
|
29107
|
+
});
|
|
29108
|
+
};
|
|
29109
|
+
var handleContextMenuSelect = function handleContextMenuSelect(optionId) {
|
|
29110
|
+
updateItemDetails({
|
|
29111
|
+
item: item,
|
|
29112
|
+
contextMenu: {
|
|
29113
|
+
visible: false
|
|
29114
|
+
}
|
|
29115
|
+
});
|
|
29116
|
+
if (item) {
|
|
29117
|
+
onSelected == null ? void 0 : onSelected(optionId, item);
|
|
29118
|
+
}
|
|
29119
|
+
};
|
|
29120
|
+
var handleOutsideClick = function handleOutsideClick() {
|
|
29121
|
+
updateItemDetails({
|
|
29122
|
+
item: item,
|
|
29123
|
+
contextMenu: {
|
|
29124
|
+
visible: false
|
|
29125
|
+
}
|
|
29126
|
+
});
|
|
29127
|
+
};
|
|
29128
|
+
// monitor why mobileVisible is not working
|
|
29129
|
+
return React__default.createElement(React__default.Fragment, null, ((_itemDetails$tooltip = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip.visible) && item && !isFocused && React__default.createElement(ItemTooltip, {
|
|
29130
|
+
item: item,
|
|
29131
|
+
atlasIMG: atlasIMG,
|
|
29132
|
+
atlasJSON: atlasJSON,
|
|
29133
|
+
equipmentSet: equipmentSet
|
|
29134
|
+
}), ((_itemDetails$tooltip2 = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip2.mobileVisible) && item && React__default.createElement(MobileItemTooltip, {
|
|
29135
|
+
item: item,
|
|
29136
|
+
atlasIMG: atlasIMG,
|
|
29137
|
+
atlasJSON: atlasJSON,
|
|
29138
|
+
equipmentSet: equipmentSet,
|
|
29139
|
+
closeTooltip: handleCloseTooltip,
|
|
29140
|
+
scale: dragScale,
|
|
29141
|
+
options: ((_itemDetails$contextM = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM.actions) || [],
|
|
29142
|
+
onSelected: handleContextMenuSelect
|
|
29143
|
+
}), !isContextMenuDisabled && ((_itemDetails$contextM2 = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM2.visible) && itemDetails.contextMenu.actions && React__default.createElement(RelativeListMenu, {
|
|
29144
|
+
options: itemDetails.contextMenu.actions,
|
|
29145
|
+
onSelected: handleContextMenuSelect,
|
|
29146
|
+
onOutsideClick: handleOutsideClick,
|
|
29147
|
+
pos: itemDetails.contextMenu.position
|
|
29148
|
+
}));
|
|
29149
|
+
};
|
|
29150
|
+
|
|
29136
29151
|
var EquipmentSet = function EquipmentSet(_ref) {
|
|
29137
29152
|
var equipmentSet = _ref.equipmentSet,
|
|
29138
29153
|
onClose = _ref.onClose,
|
|
29139
29154
|
_onMouseOver = _ref.onMouseOver,
|
|
29140
|
-
_onSelected = _ref.onSelected,
|
|
29141
29155
|
onItemClick = _ref.onItemClick,
|
|
29142
29156
|
atlasIMG = _ref.atlasIMG,
|
|
29143
29157
|
atlasJSON = _ref.atlasJSON,
|
|
@@ -29146,11 +29160,11 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29146
29160
|
onItemPlaceDrop = _ref.onItemPlaceDrop,
|
|
29147
29161
|
onItemOutsideDrop = _ref.onItemOutsideDrop,
|
|
29148
29162
|
checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
|
|
29149
|
-
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
29150
29163
|
scale = _ref.scale,
|
|
29151
29164
|
initialPosition = _ref.initialPosition,
|
|
29152
29165
|
onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
29153
|
-
onPositionChangeStart = _ref.onPositionChangeStart
|
|
29166
|
+
onPositionChangeStart = _ref.onPositionChangeStart,
|
|
29167
|
+
_onSelected = _ref.onSelected;
|
|
29154
29168
|
var neck = equipmentSet.neck,
|
|
29155
29169
|
leftHand = equipmentSet.leftHand,
|
|
29156
29170
|
ring = equipmentSet.ring,
|
|
@@ -29163,6 +29177,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29163
29177
|
accessory = equipmentSet.accessory;
|
|
29164
29178
|
var equipmentData = [neck, leftHand, ring, head, armor, legs, boot, inventory, rightHand, accessory];
|
|
29165
29179
|
var equipmentMaskSlots = [shared.ItemSlotType.Neck, shared.ItemSlotType.LeftHand, shared.ItemSlotType.Ring, shared.ItemSlotType.Head, shared.ItemSlotType.Torso, shared.ItemSlotType.Legs, shared.ItemSlotType.Feet, shared.ItemSlotType.Inventory, shared.ItemSlotType.RightHand, shared.ItemSlotType.Accessory];
|
|
29180
|
+
var _useItemSlotDragging = useItemSlotDragging(),
|
|
29181
|
+
dragState = _useItemSlotDragging.dragState;
|
|
29182
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
29183
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails;
|
|
29166
29184
|
var onRenderEquipmentSlotRange = function onRenderEquipmentSlotRange(start, end) {
|
|
29167
29185
|
var equipmentRange = equipmentData.slice(start, end);
|
|
29168
29186
|
var slotMaksRange = equipmentMaskSlots.slice(start, end);
|
|
@@ -29183,9 +29201,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29183
29201
|
onPointerDown: function onPointerDown(itemType, ContainerType) {
|
|
29184
29202
|
if (onItemClick) onItemClick(itemType, item, ContainerType);
|
|
29185
29203
|
},
|
|
29186
|
-
onSelected: function onSelected(optionId) {
|
|
29187
|
-
if (_onSelected) _onSelected(optionId);
|
|
29188
|
-
},
|
|
29189
29204
|
onDragStart: function onDragStart(item, slotIndex, itemContainerType) {
|
|
29190
29205
|
if (!item) {
|
|
29191
29206
|
return;
|
|
@@ -29197,7 +29212,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29197
29212
|
},
|
|
29198
29213
|
dragScale: scale,
|
|
29199
29214
|
checkIfItemCanBeMoved: checkIfItemCanBeMoved,
|
|
29200
|
-
checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
|
|
29201
29215
|
onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
|
|
29202
29216
|
if (onItemPlaceDrop) onItemPlaceDrop(item, slotIndex, itemContainerType);
|
|
29203
29217
|
},
|
|
@@ -29209,7 +29223,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29209
29223
|
});
|
|
29210
29224
|
});
|
|
29211
29225
|
};
|
|
29212
|
-
return React__default.createElement(
|
|
29226
|
+
return React__default.createElement(ItemSlotDraggingProvider, null, React__default.createElement(ItemSlotTooltipProvider, null, React__default.createElement(DraggedItem, {
|
|
29213
29227
|
atlasIMG: atlasIMG,
|
|
29214
29228
|
atlasJSON: atlasJSON,
|
|
29215
29229
|
scale: scale
|
|
@@ -29227,7 +29241,23 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29227
29241
|
onPositionChangeStart: onPositionChangeStart
|
|
29228
29242
|
}, React__default.createElement(EquipmentSetContainer, {
|
|
29229
29243
|
className: "equipment-container-body"
|
|
29230
|
-
}, React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10))))
|
|
29244
|
+
}, React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10)))), React__default.createElement(ItemSlotToolTips, {
|
|
29245
|
+
isFocused: dragState.isFocused,
|
|
29246
|
+
isContextMenuDisabled: shared.isMobile(),
|
|
29247
|
+
dragScale: scale,
|
|
29248
|
+
onSelected: function onSelected(optionId, item) {
|
|
29249
|
+
updateItemDetails({
|
|
29250
|
+
item: item,
|
|
29251
|
+
contextMenu: {
|
|
29252
|
+
visible: false
|
|
29253
|
+
}
|
|
29254
|
+
});
|
|
29255
|
+
if (_onSelected) _onSelected(optionId);
|
|
29256
|
+
},
|
|
29257
|
+
atlasIMG: atlasIMG,
|
|
29258
|
+
atlasJSON: atlasJSON,
|
|
29259
|
+
equipmentSet: equipmentSet
|
|
29260
|
+
})));
|
|
29231
29261
|
};
|
|
29232
29262
|
var EquipmentSetContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
29233
29263
|
displayName: "EquipmentSet__EquipmentSetContainer",
|
|
@@ -30705,14 +30735,12 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30705
30735
|
document.removeEventListener('pointermove', handleMouseMove);
|
|
30706
30736
|
}, [handleMouseMove, onItemDragStart, stopScrolling]);
|
|
30707
30737
|
var onDragStart = function onDragStart(item, slotIndex, itemContainerType) {
|
|
30708
|
-
console.log('DRAG START');
|
|
30709
30738
|
if (onItemDragStart) {
|
|
30710
30739
|
onItemDragStart(item, slotIndex, itemContainerType);
|
|
30711
30740
|
}
|
|
30712
30741
|
onDragStartScrollingEvents();
|
|
30713
30742
|
};
|
|
30714
30743
|
var onDragEnd = function onDragEnd(quantity) {
|
|
30715
|
-
console.log('DRAG END');
|
|
30716
30744
|
if (onItemDragEnd) {
|
|
30717
30745
|
onItemDragEnd(quantity);
|
|
30718
30746
|
}
|
|
@@ -30739,9 +30767,6 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30739
30767
|
onItemClick(item, itemType, containerType);
|
|
30740
30768
|
}
|
|
30741
30769
|
},
|
|
30742
|
-
onSelected: function onSelected(optionId, item) {
|
|
30743
|
-
if (_onSelected) _onSelected(optionId, item);
|
|
30744
|
-
},
|
|
30745
30770
|
onDragStart: onDragStart,
|
|
30746
30771
|
onDragEnd: onDragEnd,
|
|
30747
30772
|
dragScale: scale,
|
|
@@ -30770,14 +30795,17 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30770
30795
|
atlasIMG: atlasIMG,
|
|
30771
30796
|
atlasJSON: atlasJSON,
|
|
30772
30797
|
isSelectingShortcut: settingShortcutIndex !== -1,
|
|
30773
|
-
equipmentSet: equipmentSet,
|
|
30774
30798
|
setItemShortcut: type === shared.ItemContainerType.Inventory ? handleSetShortcut : undefined,
|
|
30775
30799
|
isDepotSystem: isDepotSystem
|
|
30776
30800
|
}));
|
|
30777
30801
|
}
|
|
30778
30802
|
return slots;
|
|
30779
30803
|
};
|
|
30780
|
-
|
|
30804
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
30805
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails;
|
|
30806
|
+
var _useItemSlotDragging = useItemSlotDragging(),
|
|
30807
|
+
dragState = _useItemSlotDragging.dragState;
|
|
30808
|
+
return React__default.createElement(ItemSlotDraggingProvider, null, React__default.createElement(ItemSlotTooltipProvider, null, React__default.createElement(DraggedItem, {
|
|
30781
30809
|
atlasIMG: atlasIMG,
|
|
30782
30810
|
atlasJSON: atlasJSON,
|
|
30783
30811
|
scale: scale
|
|
@@ -30802,10 +30830,26 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30802
30830
|
ref: containerRef,
|
|
30803
30831
|
isScrollable: itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL,
|
|
30804
30832
|
isFullScreen: isFullScreen
|
|
30805
|
-
}, onRenderSlots())),
|
|
30833
|
+
}, onRenderSlots())), React__default.createElement(ItemSlotToolTips, {
|
|
30834
|
+
isFocused: dragState.isFocused,
|
|
30835
|
+
isContextMenuDisabled: disableContextMenu,
|
|
30836
|
+
dragScale: scale,
|
|
30837
|
+
onSelected: function onSelected(optionId, item) {
|
|
30838
|
+
updateItemDetails({
|
|
30839
|
+
item: item,
|
|
30840
|
+
contextMenu: {
|
|
30841
|
+
visible: false
|
|
30842
|
+
}
|
|
30843
|
+
});
|
|
30844
|
+
if (_onSelected) _onSelected(optionId, item);
|
|
30845
|
+
},
|
|
30846
|
+
atlasIMG: atlasIMG,
|
|
30847
|
+
atlasJSON: atlasJSON,
|
|
30848
|
+
equipmentSet: equipmentSet
|
|
30849
|
+
}), quantitySelect.isOpen && React__default.createElement(ItemQuantitySelectorModal, {
|
|
30806
30850
|
quantitySelect: quantitySelect,
|
|
30807
30851
|
setQuantitySelect: setQuantitySelect
|
|
30808
|
-
}));
|
|
30852
|
+
})));
|
|
30809
30853
|
};
|
|
30810
30854
|
var ItemsContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
30811
30855
|
displayName: "ItemContainer__ItemsContainer",
|