@rpg-engine/long-bow 0.3.88 → 0.3.89
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 +1 -0
- package/dist/long-bow.cjs.development.js +22 -8
- 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 +22 -8
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemContainer.tsx +10 -6
- package/src/components/Item/Inventory/ItemSlot.tsx +14 -0
- package/src/components/Shortcuts/ShortcutsSetter.tsx +7 -1
|
@@ -25,6 +25,7 @@ interface IProps {
|
|
|
25
25
|
isContextMenuDisabled?: boolean;
|
|
26
26
|
isSelectingShortcut?: boolean;
|
|
27
27
|
equipmentSet?: IEquipmentSet | null;
|
|
28
|
+
setItemShortcut?: (item: IItem, shortcutIndex: number) => void;
|
|
28
29
|
isDepotSystem?: boolean;
|
|
29
30
|
}
|
|
30
31
|
export declare const ItemSlot: React.FC<IProps>;
|
|
@@ -33659,6 +33659,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
33659
33659
|
dragScale = _ref.dragScale,
|
|
33660
33660
|
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
33661
33661
|
equipmentSet = _ref.equipmentSet,
|
|
33662
|
+
setItemShortcut = _ref.setItemShortcut,
|
|
33662
33663
|
isDepotSystem = _ref.isDepotSystem;
|
|
33663
33664
|
var _useState = React.useState(false),
|
|
33664
33665
|
isTooltipVisible = _useState[0],
|
|
@@ -33844,6 +33845,13 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
33844
33845
|
defaultClassName: item ? 'draggable' : 'empty-slot',
|
|
33845
33846
|
scale: dragScale,
|
|
33846
33847
|
onStop: function onStop(e, data) {
|
|
33848
|
+
var target = e.target;
|
|
33849
|
+
if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
|
|
33850
|
+
var index = parseInt(target.id.split('_')[1]);
|
|
33851
|
+
if (!isNaN(index)) {
|
|
33852
|
+
setItemShortcut(item, index);
|
|
33853
|
+
}
|
|
33854
|
+
}
|
|
33847
33855
|
if (wasDragged && item && !isSelectingShortcut) {
|
|
33848
33856
|
var _e$target;
|
|
33849
33857
|
//@ts-ignore
|
|
@@ -33858,9 +33866,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
|
|
|
33858
33866
|
});
|
|
33859
33867
|
}
|
|
33860
33868
|
setWasDragged(false);
|
|
33861
|
-
var
|
|
33862
|
-
if (!
|
|
33863
|
-
var style = window.getComputedStyle(
|
|
33869
|
+
var _target = dragContainer.current;
|
|
33870
|
+
if (!_target || !wasDragged) return;
|
|
33871
|
+
var style = window.getComputedStyle(_target);
|
|
33864
33872
|
var matrix = new DOMMatrixReadOnly(style.transform);
|
|
33865
33873
|
var x = matrix.m41;
|
|
33866
33874
|
var y = matrix.m42;
|
|
@@ -35383,11 +35391,13 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
|
|
|
35383
35391
|
return React__default.createElement(Shortcut, {
|
|
35384
35392
|
key: i,
|
|
35385
35393
|
onPointerDown: function onPointerDown() {
|
|
35394
|
+
if (settingShortcutIndex !== -1) setSettingShortcutIndex(-1);
|
|
35386
35395
|
removeShortcut(i);
|
|
35387
|
-
if (!shortcuts[i] || shortcuts[i].type === shared.ShortcutType.None) setSettingShortcutIndex(i);
|
|
35396
|
+
if (settingShortcutIndex === -1 && (!shortcuts[i] || shortcuts[i].type === shared.ShortcutType.None)) setSettingShortcutIndex(i);
|
|
35388
35397
|
},
|
|
35389
35398
|
disabled: settingShortcutIndex !== -1 && settingShortcutIndex !== i,
|
|
35390
|
-
isBeingSet: settingShortcutIndex === i
|
|
35399
|
+
isBeingSet: settingShortcutIndex === i,
|
|
35400
|
+
id: "shortcutSetter_" + i
|
|
35391
35401
|
}, getContent(i));
|
|
35392
35402
|
})));
|
|
35393
35403
|
};
|
|
@@ -35443,6 +35453,11 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
35443
35453
|
var _useState2 = React.useState(-1),
|
|
35444
35454
|
settingShortcutIndex = _useState2[0],
|
|
35445
35455
|
setSettingShortcutIndex = _useState2[1];
|
|
35456
|
+
var handleSetShortcut = function handleSetShortcut(item, index) {
|
|
35457
|
+
if (item.type === shared.ItemType.Consumable || item.type === shared.ItemType.Tool) {
|
|
35458
|
+
setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
|
|
35459
|
+
}
|
|
35460
|
+
};
|
|
35446
35461
|
var onRenderSlots = function onRenderSlots() {
|
|
35447
35462
|
var slots = [];
|
|
35448
35463
|
for (var i = 0; i < itemContainer.slotQty; i++) {
|
|
@@ -35459,9 +35474,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
35459
35474
|
onPointerDown: function onPointerDown(itemType, containerType, item) {
|
|
35460
35475
|
if (settingShortcutIndex !== -1) {
|
|
35461
35476
|
setSettingShortcutIndex(-1);
|
|
35462
|
-
|
|
35463
|
-
setItemShortcut == null ? void 0 : setItemShortcut(item.key, settingShortcutIndex);
|
|
35464
|
-
}
|
|
35477
|
+
handleSetShortcut(item, settingShortcutIndex);
|
|
35465
35478
|
} else if (onItemClick) onItemClick(item, itemType, containerType);
|
|
35466
35479
|
},
|
|
35467
35480
|
onSelected: function onSelected(optionId, item) {
|
|
@@ -35493,6 +35506,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
35493
35506
|
atlasJSON: atlasJSON,
|
|
35494
35507
|
isSelectingShortcut: settingShortcutIndex !== -1,
|
|
35495
35508
|
equipmentSet: equipmentSet,
|
|
35509
|
+
setItemShortcut: type === shared.ItemContainerType.Inventory ? handleSetShortcut : undefined,
|
|
35496
35510
|
isDepotSystem: isDepotSystem
|
|
35497
35511
|
}));
|
|
35498
35512
|
}
|