@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
package/dist/long-bow.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { useState, useEffect, Component, useRef, useContext, createContext,
|
|
1
|
+
import React, { useState, useEffect, Component, useRef, useCallback, useContext, createContext, useMemo, Fragment } from 'react';
|
|
2
2
|
import styled, { css, keyframes } from 'styled-components';
|
|
3
3
|
import { BeatLoader } from 'react-spinners';
|
|
4
4
|
import { v4 } from 'uuid';
|
|
5
|
-
import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarities, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSubType, ItemSlotType, isMobileOrTablet, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, PeriodOfDay, UserAccountTypes } from '@rpg-engine/shared';
|
|
5
|
+
import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarities, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSubType, isMobile, ItemSlotType, isMobileOrTablet, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, PeriodOfDay, UserAccountTypes } from '@rpg-engine/shared';
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
7
|
import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
|
|
8
8
|
import { FaTimes } from 'react-icons/fa';
|
|
@@ -27371,6 +27371,57 @@ var Container$8 = /*#__PURE__*/styled.div.withConfig({
|
|
|
27371
27371
|
componentId: "sc-dgmp04-0"
|
|
27372
27372
|
})(["position:static !important;"]);
|
|
27373
27373
|
|
|
27374
|
+
var useCursorPosition = function useCursorPosition(_ref) {
|
|
27375
|
+
var _ref$scale = _ref.scale,
|
|
27376
|
+
scale = _ref$scale === void 0 ? 1 : _ref$scale;
|
|
27377
|
+
var _useState = useState({
|
|
27378
|
+
x: 0,
|
|
27379
|
+
y: 0
|
|
27380
|
+
}),
|
|
27381
|
+
position = _useState[0],
|
|
27382
|
+
setPosition = _useState[1];
|
|
27383
|
+
var scalePosition = useCallback(function (x, y) {
|
|
27384
|
+
return {
|
|
27385
|
+
x: (x - GRID_WIDTH / 2) / scale + GRID_WIDTH / 2,
|
|
27386
|
+
y: (y - GRID_HEIGHT / 2) / scale + GRID_HEIGHT / 2
|
|
27387
|
+
};
|
|
27388
|
+
}, [scale]);
|
|
27389
|
+
var setFromEvent = useCallback(function (e) {
|
|
27390
|
+
var x, y;
|
|
27391
|
+
if ('touches' in e) {
|
|
27392
|
+
x = e.touches[0].clientX;
|
|
27393
|
+
y = e.touches[0].clientY;
|
|
27394
|
+
} else {
|
|
27395
|
+
x = e.clientX;
|
|
27396
|
+
y = e.clientY;
|
|
27397
|
+
}
|
|
27398
|
+
var scaledPosition = scalePosition(x, y);
|
|
27399
|
+
setPosition(scaledPosition);
|
|
27400
|
+
}, [scale, scalePosition]);
|
|
27401
|
+
var cleanup = useCallback(function () {
|
|
27402
|
+
setPosition({
|
|
27403
|
+
x: 0,
|
|
27404
|
+
y: 0
|
|
27405
|
+
});
|
|
27406
|
+
}, []);
|
|
27407
|
+
useEffect(function () {
|
|
27408
|
+
var handleEvent = function handleEvent(e) {
|
|
27409
|
+
return setFromEvent(e);
|
|
27410
|
+
};
|
|
27411
|
+
window.addEventListener('mousemove', handleEvent);
|
|
27412
|
+
window.addEventListener('touchmove', handleEvent);
|
|
27413
|
+
window.addEventListener('mouseup', cleanup);
|
|
27414
|
+
window.addEventListener('touchend', cleanup);
|
|
27415
|
+
return function () {
|
|
27416
|
+
window.removeEventListener('mousemove', handleEvent);
|
|
27417
|
+
window.removeEventListener('touchmove', handleEvent);
|
|
27418
|
+
window.removeEventListener('mouseup', cleanup);
|
|
27419
|
+
window.removeEventListener('touchend', cleanup);
|
|
27420
|
+
};
|
|
27421
|
+
}, [setFromEvent, cleanup]);
|
|
27422
|
+
return position;
|
|
27423
|
+
};
|
|
27424
|
+
|
|
27374
27425
|
var rarityColor = function rarityColor(item) {
|
|
27375
27426
|
switch (item == null ? void 0 : item.rarity) {
|
|
27376
27427
|
case ItemRarities.Uncommon:
|
|
@@ -27539,205 +27590,108 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
|
|
|
27539
27590
|
return React.createElement(React.Fragment, null, onRenderSlot(item));
|
|
27540
27591
|
};
|
|
27541
27592
|
|
|
27542
|
-
|
|
27543
|
-
|
|
27544
|
-
|
|
27545
|
-
|
|
27546
|
-
|
|
27547
|
-
|
|
27548
|
-
|
|
27549
|
-
|
|
27550
|
-
|
|
27593
|
+
// Set default state with clearly defined initial values
|
|
27594
|
+
var defaultItemDetails = {
|
|
27595
|
+
item: null,
|
|
27596
|
+
tooltip: {
|
|
27597
|
+
visible: false,
|
|
27598
|
+
mobileVisible: false
|
|
27599
|
+
},
|
|
27600
|
+
contextMenu: {
|
|
27601
|
+
visible: false,
|
|
27602
|
+
position: {
|
|
27603
|
+
x: 0,
|
|
27604
|
+
y: 0
|
|
27605
|
+
},
|
|
27606
|
+
actions: []
|
|
27607
|
+
}
|
|
27608
|
+
};
|
|
27609
|
+
// Create context with default values
|
|
27610
|
+
var ItemSlotTooltipContext = /*#__PURE__*/createContext({
|
|
27611
|
+
itemDetails: defaultItemDetails,
|
|
27612
|
+
updateItemDetails: function updateItemDetails() {},
|
|
27613
|
+
clearItemDetails: function clearItemDetails() {}
|
|
27614
|
+
});
|
|
27615
|
+
// Provider component
|
|
27616
|
+
var ItemSlotTooltipProvider = function ItemSlotTooltipProvider(_ref) {
|
|
27617
|
+
var children = _ref.children;
|
|
27618
|
+
var _useState = useState(defaultItemDetails),
|
|
27619
|
+
itemDetails = _useState[0],
|
|
27620
|
+
setItemDetails = _useState[1];
|
|
27551
27621
|
useEffect(function () {
|
|
27552
|
-
|
|
27553
|
-
|
|
27554
|
-
|
|
27555
|
-
|
|
27556
|
-
|
|
27557
|
-
|
|
27558
|
-
}
|
|
27622
|
+
console.log('itemDetails', itemDetails);
|
|
27623
|
+
}, [itemDetails]);
|
|
27624
|
+
// Memoize the update function to optimize performance
|
|
27625
|
+
var updateItemDetails = useCallback(function (updates) {
|
|
27626
|
+
setItemDetails(function (prev) {
|
|
27627
|
+
var _updates$contextMenu$, _updates$contextMenu, _prev$contextMenu;
|
|
27628
|
+
return _extends({}, prev, updates, {
|
|
27629
|
+
tooltip: _extends({}, prev.tooltip, updates.tooltip),
|
|
27630
|
+
contextMenu: _extends({}, prev.contextMenu, updates.contextMenu, {
|
|
27631
|
+
// Ensure actions are properly merged or overridden
|
|
27632
|
+
actions: (_updates$contextMenu$ = (_updates$contextMenu = updates.contextMenu) == null ? void 0 : _updates$contextMenu.actions) != null ? _updates$contextMenu$ : (_prev$contextMenu = prev.contextMenu) == null ? void 0 : _prev$contextMenu.actions
|
|
27633
|
+
})
|
|
27634
|
+
});
|
|
27559
27635
|
});
|
|
27560
|
-
return function () {
|
|
27561
|
-
document.removeEventListener('clickOutside', function (_e) {});
|
|
27562
|
-
};
|
|
27563
27636
|
}, []);
|
|
27564
|
-
|
|
27565
|
-
|
|
27566
|
-
|
|
27567
|
-
|
|
27568
|
-
|
|
27569
|
-
|
|
27570
|
-
|
|
27637
|
+
var clearItemDetails = useCallback(function () {
|
|
27638
|
+
setItemDetails(defaultItemDetails);
|
|
27639
|
+
}, []);
|
|
27640
|
+
return React.createElement(ItemSlotTooltipContext.Provider, {
|
|
27641
|
+
value: {
|
|
27642
|
+
itemDetails: itemDetails,
|
|
27643
|
+
updateItemDetails: updateItemDetails,
|
|
27644
|
+
clearItemDetails: clearItemDetails
|
|
27571
27645
|
}
|
|
27572
|
-
},
|
|
27573
|
-
return React.createElement(ListElement$2, {
|
|
27574
|
-
key: (params == null ? void 0 : params.id) || index,
|
|
27575
|
-
onPointerDown: function onPointerDown() {
|
|
27576
|
-
onSelected(params == null ? void 0 : params.id);
|
|
27577
|
-
}
|
|
27578
|
-
}, (params == null ? void 0 : params.text) || 'No text');
|
|
27579
|
-
}))));
|
|
27580
|
-
};
|
|
27581
|
-
var Container$9 = /*#__PURE__*/styled.div.withConfig({
|
|
27582
|
-
displayName: "RelativeListMenu__Container",
|
|
27583
|
-
componentId: "sc-7hohf-0"
|
|
27584
|
-
})(["position:absolute;top:", "px;left:", "px;display:flex;flex-direction:column;width:max-content;justify-content:start;align-items:flex-start;li{font-size:", "em;}"], function (props) {
|
|
27585
|
-
return props.y;
|
|
27586
|
-
}, function (props) {
|
|
27587
|
-
return props.x;
|
|
27588
|
-
}, function (props) {
|
|
27589
|
-
return props.fontSize;
|
|
27590
|
-
});
|
|
27591
|
-
var ListElement$2 = /*#__PURE__*/styled.li.withConfig({
|
|
27592
|
-
displayName: "RelativeListMenu__ListElement",
|
|
27593
|
-
componentId: "sc-7hohf-1"
|
|
27594
|
-
})(["margin-right:0.5rem;"]);
|
|
27595
|
-
|
|
27596
|
-
var MobileItemTooltip = function MobileItemTooltip(_ref) {
|
|
27597
|
-
var item = _ref.item,
|
|
27598
|
-
atlasIMG = _ref.atlasIMG,
|
|
27599
|
-
atlasJSON = _ref.atlasJSON,
|
|
27600
|
-
closeTooltip = _ref.closeTooltip,
|
|
27601
|
-
equipmentSet = _ref.equipmentSet,
|
|
27602
|
-
_ref$scale = _ref.scale,
|
|
27603
|
-
scale = _ref$scale === void 0 ? 1 : _ref$scale,
|
|
27604
|
-
options = _ref.options,
|
|
27605
|
-
onSelected = _ref.onSelected;
|
|
27606
|
-
var ref = useRef(null);
|
|
27607
|
-
var handleFadeOut = function handleFadeOut() {
|
|
27608
|
-
var _ref$current;
|
|
27609
|
-
(_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
|
|
27610
|
-
};
|
|
27611
|
-
return React.createElement(ModalPortal, null, React.createElement(Container$a, {
|
|
27612
|
-
ref: ref,
|
|
27613
|
-
onTouchEnd: function onTouchEnd() {
|
|
27614
|
-
handleFadeOut();
|
|
27615
|
-
setTimeout(function () {
|
|
27616
|
-
closeTooltip();
|
|
27617
|
-
}, 100);
|
|
27618
|
-
},
|
|
27619
|
-
scale: scale
|
|
27620
|
-
}, React.createElement(ItemInfoDisplay, {
|
|
27621
|
-
item: item,
|
|
27622
|
-
atlasIMG: atlasIMG,
|
|
27623
|
-
atlasJSON: atlasJSON,
|
|
27624
|
-
equipmentSet: equipmentSet,
|
|
27625
|
-
isMobile: true
|
|
27626
|
-
}), React.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
|
|
27627
|
-
return React.createElement(Option, {
|
|
27628
|
-
key: option.id,
|
|
27629
|
-
onTouchEnd: function onTouchEnd() {
|
|
27630
|
-
handleFadeOut();
|
|
27631
|
-
setTimeout(function () {
|
|
27632
|
-
onSelected == null ? void 0 : onSelected(option.id);
|
|
27633
|
-
closeTooltip();
|
|
27634
|
-
}, 100);
|
|
27635
|
-
}
|
|
27636
|
-
}, option.text);
|
|
27637
|
-
}))));
|
|
27646
|
+
}, children);
|
|
27638
27647
|
};
|
|
27639
|
-
|
|
27640
|
-
|
|
27641
|
-
|
|
27642
|
-
})(["position:absolute;z-index:100;left:0;top:0;width:100vw;height:100vh;background-color:rgba(0 0 0 / 0.5);display:flex;justify-content:center;align-items:center;gap:0.5rem;transition:opacity 0.08s;animation:fadeIn 0.1s forwards;@keyframes fadeIn{0%{opacity:0;}100%{opacity:0.92;}}@keyframes fadeOut{0%{opacity:0.92;}100%{opacity:0;}}&.fadeOut{animation:fadeOut 0.1s forwards;}@media (max-width:640px){flex-direction:column;}"]);
|
|
27643
|
-
var OptionsContainer = /*#__PURE__*/styled.div.withConfig({
|
|
27644
|
-
displayName: "MobileItemTooltip__OptionsContainer",
|
|
27645
|
-
componentId: "sc-ku4p1j-1"
|
|
27646
|
-
})(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
|
|
27647
|
-
var Option = /*#__PURE__*/styled.button.withConfig({
|
|
27648
|
-
displayName: "MobileItemTooltip__Option",
|
|
27649
|
-
componentId: "sc-ku4p1j-2"
|
|
27650
|
-
})(["padding:1rem;background-color:#333;color:white;border:none;border-radius:3px;width:8rem;transition:background-color 0.1s;&:hover{background-color:#555;}@media (max-width:640px){padding:1rem 0.5rem;}"]);
|
|
27651
|
-
|
|
27652
|
-
var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
|
|
27653
|
-
var tooltipState = _ref.tooltipState,
|
|
27654
|
-
setTooltipState = _ref.setTooltipState,
|
|
27655
|
-
contextMenuState = _ref.contextMenuState,
|
|
27656
|
-
setContextMenuState = _ref.setContextMenuState,
|
|
27657
|
-
isFocused = _ref.isFocused,
|
|
27658
|
-
isContextMenuDisabled = _ref.isContextMenuDisabled,
|
|
27659
|
-
item = _ref.item,
|
|
27660
|
-
contextActions = _ref.contextActions,
|
|
27661
|
-
dragScale = _ref.dragScale,
|
|
27662
|
-
_onSelected = _ref.onSelected,
|
|
27663
|
-
atlasIMG = _ref.atlasIMG,
|
|
27664
|
-
atlasJSON = _ref.atlasJSON,
|
|
27665
|
-
equipmentSet = _ref.equipmentSet,
|
|
27666
|
-
isDragging = _ref.isDragging,
|
|
27667
|
-
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
27668
|
-
showTooltipDelayed = _ref.showTooltipDelayed;
|
|
27669
|
-
var canShow = !isDragging || !isSelectingShortcut || showTooltipDelayed;
|
|
27670
|
-
return React.createElement(React.Fragment, null, tooltipState.visible && item && !isFocused && canShow && React.createElement(ItemTooltip, {
|
|
27671
|
-
item: item,
|
|
27672
|
-
atlasIMG: atlasIMG,
|
|
27673
|
-
atlasJSON: atlasJSON,
|
|
27674
|
-
equipmentSet: equipmentSet
|
|
27675
|
-
}), tooltipState.mobileVisible && item && canShow && React.createElement(MobileItemTooltip, {
|
|
27676
|
-
item: item,
|
|
27677
|
-
atlasIMG: atlasIMG,
|
|
27678
|
-
atlasJSON: atlasJSON,
|
|
27679
|
-
equipmentSet: equipmentSet,
|
|
27680
|
-
closeTooltip: function closeTooltip() {
|
|
27681
|
-
setTooltipState(function (prev) {
|
|
27682
|
-
return _extends({}, prev, {
|
|
27683
|
-
mobileVisible: false
|
|
27684
|
-
});
|
|
27685
|
-
});
|
|
27686
|
-
},
|
|
27687
|
-
scale: dragScale,
|
|
27688
|
-
options: contextActions,
|
|
27689
|
-
onSelected: function onSelected(optionId) {
|
|
27690
|
-
setContextMenuState(function (prev) {
|
|
27691
|
-
return _extends({}, prev, {
|
|
27692
|
-
visible: false
|
|
27693
|
-
});
|
|
27694
|
-
});
|
|
27695
|
-
if (item) {
|
|
27696
|
-
_onSelected == null ? void 0 : _onSelected(optionId, item);
|
|
27697
|
-
}
|
|
27698
|
-
}
|
|
27699
|
-
}), !isContextMenuDisabled && contextMenuState.visible && contextActions && canShow && React.createElement(RelativeListMenu, {
|
|
27700
|
-
options: contextActions,
|
|
27701
|
-
onSelected: function onSelected(optionId) {
|
|
27702
|
-
setContextMenuState(function (prev) {
|
|
27703
|
-
return _extends({}, prev, {
|
|
27704
|
-
visible: false
|
|
27705
|
-
});
|
|
27706
|
-
});
|
|
27707
|
-
if (item) {
|
|
27708
|
-
_onSelected == null ? void 0 : _onSelected(optionId, item);
|
|
27709
|
-
}
|
|
27710
|
-
},
|
|
27711
|
-
onOutsideClick: function onOutsideClick() {
|
|
27712
|
-
setContextMenuState(function (prev) {
|
|
27713
|
-
return _extends({}, prev, {
|
|
27714
|
-
visible: false
|
|
27715
|
-
});
|
|
27716
|
-
});
|
|
27717
|
-
},
|
|
27718
|
-
pos: contextMenuState.position
|
|
27719
|
-
}));
|
|
27648
|
+
// Custom hook for consuming the context
|
|
27649
|
+
var useItemSlotTooltip = function useItemSlotTooltip() {
|
|
27650
|
+
return useContext(ItemSlotTooltipContext);
|
|
27720
27651
|
};
|
|
27721
27652
|
|
|
27722
|
-
var
|
|
27653
|
+
var ItemSlotDraggingContext = /*#__PURE__*/createContext({
|
|
27723
27654
|
item: null,
|
|
27724
|
-
setDraggingItem: function setDraggingItem() {}
|
|
27655
|
+
setDraggingItem: function setDraggingItem() {},
|
|
27656
|
+
dragState: {
|
|
27657
|
+
isFocused: false,
|
|
27658
|
+
wasDragged: false,
|
|
27659
|
+
position: {
|
|
27660
|
+
x: 0,
|
|
27661
|
+
y: 0
|
|
27662
|
+
},
|
|
27663
|
+
dropPosition: null
|
|
27664
|
+
},
|
|
27665
|
+
setDragState: function setDragState() {}
|
|
27725
27666
|
});
|
|
27726
|
-
var
|
|
27727
|
-
return useContext(DraggingContext);
|
|
27728
|
-
};
|
|
27729
|
-
var DraggingProvider = function DraggingProvider(_ref) {
|
|
27667
|
+
var ItemSlotDraggingProvider = function ItemSlotDraggingProvider(_ref) {
|
|
27730
27668
|
var children = _ref.children;
|
|
27731
27669
|
var _useState = useState(null),
|
|
27732
27670
|
item = _useState[0],
|
|
27733
27671
|
setDraggingItem = _useState[1];
|
|
27734
|
-
|
|
27672
|
+
var _useState2 = useState({
|
|
27673
|
+
isFocused: false,
|
|
27674
|
+
wasDragged: false,
|
|
27675
|
+
position: {
|
|
27676
|
+
x: 0,
|
|
27677
|
+
y: 0
|
|
27678
|
+
},
|
|
27679
|
+
dropPosition: null
|
|
27680
|
+
}),
|
|
27681
|
+
dragState = _useState2[0],
|
|
27682
|
+
setDragState = _useState2[1];
|
|
27683
|
+
return React.createElement(ItemSlotDraggingContext.Provider, {
|
|
27735
27684
|
value: {
|
|
27736
27685
|
item: item,
|
|
27737
|
-
setDraggingItem: setDraggingItem
|
|
27686
|
+
setDraggingItem: setDraggingItem,
|
|
27687
|
+
dragState: dragState,
|
|
27688
|
+
setDragState: setDragState
|
|
27738
27689
|
}
|
|
27739
27690
|
}, children);
|
|
27740
27691
|
};
|
|
27692
|
+
var useItemSlotDragging = function useItemSlotDragging() {
|
|
27693
|
+
return useContext(ItemSlotDraggingContext);
|
|
27694
|
+
};
|
|
27741
27695
|
|
|
27742
27696
|
var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
27743
27697
|
var isDepotSystem = _ref.isDepotSystem,
|
|
@@ -27753,24 +27707,16 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27753
27707
|
containerType = _ref.containerType,
|
|
27754
27708
|
slotIndex = _ref.slotIndex,
|
|
27755
27709
|
openQuantitySelector = _ref.openQuantitySelector,
|
|
27756
|
-
isContextMenuDisabled = _ref.isContextMenuDisabled
|
|
27757
|
-
setTooltipState = _ref.setTooltipState,
|
|
27758
|
-
setContextMenuState = _ref.setContextMenuState;
|
|
27710
|
+
isContextMenuDisabled = _ref.isContextMenuDisabled;
|
|
27759
27711
|
var dragContainer = useRef(null);
|
|
27760
|
-
var
|
|
27761
|
-
draggingItem =
|
|
27762
|
-
setDraggingItem =
|
|
27763
|
-
|
|
27764
|
-
|
|
27765
|
-
|
|
27766
|
-
|
|
27767
|
-
|
|
27768
|
-
y: 0
|
|
27769
|
-
},
|
|
27770
|
-
dropPosition: null
|
|
27771
|
-
}),
|
|
27772
|
-
dragState = _useState[0],
|
|
27773
|
-
setDragState = _useState[1];
|
|
27712
|
+
var _useItemSlotDragging = useItemSlotDragging(),
|
|
27713
|
+
draggingItem = _useItemSlotDragging.item,
|
|
27714
|
+
setDraggingItem = _useItemSlotDragging.setDraggingItem,
|
|
27715
|
+
dragState = _useItemSlotDragging.dragState,
|
|
27716
|
+
setDragState = _useItemSlotDragging.setDragState;
|
|
27717
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
27718
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails,
|
|
27719
|
+
itemDetails = _useItemSlotTooltip.itemDetails;
|
|
27774
27720
|
useEffect(function () {
|
|
27775
27721
|
setDragState(function (prev) {
|
|
27776
27722
|
return _extends({}, prev, {
|
|
@@ -27781,7 +27727,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27781
27727
|
isFocused: false
|
|
27782
27728
|
});
|
|
27783
27729
|
});
|
|
27784
|
-
}, [item, isDepotSystem]);
|
|
27730
|
+
}, [item, isDepotSystem, setDragState]);
|
|
27785
27731
|
useEffect(function () {
|
|
27786
27732
|
if (onDrop && item && dragState.dropPosition) {
|
|
27787
27733
|
onDrop(item, dragState.dropPosition);
|
|
@@ -27809,11 +27755,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27809
27755
|
};
|
|
27810
27756
|
}, []);
|
|
27811
27757
|
var resetDragState = useCallback(function () {
|
|
27812
|
-
|
|
27813
|
-
return _extends({}, prev, {
|
|
27814
|
-
visible: false
|
|
27815
|
-
});
|
|
27816
|
-
});
|
|
27758
|
+
console.log('RESET_DRAG_STATE!');
|
|
27817
27759
|
setDragState(function (prev) {
|
|
27818
27760
|
return _extends({}, prev, {
|
|
27819
27761
|
wasDragged: false,
|
|
@@ -27824,20 +27766,35 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27824
27766
|
}
|
|
27825
27767
|
});
|
|
27826
27768
|
});
|
|
27827
|
-
|
|
27769
|
+
setDraggingItem(null);
|
|
27770
|
+
// Reset tooltip visibility
|
|
27771
|
+
updateItemDetails({
|
|
27772
|
+
tooltip: {
|
|
27773
|
+
visible: false,
|
|
27774
|
+
mobileVisible: false
|
|
27775
|
+
}
|
|
27776
|
+
});
|
|
27777
|
+
}, [updateItemDetails, setDragState]);
|
|
27828
27778
|
var handleSuccessfulDrag = useCallback(function (quantity) {
|
|
27779
|
+
console.log('HANDLE_SUCCESSFUL_DRAG!');
|
|
27829
27780
|
resetDragState();
|
|
27830
27781
|
if (quantity !== -1 && item) {
|
|
27831
27782
|
onDragEnd == null ? void 0 : onDragEnd(quantity);
|
|
27832
27783
|
}
|
|
27833
27784
|
}, [item, onDragEnd, resetDragState]);
|
|
27834
27785
|
var onDraggableStart = useCallback(function () {
|
|
27786
|
+
console.log('ON_DRAGGABLE_START!');
|
|
27835
27787
|
if (!item || isSelectingShortcut) return;
|
|
27836
27788
|
if (onDragStart && containerType) {
|
|
27837
27789
|
onDragStart(item, slotIndex, containerType);
|
|
27838
27790
|
}
|
|
27791
|
+
if (!draggingItem && item) {
|
|
27792
|
+
console.log('!!! SETTING DRAGGING ITEM ', item._id);
|
|
27793
|
+
setDraggingItem(item);
|
|
27794
|
+
}
|
|
27839
27795
|
}, [item, isSelectingShortcut, onDragStart, containerType, slotIndex]);
|
|
27840
27796
|
var onDraggableProgress = useCallback(function (_e, data) {
|
|
27797
|
+
console.log('ON_DRAGGABLE_PROGRESS!');
|
|
27841
27798
|
var _dragState$position = dragState.position,
|
|
27842
27799
|
x = _dragState$position.x,
|
|
27843
27800
|
y = _dragState$position.y;
|
|
@@ -27849,14 +27806,9 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27849
27806
|
});
|
|
27850
27807
|
});
|
|
27851
27808
|
}
|
|
27852
|
-
|
|
27853
|
-
setDraggingItem(item);
|
|
27854
|
-
}
|
|
27855
|
-
}, [dragState.position, draggingItem, item, setDraggingItem]);
|
|
27809
|
+
}, [dragState.position, draggingItem, item, setDraggingItem, setDragState]);
|
|
27856
27810
|
var onDraggableStop = useCallback(function (e, data) {
|
|
27857
|
-
|
|
27858
|
-
setDraggingItem(null);
|
|
27859
|
-
}, 50);
|
|
27811
|
+
console.log('ON_DRAGGABLE_STOP!');
|
|
27860
27812
|
var target = e.target;
|
|
27861
27813
|
if (!target) return;
|
|
27862
27814
|
target.classList.remove('react-draggable-dragging');
|
|
@@ -27899,27 +27851,33 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
|
|
|
27899
27851
|
}, 50);
|
|
27900
27852
|
} else if (item) {
|
|
27901
27853
|
var isTouch = e.type === 'touchend';
|
|
27902
|
-
|
|
27903
|
-
|
|
27904
|
-
|
|
27854
|
+
console.log("Debug: \n isTouch: " + isTouch + ",\n isSelectingShortcut: " + isSelectingShortcut + ",\n draggingItem: " + draggingItem + ",\n dragginState: " + JSON.stringify(dragState) + "\n ");
|
|
27855
|
+
if (!isContextMenuDisabled && isTouch && !isSelectingShortcut) {
|
|
27856
|
+
updateItemDetails({
|
|
27857
|
+
item: item,
|
|
27858
|
+
tooltip: {
|
|
27905
27859
|
mobileVisible: true
|
|
27906
|
-
}
|
|
27860
|
+
}
|
|
27907
27861
|
});
|
|
27908
27862
|
} else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
|
|
27863
|
+
var _itemDetails$contextM;
|
|
27909
27864
|
var event = e;
|
|
27910
|
-
|
|
27911
|
-
|
|
27912
|
-
|
|
27865
|
+
updateItemDetails({
|
|
27866
|
+
item: item,
|
|
27867
|
+
contextMenu: {
|
|
27868
|
+
visible: !(itemDetails != null && (_itemDetails$contextM = itemDetails.contextMenu) != null && _itemDetails$contextM.visible),
|
|
27913
27869
|
position: {
|
|
27914
27870
|
x: event.clientX - 10,
|
|
27915
27871
|
y: event.clientY - 5
|
|
27916
27872
|
}
|
|
27917
|
-
}
|
|
27873
|
+
}
|
|
27918
27874
|
});
|
|
27919
27875
|
}
|
|
27920
27876
|
onPointerDown == null ? void 0 : onPointerDown(item.type, containerType != null ? containerType : null, item);
|
|
27921
27877
|
}
|
|
27922
|
-
|
|
27878
|
+
console.log('setting draggingItem to null');
|
|
27879
|
+
setDraggingItem(null);
|
|
27880
|
+
}, [dragState.wasDragged, item, isSelectingShortcut, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, handleSuccessfulDrag, resetDragState, isContextMenuDisabled, onPointerDown, containerType, setItemShortcut]);
|
|
27923
27881
|
return {
|
|
27924
27882
|
dragContainer: dragContainer,
|
|
27925
27883
|
dragState: dragState,
|
|
@@ -28078,7 +28036,6 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28078
28036
|
_onMouseOver = _ref.onMouseOver,
|
|
28079
28037
|
onMouseOut = _ref.onMouseOut,
|
|
28080
28038
|
onPointerDown = _ref.onPointerDown,
|
|
28081
|
-
_onSelected = _ref.onSelected,
|
|
28082
28039
|
atlasJSON = _ref.atlasJSON,
|
|
28083
28040
|
atlasIMG = _ref.atlasIMG,
|
|
28084
28041
|
_ref$isContextMenuDis = _ref.isContextMenuDisabled,
|
|
@@ -28091,33 +28048,8 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28091
28048
|
openQuantitySelector = _ref.openQuantitySelector,
|
|
28092
28049
|
dragScale = _ref.dragScale,
|
|
28093
28050
|
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
28094
|
-
equipmentSet = _ref.equipmentSet,
|
|
28095
28051
|
setItemShortcut = _ref.setItemShortcut,
|
|
28096
28052
|
isDepotSystem = _ref.isDepotSystem;
|
|
28097
|
-
var _useState = useState({
|
|
28098
|
-
visible: false,
|
|
28099
|
-
mobileVisible: false
|
|
28100
|
-
}),
|
|
28101
|
-
tooltipState = _useState[0],
|
|
28102
|
-
setTooltipState = _useState[1];
|
|
28103
|
-
var _useState2 = useState({
|
|
28104
|
-
visible: false,
|
|
28105
|
-
position: {
|
|
28106
|
-
x: 0,
|
|
28107
|
-
y: 0
|
|
28108
|
-
}
|
|
28109
|
-
}),
|
|
28110
|
-
contextMenuState = _useState2[0],
|
|
28111
|
-
setContextMenuState = _useState2[1];
|
|
28112
|
-
var _useState3 = useState([]),
|
|
28113
|
-
contextActions = _useState3[0],
|
|
28114
|
-
setContextActions = _useState3[1];
|
|
28115
|
-
var isDraggingDisabled = useMemo(function () {
|
|
28116
|
-
return contextMenuState.visible || onDragStart === undefined || onDragEnd === undefined;
|
|
28117
|
-
}, [contextMenuState.visible, onDragStart, onDragEnd]);
|
|
28118
|
-
useEffect(function () {
|
|
28119
|
-
console.log('isDraggingDisabled', isDraggingDisabled);
|
|
28120
|
-
}, [isDraggingDisabled]);
|
|
28121
28053
|
var _useItemSlotDragAndDr = useItemSlotDragAndDrop({
|
|
28122
28054
|
isDepotSystem: !!isDepotSystem,
|
|
28123
28055
|
item: item,
|
|
@@ -28131,10 +28063,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28131
28063
|
containerType: containerType,
|
|
28132
28064
|
slotIndex: slotIndex,
|
|
28133
28065
|
openQuantitySelector: openQuantitySelector != null ? openQuantitySelector : function () {},
|
|
28134
|
-
isContextMenuDisabled: isContextMenuDisabled
|
|
28135
|
-
setTooltipState: setTooltipState,
|
|
28136
|
-
contextMenuState: contextMenuState,
|
|
28137
|
-
setContextMenuState: setContextMenuState
|
|
28066
|
+
isContextMenuDisabled: isContextMenuDisabled
|
|
28138
28067
|
}),
|
|
28139
28068
|
dragContainer = _useItemSlotDragAndDr.dragContainer,
|
|
28140
28069
|
dragState = _useItemSlotDragAndDr.dragState,
|
|
@@ -28143,17 +28072,28 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28143
28072
|
onDraggableStart = _useItemSlotDragAndDr.onDraggableStart,
|
|
28144
28073
|
onDraggableProgress = _useItemSlotDragAndDr.onDraggableProgress,
|
|
28145
28074
|
onDraggableStop = _useItemSlotDragAndDr.onDraggableStop;
|
|
28075
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
28076
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails,
|
|
28077
|
+
itemDetails = _useItemSlotTooltip.itemDetails;
|
|
28078
|
+
var _useCursorPosition = useCursorPosition({
|
|
28079
|
+
scale: dragScale
|
|
28080
|
+
}),
|
|
28081
|
+
cursorX = _useCursorPosition.x,
|
|
28082
|
+
cursorY = _useCursorPosition.y;
|
|
28146
28083
|
useEffect(function () {
|
|
28147
28084
|
if (item && containerType) {
|
|
28148
|
-
|
|
28085
|
+
updateItemDetails({
|
|
28086
|
+
item: item,
|
|
28087
|
+
contextMenu: {
|
|
28088
|
+
actions: generateContextMenu(item, containerType, isDepotSystem)
|
|
28089
|
+
}
|
|
28090
|
+
});
|
|
28149
28091
|
}
|
|
28150
28092
|
}, [item, isDepotSystem]);
|
|
28151
28093
|
var bounds = getContainerBounds();
|
|
28152
28094
|
var handleInteraction = useCallback(function (event) {
|
|
28153
28095
|
event.stopPropagation();
|
|
28154
|
-
|
|
28155
|
-
clientX = _ref2.clientX,
|
|
28156
|
-
clientY = _ref2.clientY;
|
|
28096
|
+
console.log('handleInteraction');
|
|
28157
28097
|
if (item && containerType) {
|
|
28158
28098
|
if (onPlaceDrop && draggingItem) {
|
|
28159
28099
|
onPlaceDrop(item, slotIndex, containerType);
|
|
@@ -28162,52 +28102,31 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28162
28102
|
onPointerDown(item.type, containerType, item);
|
|
28163
28103
|
}
|
|
28164
28104
|
}
|
|
28165
|
-
|
|
28166
|
-
|
|
28167
|
-
visible: true
|
|
28168
|
-
});
|
|
28169
|
-
});
|
|
28170
|
-
_onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, clientX, clientY);
|
|
28171
|
-
}, [item, containerType, slotIndex, onPlaceDrop, onPointerDown, _onMouseOver, onDragStart, onDragEnd]);
|
|
28105
|
+
_onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, cursorX, cursorY);
|
|
28106
|
+
}, [item, containerType, slotIndex, onPlaceDrop, onPointerDown, _onMouseOver, onDragStart, onDragEnd, cursorX, cursorY]);
|
|
28172
28107
|
var handleInteractionEnd = useCallback(function (event) {
|
|
28173
28108
|
event.preventDefault();
|
|
28174
28109
|
event.stopPropagation();
|
|
28175
|
-
|
|
28176
|
-
|
|
28177
|
-
visible: false
|
|
28178
|
-
});
|
|
28179
|
-
});
|
|
28110
|
+
console.log('handleInteractionEnd');
|
|
28111
|
+
console.log('itemDetails', itemDetails);
|
|
28180
28112
|
onMouseOut == null ? void 0 : onMouseOut();
|
|
28181
|
-
if (event.type === 'touchend'
|
|
28113
|
+
if (event.type === 'touchend') {
|
|
28182
28114
|
var _document$elementFrom;
|
|
28183
|
-
var _event$changedTouches = event.changedTouches[0],
|
|
28184
|
-
clientX = _event$changedTouches.clientX,
|
|
28185
|
-
clientY = _event$changedTouches.clientY;
|
|
28186
28115
|
var simulatedEvent = new MouseEvent('mouseup', {
|
|
28187
|
-
clientX:
|
|
28188
|
-
clientY:
|
|
28116
|
+
clientX: cursorX,
|
|
28117
|
+
clientY: cursorY,
|
|
28189
28118
|
bubbles: true
|
|
28190
28119
|
});
|
|
28191
|
-
(_document$elementFrom = document.elementFromPoint(
|
|
28192
|
-
|
|
28193
|
-
|
|
28194
|
-
|
|
28195
|
-
|
|
28196
|
-
|
|
28197
|
-
|
|
28198
|
-
useEffect(function () {
|
|
28199
|
-
if (tooltipState.visible && !isDraggingDisabled) {
|
|
28200
|
-
var timer = setTimeout(function () {
|
|
28201
|
-
return setShowTooltipDelayed(true);
|
|
28202
|
-
}, 50);
|
|
28203
|
-
return function () {
|
|
28204
|
-
return clearTimeout(timer);
|
|
28205
|
-
};
|
|
28206
|
-
} else {
|
|
28207
|
-
setShowTooltipDelayed(false);
|
|
28120
|
+
(_document$elementFrom = document.elementFromPoint(cursorX, cursorY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
|
|
28121
|
+
updateItemDetails({
|
|
28122
|
+
item: item,
|
|
28123
|
+
tooltip: {
|
|
28124
|
+
visible: false
|
|
28125
|
+
}
|
|
28126
|
+
});
|
|
28208
28127
|
}
|
|
28209
|
-
}, [
|
|
28210
|
-
return React.createElement(Container$
|
|
28128
|
+
}, [onMouseOut, cursorX, cursorY]);
|
|
28129
|
+
return React.createElement(Container$9, {
|
|
28211
28130
|
isDraggingItem: !!draggingItem,
|
|
28212
28131
|
item: item,
|
|
28213
28132
|
className: "rpgui-icon empty-slot",
|
|
@@ -28223,7 +28142,6 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28223
28142
|
},
|
|
28224
28143
|
onTouchEnd: function onTouchEnd(e) {
|
|
28225
28144
|
var _document$elementFrom2;
|
|
28226
|
-
handleInteractionEnd(e);
|
|
28227
28145
|
var _e$changedTouches$ = e.changedTouches[0],
|
|
28228
28146
|
clientX = _e$changedTouches$.clientX,
|
|
28229
28147
|
clientY = _e$changedTouches$.clientY;
|
|
@@ -28242,7 +28160,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28242
28160
|
axis: isSelectingShortcut ? 'none' : 'both',
|
|
28243
28161
|
defaultClassName: item ? 'draggable' : 'empty-slot',
|
|
28244
28162
|
scale: dragScale,
|
|
28245
|
-
disabled:
|
|
28163
|
+
disabled: onDragStart === undefined || onDragEnd === undefined,
|
|
28246
28164
|
onStop: onDraggableStop,
|
|
28247
28165
|
onStart: onDraggableStart,
|
|
28248
28166
|
onDrag: onDraggableProgress,
|
|
@@ -28252,26 +28170,25 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28252
28170
|
}, React.createElement(ItemContainer, {
|
|
28253
28171
|
ref: dragContainer,
|
|
28254
28172
|
isFocused: dragState.isFocused,
|
|
28255
|
-
onMouseOver: function onMouseOver(
|
|
28256
|
-
_onMouseOver == null ? void 0 : _onMouseOver(
|
|
28173
|
+
onMouseOver: function onMouseOver() {
|
|
28174
|
+
_onMouseOver == null ? void 0 : _onMouseOver({}, slotIndex, item, cursorX, cursorY);
|
|
28257
28175
|
},
|
|
28258
28176
|
onMouseOut: onMouseOut,
|
|
28259
28177
|
onMouseEnter: function onMouseEnter() {
|
|
28260
|
-
|
|
28261
|
-
|
|
28178
|
+
updateItemDetails({
|
|
28179
|
+
item: item,
|
|
28180
|
+
tooltip: {
|
|
28262
28181
|
visible: true
|
|
28263
|
-
}
|
|
28182
|
+
}
|
|
28264
28183
|
});
|
|
28265
28184
|
},
|
|
28266
|
-
onMouseLeave: function onMouseLeave(
|
|
28267
|
-
|
|
28268
|
-
|
|
28269
|
-
|
|
28270
|
-
|
|
28271
|
-
|
|
28272
|
-
|
|
28273
|
-
});
|
|
28274
|
-
}
|
|
28185
|
+
onMouseLeave: function onMouseLeave() {
|
|
28186
|
+
updateItemDetails({
|
|
28187
|
+
item: item,
|
|
28188
|
+
tooltip: {
|
|
28189
|
+
visible: false
|
|
28190
|
+
}
|
|
28191
|
+
});
|
|
28275
28192
|
}
|
|
28276
28193
|
}, React.createElement(ItemSlotRenderer, {
|
|
28277
28194
|
item: item,
|
|
@@ -28279,49 +28196,25 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
|
|
|
28279
28196
|
atlasIMG: atlasIMG,
|
|
28280
28197
|
atlasJSON: atlasJSON,
|
|
28281
28198
|
containerType: containerType
|
|
28282
|
-
})))
|
|
28283
|
-
tooltipState: tooltipState,
|
|
28284
|
-
setTooltipState: setTooltipState,
|
|
28285
|
-
contextMenuState: contextMenuState,
|
|
28286
|
-
setContextMenuState: setContextMenuState,
|
|
28287
|
-
isFocused: dragState.isFocused,
|
|
28288
|
-
isContextMenuDisabled: isContextMenuDisabled,
|
|
28289
|
-
item: item,
|
|
28290
|
-
contextActions: contextActions,
|
|
28291
|
-
dragScale: dragScale,
|
|
28292
|
-
onSelected: function onSelected(optionId, item) {
|
|
28293
|
-
setContextMenuState(function (prev) {
|
|
28294
|
-
return _extends({}, prev, {
|
|
28295
|
-
visible: false
|
|
28296
|
-
});
|
|
28297
|
-
});
|
|
28298
|
-
if (_onSelected) _onSelected(optionId, item);
|
|
28299
|
-
},
|
|
28300
|
-
atlasIMG: atlasIMG,
|
|
28301
|
-
atlasJSON: atlasJSON,
|
|
28302
|
-
equipmentSet: equipmentSet,
|
|
28303
|
-
isDragging: !!draggingItem,
|
|
28304
|
-
isSelectingShortcut: !!isSelectingShortcut,
|
|
28305
|
-
showTooltipDelayed: showTooltipDelayed
|
|
28306
|
-
}));
|
|
28199
|
+
}))));
|
|
28307
28200
|
}));
|
|
28308
|
-
var Container$
|
|
28201
|
+
var Container$9 = /*#__PURE__*/styled.div.withConfig({
|
|
28309
28202
|
displayName: "ItemSlot__Container",
|
|
28310
28203
|
componentId: "sc-l2j5ef-0"
|
|
28311
|
-
})(["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 (
|
|
28312
|
-
var isDraggingItem =
|
|
28204
|
+
})(["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) {
|
|
28205
|
+
var isDraggingItem = _ref2.isDraggingItem;
|
|
28313
28206
|
return isDraggingItem ? 0 : 1;
|
|
28207
|
+
}, function (_ref3) {
|
|
28208
|
+
var item = _ref3.item;
|
|
28209
|
+
return rarityColor(item);
|
|
28314
28210
|
}, function (_ref4) {
|
|
28315
28211
|
var item = _ref4.item;
|
|
28316
|
-
return rarityColor(item);
|
|
28212
|
+
return "0 0 5px 2px " + rarityColor(item);
|
|
28317
28213
|
}, function (_ref5) {
|
|
28318
28214
|
var item = _ref5.item;
|
|
28319
|
-
return "0 0 5px 2px " + rarityColor(item);
|
|
28320
|
-
}, function (_ref6) {
|
|
28321
|
-
var item = _ref6.item;
|
|
28322
28215
|
return "0 0 4px 3px " + rarityColor(item);
|
|
28323
|
-
}, function (
|
|
28324
|
-
var isSelectingShortcut =
|
|
28216
|
+
}, function (_ref6) {
|
|
28217
|
+
var isSelectingShortcut = _ref6.isSelectingShortcut;
|
|
28325
28218
|
return isSelectingShortcut ? 'bg-color-change 1s infinite' : 'none';
|
|
28326
28219
|
});
|
|
28327
28220
|
var ItemContainer = /*#__PURE__*/styled.div.withConfig({
|
|
@@ -28421,7 +28314,7 @@ var ItemInfo = function ItemInfo(_ref) {
|
|
|
28421
28314
|
});
|
|
28422
28315
|
};
|
|
28423
28316
|
var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
|
|
28424
|
-
return React.createElement(Container$
|
|
28317
|
+
return React.createElement(Container$a, {
|
|
28425
28318
|
item: item
|
|
28426
28319
|
}, React.createElement(Header, null, React.createElement("div", null, React.createElement(Title$1, null, item.name), item.rarity !== 'Common' && React.createElement(Rarity, {
|
|
28427
28320
|
item: item
|
|
@@ -28435,7 +28328,7 @@ var ItemInfo = function ItemInfo(_ref) {
|
|
|
28435
28328
|
"$isSpecial": true
|
|
28436
28329
|
}, "Two handed"), React.createElement(Description, null, item.description), item.maxStackSize && item.maxStackSize !== 1 && React.createElement(StackInfo, null, "x", Math.round(((_item$stackQty = item.stackQty) != null ? _item$stackQty : 1) * 100) / 100, "(", item.maxStackSize, ")"), renderMissingStatistic().length > 0 && React.createElement(MissingStatistics, null, React.createElement(Statistic, null, "Equipped Diff"), itemToCompare && renderMissingStatistic()));
|
|
28437
28330
|
};
|
|
28438
|
-
var Container$
|
|
28331
|
+
var Container$a = /*#__PURE__*/styled.div.withConfig({
|
|
28439
28332
|
displayName: "ItemInfo__Container",
|
|
28440
28333
|
componentId: "sc-1xm4q8k-0"
|
|
28441
28334
|
})(["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) {
|
|
@@ -28581,7 +28474,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
|
|
|
28581
28474
|
}
|
|
28582
28475
|
return;
|
|
28583
28476
|
}, []);
|
|
28584
|
-
return React.createElement(ModalPortal, null, React.createElement(Container$
|
|
28477
|
+
return React.createElement(ModalPortal, null, React.createElement(Container$b, {
|
|
28585
28478
|
ref: ref
|
|
28586
28479
|
}, React.createElement(ItemInfoDisplay, {
|
|
28587
28480
|
item: item,
|
|
@@ -28590,11 +28483,67 @@ var ItemTooltip = function ItemTooltip(_ref) {
|
|
|
28590
28483
|
equipmentSet: equipmentSet
|
|
28591
28484
|
})));
|
|
28592
28485
|
};
|
|
28593
|
-
var Container$
|
|
28486
|
+
var Container$b = /*#__PURE__*/styled.div.withConfig({
|
|
28594
28487
|
displayName: "ItemTooltip__Container",
|
|
28595
28488
|
componentId: "sc-11d9r7x-0"
|
|
28596
28489
|
})(["position:absolute;z-index:100;pointer-events:none;left:0;top:0;opacity:0;transition:opacity 0.08s;"]);
|
|
28597
28490
|
|
|
28491
|
+
var MobileItemTooltip = function MobileItemTooltip(_ref) {
|
|
28492
|
+
var item = _ref.item,
|
|
28493
|
+
atlasIMG = _ref.atlasIMG,
|
|
28494
|
+
atlasJSON = _ref.atlasJSON,
|
|
28495
|
+
closeTooltip = _ref.closeTooltip,
|
|
28496
|
+
equipmentSet = _ref.equipmentSet,
|
|
28497
|
+
_ref$scale = _ref.scale,
|
|
28498
|
+
scale = _ref$scale === void 0 ? 1 : _ref$scale,
|
|
28499
|
+
options = _ref.options,
|
|
28500
|
+
onSelected = _ref.onSelected;
|
|
28501
|
+
var ref = useRef(null);
|
|
28502
|
+
var handleFadeOut = function handleFadeOut() {
|
|
28503
|
+
var _ref$current;
|
|
28504
|
+
(_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
|
|
28505
|
+
};
|
|
28506
|
+
return React.createElement(ModalPortal, null, React.createElement(Container$c, {
|
|
28507
|
+
ref: ref,
|
|
28508
|
+
onTouchEnd: function onTouchEnd() {
|
|
28509
|
+
handleFadeOut();
|
|
28510
|
+
setTimeout(function () {
|
|
28511
|
+
closeTooltip();
|
|
28512
|
+
}, 100);
|
|
28513
|
+
},
|
|
28514
|
+
scale: scale
|
|
28515
|
+
}, React.createElement(ItemInfoDisplay, {
|
|
28516
|
+
item: item,
|
|
28517
|
+
atlasIMG: atlasIMG,
|
|
28518
|
+
atlasJSON: atlasJSON,
|
|
28519
|
+
equipmentSet: equipmentSet,
|
|
28520
|
+
isMobile: true
|
|
28521
|
+
}), React.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
|
|
28522
|
+
return React.createElement(Option, {
|
|
28523
|
+
key: option.id,
|
|
28524
|
+
onTouchEnd: function onTouchEnd() {
|
|
28525
|
+
handleFadeOut();
|
|
28526
|
+
setTimeout(function () {
|
|
28527
|
+
onSelected == null ? void 0 : onSelected(option.id);
|
|
28528
|
+
closeTooltip();
|
|
28529
|
+
}, 100);
|
|
28530
|
+
}
|
|
28531
|
+
}, option.text);
|
|
28532
|
+
}))));
|
|
28533
|
+
};
|
|
28534
|
+
var Container$c = /*#__PURE__*/styled.div.withConfig({
|
|
28535
|
+
displayName: "MobileItemTooltip__Container",
|
|
28536
|
+
componentId: "sc-ku4p1j-0"
|
|
28537
|
+
})(["position:absolute;z-index:100;left:0;top:0;width:100vw;height:100vh;background-color:rgba(0 0 0 / 0.5);display:flex;justify-content:center;align-items:center;gap:0.5rem;transition:opacity 0.08s;animation:fadeIn 0.1s forwards;@keyframes fadeIn{0%{opacity:0;}100%{opacity:0.92;}}@keyframes fadeOut{0%{opacity:0.92;}100%{opacity:0;}}&.fadeOut{animation:fadeOut 0.1s forwards;}@media (max-width:640px){flex-direction:column;}"]);
|
|
28538
|
+
var OptionsContainer = /*#__PURE__*/styled.div.withConfig({
|
|
28539
|
+
displayName: "MobileItemTooltip__OptionsContainer",
|
|
28540
|
+
componentId: "sc-ku4p1j-1"
|
|
28541
|
+
})(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
|
|
28542
|
+
var Option = /*#__PURE__*/styled.button.withConfig({
|
|
28543
|
+
displayName: "MobileItemTooltip__Option",
|
|
28544
|
+
componentId: "sc-ku4p1j-2"
|
|
28545
|
+
})(["padding:1rem;background-color:#333;color:white;border:none;border-radius:3px;width:8rem;transition:background-color 0.1s;&:hover{background-color:#555;}@media (max-width:640px){padding:1rem 0.5rem;}"]);
|
|
28546
|
+
|
|
28598
28547
|
var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
|
|
28599
28548
|
var children = _ref.children,
|
|
28600
28549
|
atlasIMG = _ref.atlasIMG,
|
|
@@ -28949,7 +28898,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
28949
28898
|
onChange(selectedValue);
|
|
28950
28899
|
}
|
|
28951
28900
|
}, [selectedValue]);
|
|
28952
|
-
return React.createElement(Container$
|
|
28901
|
+
return React.createElement(Container$d, {
|
|
28953
28902
|
onMouseLeave: function onMouseLeave() {
|
|
28954
28903
|
return setOpened(false);
|
|
28955
28904
|
},
|
|
@@ -28977,7 +28926,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
28977
28926
|
}, option.option);
|
|
28978
28927
|
})));
|
|
28979
28928
|
};
|
|
28980
|
-
var Container$
|
|
28929
|
+
var Container$d = /*#__PURE__*/styled.div.withConfig({
|
|
28981
28930
|
displayName: "Dropdown__Container",
|
|
28982
28931
|
componentId: "sc-8arn65-0"
|
|
28983
28932
|
})(["position:relative;width:", ";"], function (props) {
|
|
@@ -29019,57 +28968,6 @@ var Details = /*#__PURE__*/styled.p.withConfig({
|
|
|
29019
28968
|
componentId: "sc-kaa0h9-0"
|
|
29020
28969
|
})(["font-size:", " !important;"], uiFonts.size.xsmall);
|
|
29021
28970
|
|
|
29022
|
-
var useCursorPosition = function useCursorPosition(_ref) {
|
|
29023
|
-
var _ref$scale = _ref.scale,
|
|
29024
|
-
scale = _ref$scale === void 0 ? 1 : _ref$scale;
|
|
29025
|
-
var _useState = useState({
|
|
29026
|
-
x: 0,
|
|
29027
|
-
y: 0
|
|
29028
|
-
}),
|
|
29029
|
-
position = _useState[0],
|
|
29030
|
-
setPosition = _useState[1];
|
|
29031
|
-
var scalePosition = useCallback(function (x, y) {
|
|
29032
|
-
return {
|
|
29033
|
-
x: (x - GRID_WIDTH / 2) / scale + GRID_WIDTH / 2,
|
|
29034
|
-
y: (y - GRID_HEIGHT / 2) / scale + GRID_HEIGHT / 2
|
|
29035
|
-
};
|
|
29036
|
-
}, [scale]);
|
|
29037
|
-
var setFromEvent = useCallback(function (e) {
|
|
29038
|
-
var x, y;
|
|
29039
|
-
if ('touches' in e) {
|
|
29040
|
-
x = e.touches[0].clientX;
|
|
29041
|
-
y = e.touches[0].clientY;
|
|
29042
|
-
} else {
|
|
29043
|
-
x = e.clientX;
|
|
29044
|
-
y = e.clientY;
|
|
29045
|
-
}
|
|
29046
|
-
var scaledPosition = scalePosition(x, y);
|
|
29047
|
-
setPosition(scaledPosition);
|
|
29048
|
-
}, [scale, scalePosition]);
|
|
29049
|
-
var cleanup = useCallback(function () {
|
|
29050
|
-
setPosition({
|
|
29051
|
-
x: 0,
|
|
29052
|
-
y: 0
|
|
29053
|
-
});
|
|
29054
|
-
}, []);
|
|
29055
|
-
useEffect(function () {
|
|
29056
|
-
var handleEvent = function handleEvent(e) {
|
|
29057
|
-
return setFromEvent(e);
|
|
29058
|
-
};
|
|
29059
|
-
window.addEventListener('mousemove', handleEvent);
|
|
29060
|
-
window.addEventListener('touchmove', handleEvent);
|
|
29061
|
-
window.addEventListener('mouseup', cleanup);
|
|
29062
|
-
window.addEventListener('touchend', cleanup);
|
|
29063
|
-
return function () {
|
|
29064
|
-
window.removeEventListener('mousemove', handleEvent);
|
|
29065
|
-
window.removeEventListener('touchmove', handleEvent);
|
|
29066
|
-
window.removeEventListener('mouseup', cleanup);
|
|
29067
|
-
window.removeEventListener('touchend', cleanup);
|
|
29068
|
-
};
|
|
29069
|
-
}, [setFromEvent, cleanup]);
|
|
29070
|
-
return position;
|
|
29071
|
-
};
|
|
29072
|
-
|
|
29073
28971
|
var CONTAINER_SIZE = 32;
|
|
29074
28972
|
var OFFSET = CONTAINER_SIZE / 2;
|
|
29075
28973
|
var DraggedItem = function DraggedItem(_ref) {
|
|
@@ -29077,8 +28975,8 @@ var DraggedItem = function DraggedItem(_ref) {
|
|
|
29077
28975
|
var atlasJSON = _ref.atlasJSON,
|
|
29078
28976
|
atlasIMG = _ref.atlasIMG,
|
|
29079
28977
|
scale = _ref.scale;
|
|
29080
|
-
var
|
|
29081
|
-
item =
|
|
28978
|
+
var _useItemSlotDragging = useItemSlotDragging(),
|
|
28979
|
+
item = _useItemSlotDragging.item;
|
|
29082
28980
|
var _useCursorPosition = useCursorPosition({
|
|
29083
28981
|
scale: scale
|
|
29084
28982
|
}),
|
|
@@ -29093,7 +28991,7 @@ var DraggedItem = function DraggedItem(_ref) {
|
|
|
29093
28991
|
var centeredX = x - OFFSET;
|
|
29094
28992
|
var centeredY = y - OFFSET;
|
|
29095
28993
|
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);
|
|
29096
|
-
return React.createElement(Container$
|
|
28994
|
+
return React.createElement(Container$e, null, React.createElement(SpriteContainer, {
|
|
29097
28995
|
x: centeredX,
|
|
29098
28996
|
y: centeredY
|
|
29099
28997
|
}, React.createElement(SpriteFromAtlas, {
|
|
@@ -29111,7 +29009,7 @@ var DraggedItem = function DraggedItem(_ref) {
|
|
|
29111
29009
|
}), stackInfo));
|
|
29112
29010
|
};
|
|
29113
29011
|
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";
|
|
29114
|
-
var Container$
|
|
29012
|
+
var Container$e = /*#__PURE__*/styled.div.withConfig({
|
|
29115
29013
|
displayName: "DraggedItem__Container",
|
|
29116
29014
|
componentId: "sc-mlzzcp-0"
|
|
29117
29015
|
})(["position:relative;"]);
|
|
@@ -29127,11 +29025,127 @@ var SpriteContainer = /*#__PURE__*/styled.div.attrs(function (props) {
|
|
|
29127
29025
|
componentId: "sc-mlzzcp-1"
|
|
29128
29026
|
})(["", " 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);
|
|
29129
29027
|
|
|
29028
|
+
var RelativeListMenu = function RelativeListMenu(_ref) {
|
|
29029
|
+
var options = _ref.options,
|
|
29030
|
+
onSelected = _ref.onSelected,
|
|
29031
|
+
onOutsideClick = _ref.onOutsideClick,
|
|
29032
|
+
_ref$fontSize = _ref.fontSize,
|
|
29033
|
+
fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
|
|
29034
|
+
pos = _ref.pos;
|
|
29035
|
+
var ref = useRef(null);
|
|
29036
|
+
useOutsideClick(ref, 'relative-context-menu');
|
|
29037
|
+
useEffect(function () {
|
|
29038
|
+
document.addEventListener('clickOutside', function (event) {
|
|
29039
|
+
var e = event;
|
|
29040
|
+
if (e.detail.id === 'relative-context-menu') {
|
|
29041
|
+
if (onOutsideClick) {
|
|
29042
|
+
onOutsideClick();
|
|
29043
|
+
}
|
|
29044
|
+
}
|
|
29045
|
+
});
|
|
29046
|
+
return function () {
|
|
29047
|
+
document.removeEventListener('clickOutside', function (_e) {});
|
|
29048
|
+
};
|
|
29049
|
+
}, []);
|
|
29050
|
+
return React.createElement(ModalPortal, null, React.createElement(Container$f, Object.assign({
|
|
29051
|
+
fontSize: fontSize,
|
|
29052
|
+
ref: ref
|
|
29053
|
+
}, pos), React.createElement("ul", {
|
|
29054
|
+
className: "rpgui-list-imp",
|
|
29055
|
+
style: {
|
|
29056
|
+
overflow: 'hidden'
|
|
29057
|
+
}
|
|
29058
|
+
}, options.map(function (params, index) {
|
|
29059
|
+
return React.createElement(ListElement$2, {
|
|
29060
|
+
key: (params == null ? void 0 : params.id) || index,
|
|
29061
|
+
onPointerDown: function onPointerDown() {
|
|
29062
|
+
onSelected(params == null ? void 0 : params.id);
|
|
29063
|
+
}
|
|
29064
|
+
}, (params == null ? void 0 : params.text) || 'No text');
|
|
29065
|
+
}))));
|
|
29066
|
+
};
|
|
29067
|
+
var Container$f = /*#__PURE__*/styled.div.withConfig({
|
|
29068
|
+
displayName: "RelativeListMenu__Container",
|
|
29069
|
+
componentId: "sc-7hohf-0"
|
|
29070
|
+
})(["position:absolute;top:", "px;left:", "px;display:flex;flex-direction:column;width:max-content;justify-content:start;align-items:flex-start;li{font-size:", "em;}"], function (props) {
|
|
29071
|
+
return props.y;
|
|
29072
|
+
}, function (props) {
|
|
29073
|
+
return props.x;
|
|
29074
|
+
}, function (props) {
|
|
29075
|
+
return props.fontSize;
|
|
29076
|
+
});
|
|
29077
|
+
var ListElement$2 = /*#__PURE__*/styled.li.withConfig({
|
|
29078
|
+
displayName: "RelativeListMenu__ListElement",
|
|
29079
|
+
componentId: "sc-7hohf-1"
|
|
29080
|
+
})(["margin-right:0.5rem;"]);
|
|
29081
|
+
|
|
29082
|
+
var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
|
|
29083
|
+
var _itemDetails$tooltip, _itemDetails$tooltip2, _itemDetails$contextM, _itemDetails$contextM2;
|
|
29084
|
+
var isFocused = _ref.isFocused,
|
|
29085
|
+
isContextMenuDisabled = _ref.isContextMenuDisabled,
|
|
29086
|
+
dragScale = _ref.dragScale,
|
|
29087
|
+
onSelected = _ref.onSelected,
|
|
29088
|
+
atlasIMG = _ref.atlasIMG,
|
|
29089
|
+
atlasJSON = _ref.atlasJSON,
|
|
29090
|
+
equipmentSet = _ref.equipmentSet;
|
|
29091
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
29092
|
+
itemDetails = _useItemSlotTooltip.itemDetails,
|
|
29093
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails;
|
|
29094
|
+
var item = itemDetails.item;
|
|
29095
|
+
var handleCloseTooltip = function handleCloseTooltip() {
|
|
29096
|
+
updateItemDetails({
|
|
29097
|
+
item: item,
|
|
29098
|
+
tooltip: {
|
|
29099
|
+
mobileVisible: false
|
|
29100
|
+
}
|
|
29101
|
+
});
|
|
29102
|
+
};
|
|
29103
|
+
var handleContextMenuSelect = function handleContextMenuSelect(optionId) {
|
|
29104
|
+
updateItemDetails({
|
|
29105
|
+
item: item,
|
|
29106
|
+
contextMenu: {
|
|
29107
|
+
visible: false
|
|
29108
|
+
}
|
|
29109
|
+
});
|
|
29110
|
+
if (item) {
|
|
29111
|
+
onSelected == null ? void 0 : onSelected(optionId, item);
|
|
29112
|
+
}
|
|
29113
|
+
};
|
|
29114
|
+
var handleOutsideClick = function handleOutsideClick() {
|
|
29115
|
+
updateItemDetails({
|
|
29116
|
+
item: item,
|
|
29117
|
+
contextMenu: {
|
|
29118
|
+
visible: false
|
|
29119
|
+
}
|
|
29120
|
+
});
|
|
29121
|
+
};
|
|
29122
|
+
// monitor why mobileVisible is not working
|
|
29123
|
+
return React.createElement(React.Fragment, null, ((_itemDetails$tooltip = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip.visible) && item && !isFocused && React.createElement(ItemTooltip, {
|
|
29124
|
+
item: item,
|
|
29125
|
+
atlasIMG: atlasIMG,
|
|
29126
|
+
atlasJSON: atlasJSON,
|
|
29127
|
+
equipmentSet: equipmentSet
|
|
29128
|
+
}), ((_itemDetails$tooltip2 = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip2.mobileVisible) && item && React.createElement(MobileItemTooltip, {
|
|
29129
|
+
item: item,
|
|
29130
|
+
atlasIMG: atlasIMG,
|
|
29131
|
+
atlasJSON: atlasJSON,
|
|
29132
|
+
equipmentSet: equipmentSet,
|
|
29133
|
+
closeTooltip: handleCloseTooltip,
|
|
29134
|
+
scale: dragScale,
|
|
29135
|
+
options: ((_itemDetails$contextM = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM.actions) || [],
|
|
29136
|
+
onSelected: handleContextMenuSelect
|
|
29137
|
+
}), !isContextMenuDisabled && ((_itemDetails$contextM2 = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM2.visible) && itemDetails.contextMenu.actions && React.createElement(RelativeListMenu, {
|
|
29138
|
+
options: itemDetails.contextMenu.actions,
|
|
29139
|
+
onSelected: handleContextMenuSelect,
|
|
29140
|
+
onOutsideClick: handleOutsideClick,
|
|
29141
|
+
pos: itemDetails.contextMenu.position
|
|
29142
|
+
}));
|
|
29143
|
+
};
|
|
29144
|
+
|
|
29130
29145
|
var EquipmentSet = function EquipmentSet(_ref) {
|
|
29131
29146
|
var equipmentSet = _ref.equipmentSet,
|
|
29132
29147
|
onClose = _ref.onClose,
|
|
29133
29148
|
_onMouseOver = _ref.onMouseOver,
|
|
29134
|
-
_onSelected = _ref.onSelected,
|
|
29135
29149
|
onItemClick = _ref.onItemClick,
|
|
29136
29150
|
atlasIMG = _ref.atlasIMG,
|
|
29137
29151
|
atlasJSON = _ref.atlasJSON,
|
|
@@ -29140,11 +29154,11 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29140
29154
|
onItemPlaceDrop = _ref.onItemPlaceDrop,
|
|
29141
29155
|
onItemOutsideDrop = _ref.onItemOutsideDrop,
|
|
29142
29156
|
checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
|
|
29143
|
-
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
29144
29157
|
scale = _ref.scale,
|
|
29145
29158
|
initialPosition = _ref.initialPosition,
|
|
29146
29159
|
onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
29147
|
-
onPositionChangeStart = _ref.onPositionChangeStart
|
|
29160
|
+
onPositionChangeStart = _ref.onPositionChangeStart,
|
|
29161
|
+
_onSelected = _ref.onSelected;
|
|
29148
29162
|
var neck = equipmentSet.neck,
|
|
29149
29163
|
leftHand = equipmentSet.leftHand,
|
|
29150
29164
|
ring = equipmentSet.ring,
|
|
@@ -29157,6 +29171,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29157
29171
|
accessory = equipmentSet.accessory;
|
|
29158
29172
|
var equipmentData = [neck, leftHand, ring, head, armor, legs, boot, inventory, rightHand, accessory];
|
|
29159
29173
|
var equipmentMaskSlots = [ItemSlotType.Neck, ItemSlotType.LeftHand, ItemSlotType.Ring, ItemSlotType.Head, ItemSlotType.Torso, ItemSlotType.Legs, ItemSlotType.Feet, ItemSlotType.Inventory, ItemSlotType.RightHand, ItemSlotType.Accessory];
|
|
29174
|
+
var _useItemSlotDragging = useItemSlotDragging(),
|
|
29175
|
+
dragState = _useItemSlotDragging.dragState;
|
|
29176
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
29177
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails;
|
|
29160
29178
|
var onRenderEquipmentSlotRange = function onRenderEquipmentSlotRange(start, end) {
|
|
29161
29179
|
var equipmentRange = equipmentData.slice(start, end);
|
|
29162
29180
|
var slotMaksRange = equipmentMaskSlots.slice(start, end);
|
|
@@ -29177,9 +29195,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29177
29195
|
onPointerDown: function onPointerDown(itemType, ContainerType) {
|
|
29178
29196
|
if (onItemClick) onItemClick(itemType, item, ContainerType);
|
|
29179
29197
|
},
|
|
29180
|
-
onSelected: function onSelected(optionId) {
|
|
29181
|
-
if (_onSelected) _onSelected(optionId);
|
|
29182
|
-
},
|
|
29183
29198
|
onDragStart: function onDragStart(item, slotIndex, itemContainerType) {
|
|
29184
29199
|
if (!item) {
|
|
29185
29200
|
return;
|
|
@@ -29191,7 +29206,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29191
29206
|
},
|
|
29192
29207
|
dragScale: scale,
|
|
29193
29208
|
checkIfItemCanBeMoved: checkIfItemCanBeMoved,
|
|
29194
|
-
checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
|
|
29195
29209
|
onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
|
|
29196
29210
|
if (onItemPlaceDrop) onItemPlaceDrop(item, slotIndex, itemContainerType);
|
|
29197
29211
|
},
|
|
@@ -29203,7 +29217,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29203
29217
|
});
|
|
29204
29218
|
});
|
|
29205
29219
|
};
|
|
29206
|
-
return React.createElement(
|
|
29220
|
+
return React.createElement(ItemSlotDraggingProvider, null, React.createElement(ItemSlotTooltipProvider, null, React.createElement(DraggedItem, {
|
|
29207
29221
|
atlasIMG: atlasIMG,
|
|
29208
29222
|
atlasJSON: atlasJSON,
|
|
29209
29223
|
scale: scale
|
|
@@ -29221,7 +29235,23 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
29221
29235
|
onPositionChangeStart: onPositionChangeStart
|
|
29222
29236
|
}, React.createElement(EquipmentSetContainer, {
|
|
29223
29237
|
className: "equipment-container-body"
|
|
29224
|
-
}, React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10))))
|
|
29238
|
+
}, React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10)))), React.createElement(ItemSlotToolTips, {
|
|
29239
|
+
isFocused: dragState.isFocused,
|
|
29240
|
+
isContextMenuDisabled: isMobile(),
|
|
29241
|
+
dragScale: scale,
|
|
29242
|
+
onSelected: function onSelected(optionId, item) {
|
|
29243
|
+
updateItemDetails({
|
|
29244
|
+
item: item,
|
|
29245
|
+
contextMenu: {
|
|
29246
|
+
visible: false
|
|
29247
|
+
}
|
|
29248
|
+
});
|
|
29249
|
+
if (_onSelected) _onSelected(optionId);
|
|
29250
|
+
},
|
|
29251
|
+
atlasIMG: atlasIMG,
|
|
29252
|
+
atlasJSON: atlasJSON,
|
|
29253
|
+
equipmentSet: equipmentSet
|
|
29254
|
+
})));
|
|
29225
29255
|
};
|
|
29226
29256
|
var EquipmentSetContainer = /*#__PURE__*/styled.div.withConfig({
|
|
29227
29257
|
displayName: "EquipmentSet__EquipmentSetContainer",
|
|
@@ -30702,14 +30732,12 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30702
30732
|
document.removeEventListener('pointermove', handleMouseMove);
|
|
30703
30733
|
}, [handleMouseMove, onItemDragStart, stopScrolling]);
|
|
30704
30734
|
var onDragStart = function onDragStart(item, slotIndex, itemContainerType) {
|
|
30705
|
-
console.log('DRAG START');
|
|
30706
30735
|
if (onItemDragStart) {
|
|
30707
30736
|
onItemDragStart(item, slotIndex, itemContainerType);
|
|
30708
30737
|
}
|
|
30709
30738
|
onDragStartScrollingEvents();
|
|
30710
30739
|
};
|
|
30711
30740
|
var onDragEnd = function onDragEnd(quantity) {
|
|
30712
|
-
console.log('DRAG END');
|
|
30713
30741
|
if (onItemDragEnd) {
|
|
30714
30742
|
onItemDragEnd(quantity);
|
|
30715
30743
|
}
|
|
@@ -30736,9 +30764,6 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30736
30764
|
onItemClick(item, itemType, containerType);
|
|
30737
30765
|
}
|
|
30738
30766
|
},
|
|
30739
|
-
onSelected: function onSelected(optionId, item) {
|
|
30740
|
-
if (_onSelected) _onSelected(optionId, item);
|
|
30741
|
-
},
|
|
30742
30767
|
onDragStart: onDragStart,
|
|
30743
30768
|
onDragEnd: onDragEnd,
|
|
30744
30769
|
dragScale: scale,
|
|
@@ -30767,14 +30792,17 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30767
30792
|
atlasIMG: atlasIMG,
|
|
30768
30793
|
atlasJSON: atlasJSON,
|
|
30769
30794
|
isSelectingShortcut: settingShortcutIndex !== -1,
|
|
30770
|
-
equipmentSet: equipmentSet,
|
|
30771
30795
|
setItemShortcut: type === ItemContainerType.Inventory ? handleSetShortcut : undefined,
|
|
30772
30796
|
isDepotSystem: isDepotSystem
|
|
30773
30797
|
}));
|
|
30774
30798
|
}
|
|
30775
30799
|
return slots;
|
|
30776
30800
|
};
|
|
30777
|
-
|
|
30801
|
+
var _useItemSlotTooltip = useItemSlotTooltip(),
|
|
30802
|
+
updateItemDetails = _useItemSlotTooltip.updateItemDetails;
|
|
30803
|
+
var _useItemSlotDragging = useItemSlotDragging(),
|
|
30804
|
+
dragState = _useItemSlotDragging.dragState;
|
|
30805
|
+
return React.createElement(ItemSlotDraggingProvider, null, React.createElement(ItemSlotTooltipProvider, null, React.createElement(DraggedItem, {
|
|
30778
30806
|
atlasIMG: atlasIMG,
|
|
30779
30807
|
atlasJSON: atlasJSON,
|
|
30780
30808
|
scale: scale
|
|
@@ -30799,10 +30827,26 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
30799
30827
|
ref: containerRef,
|
|
30800
30828
|
isScrollable: itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL,
|
|
30801
30829
|
isFullScreen: isFullScreen
|
|
30802
|
-
}, onRenderSlots())),
|
|
30830
|
+
}, onRenderSlots())), React.createElement(ItemSlotToolTips, {
|
|
30831
|
+
isFocused: dragState.isFocused,
|
|
30832
|
+
isContextMenuDisabled: disableContextMenu,
|
|
30833
|
+
dragScale: scale,
|
|
30834
|
+
onSelected: function onSelected(optionId, item) {
|
|
30835
|
+
updateItemDetails({
|
|
30836
|
+
item: item,
|
|
30837
|
+
contextMenu: {
|
|
30838
|
+
visible: false
|
|
30839
|
+
}
|
|
30840
|
+
});
|
|
30841
|
+
if (_onSelected) _onSelected(optionId, item);
|
|
30842
|
+
},
|
|
30843
|
+
atlasIMG: atlasIMG,
|
|
30844
|
+
atlasJSON: atlasJSON,
|
|
30845
|
+
equipmentSet: equipmentSet
|
|
30846
|
+
}), quantitySelect.isOpen && React.createElement(ItemQuantitySelectorModal, {
|
|
30803
30847
|
quantitySelect: quantitySelect,
|
|
30804
30848
|
setQuantitySelect: setQuantitySelect
|
|
30805
|
-
}));
|
|
30849
|
+
})));
|
|
30806
30850
|
};
|
|
30807
30851
|
var ItemsContainer = /*#__PURE__*/styled.div.withConfig({
|
|
30808
30852
|
displayName: "ItemContainer__ItemsContainer",
|