@rpg-engine/long-bow 0.8.9 → 0.8.10
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/long-bow.cjs.development.js +61 -52
- 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 +61 -52
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Item/Inventory/ItemContainer.tsx +101 -83
|
@@ -31181,7 +31181,7 @@ var ItemContainer$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
31181
31181
|
onItemDragEnd = _ref.onItemDragEnd,
|
|
31182
31182
|
onItemDragStart = _ref.onItemDragStart,
|
|
31183
31183
|
onItemPlaceDrop = _ref.onItemPlaceDrop,
|
|
31184
|
-
|
|
31184
|
+
onOutsideDrop = _ref.onOutsideDrop,
|
|
31185
31185
|
checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
|
|
31186
31186
|
initialPosition = _ref.initialPosition,
|
|
31187
31187
|
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
@@ -31246,12 +31246,49 @@ var ItemContainer$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
31246
31246
|
}
|
|
31247
31247
|
onDragEndScrollingEvents();
|
|
31248
31248
|
}, [onItemDragEnd, onDragEndScrollingEvents]);
|
|
31249
|
-
|
|
31250
|
-
|
|
31251
|
-
|
|
31252
|
-
|
|
31253
|
-
|
|
31254
|
-
|
|
31249
|
+
var handleItemClick = React.useCallback(function (itemType, containerType, item) {
|
|
31250
|
+
if (settingShortcutIndex !== -1) {
|
|
31251
|
+
setSettingShortcutIndex(-1);
|
|
31252
|
+
handleSetShortcut(item, settingShortcutIndex);
|
|
31253
|
+
} else if (onItemClick) {
|
|
31254
|
+
onItemClick(item, itemType, containerType);
|
|
31255
|
+
}
|
|
31256
|
+
}, [settingShortcutIndex, handleSetShortcut, onItemClick]);
|
|
31257
|
+
var handlePlaceDrop = React.useCallback(function (item, slotIndex, itemContainerType) {
|
|
31258
|
+
if (onItemPlaceDrop) {
|
|
31259
|
+
onItemPlaceDrop(item, slotIndex, itemContainerType);
|
|
31260
|
+
}
|
|
31261
|
+
onDragEndScrollingEvents();
|
|
31262
|
+
}, [onItemPlaceDrop, onDragEndScrollingEvents]);
|
|
31263
|
+
var handleOutsideDrop = React.useCallback(function (item, position) {
|
|
31264
|
+
if (onOutsideDrop) {
|
|
31265
|
+
onOutsideDrop(item, position);
|
|
31266
|
+
}
|
|
31267
|
+
onDragEndScrollingEvents();
|
|
31268
|
+
}, [onOutsideDrop, onDragEndScrollingEvents]);
|
|
31269
|
+
var handleQuantitySelect = React.useCallback(function (maxQuantity, callback) {
|
|
31270
|
+
setQuantitySelect({
|
|
31271
|
+
isOpen: true,
|
|
31272
|
+
maxQuantity: maxQuantity,
|
|
31273
|
+
callback: callback
|
|
31274
|
+
});
|
|
31275
|
+
}, []);
|
|
31276
|
+
// Memoize slot rendering configuration
|
|
31277
|
+
var slotConfig = React.useMemo(function () {
|
|
31278
|
+
return {
|
|
31279
|
+
type: type,
|
|
31280
|
+
atlasIMG: atlasIMG,
|
|
31281
|
+
atlasJSON: atlasJSON,
|
|
31282
|
+
scale: scale,
|
|
31283
|
+
equipmentSet: equipmentSet,
|
|
31284
|
+
isDepotSystem: isDepotSystem,
|
|
31285
|
+
isSelectingShortcut: settingShortcutIndex !== -1,
|
|
31286
|
+
checkIfItemCanBeMoved: checkIfItemCanBeMoved,
|
|
31287
|
+
checkIfItemShouldDragEnd: checkIfItemShouldDragEnd
|
|
31288
|
+
};
|
|
31289
|
+
}, [type, atlasIMG, atlasJSON, scale, equipmentSet, isDepotSystem, settingShortcutIndex, checkIfItemCanBeMoved, checkIfItemShouldDragEnd]);
|
|
31290
|
+
// Memoize slots rendering
|
|
31291
|
+
var renderSlots = React.useMemo(function () {
|
|
31255
31292
|
var slots = [];
|
|
31256
31293
|
for (var i = 0; i < itemContainer.slotQty; i++) {
|
|
31257
31294
|
var _itemContainer$slots;
|
|
@@ -31260,55 +31297,27 @@ var ItemContainer$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
31260
31297
|
key: i,
|
|
31261
31298
|
slotIndex: i,
|
|
31262
31299
|
item: currentItem,
|
|
31263
|
-
itemContainerType: type,
|
|
31264
|
-
onMouseOver: onMouseOver
|
|
31265
|
-
|
|
31266
|
-
} : undefined,
|
|
31267
|
-
onMouseOut: undefined,
|
|
31268
|
-
onPointerDown: function onPointerDown(itemType, containerType, item) {
|
|
31269
|
-
if (settingShortcutIndex !== -1) {
|
|
31270
|
-
setSettingShortcutIndex(-1);
|
|
31271
|
-
memoizedHandleSetShortcut(item, settingShortcutIndex);
|
|
31272
|
-
} else if (onItemClick) {
|
|
31273
|
-
onItemClick(item, itemType, containerType);
|
|
31274
|
-
}
|
|
31275
|
-
},
|
|
31300
|
+
itemContainerType: slotConfig.type,
|
|
31301
|
+
onMouseOver: onMouseOver,
|
|
31302
|
+
onPointerDown: handleItemClick,
|
|
31276
31303
|
onDragStart: onDragStartHandler,
|
|
31277
31304
|
onDragEnd: onDragEndHandler,
|
|
31278
|
-
dragScale: scale,
|
|
31279
|
-
checkIfItemCanBeMoved: checkIfItemCanBeMoved,
|
|
31280
|
-
checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
|
|
31281
|
-
openQuantitySelector:
|
|
31282
|
-
|
|
31283
|
-
|
|
31284
|
-
|
|
31285
|
-
|
|
31286
|
-
|
|
31287
|
-
|
|
31288
|
-
|
|
31289
|
-
|
|
31290
|
-
onItemPlaceDrop(item, slotIndex, itemContainerType);
|
|
31291
|
-
}
|
|
31292
|
-
console.log('PLACE DROP');
|
|
31293
|
-
onDragEndScrollingEvents();
|
|
31294
|
-
},
|
|
31295
|
-
onOutsideDrop: function onOutsideDrop(item, position) {
|
|
31296
|
-
if (_onOutsideDrop) {
|
|
31297
|
-
_onOutsideDrop(item, position);
|
|
31298
|
-
}
|
|
31299
|
-
console.log('OUTSIDE DROP');
|
|
31300
|
-
onDragEndScrollingEvents();
|
|
31301
|
-
},
|
|
31302
|
-
atlasIMG: atlasIMG,
|
|
31303
|
-
atlasJSON: atlasJSON,
|
|
31304
|
-
isSelectingShortcut: settingShortcutIndex !== -1,
|
|
31305
|
-
equipmentSet: equipmentSet,
|
|
31306
|
-
setItemShortcut: type === shared.ItemContainerType.Inventory ? memoizedHandleSetShortcut : undefined,
|
|
31307
|
-
isDepotSystem: isDepotSystem
|
|
31305
|
+
dragScale: slotConfig.scale,
|
|
31306
|
+
checkIfItemCanBeMoved: slotConfig.checkIfItemCanBeMoved,
|
|
31307
|
+
checkIfItemShouldDragEnd: slotConfig.checkIfItemShouldDragEnd,
|
|
31308
|
+
openQuantitySelector: handleQuantitySelect,
|
|
31309
|
+
onPlaceDrop: handlePlaceDrop,
|
|
31310
|
+
onOutsideDrop: handleOutsideDrop,
|
|
31311
|
+
atlasIMG: slotConfig.atlasIMG,
|
|
31312
|
+
atlasJSON: slotConfig.atlasJSON,
|
|
31313
|
+
isSelectingShortcut: slotConfig.isSelectingShortcut,
|
|
31314
|
+
equipmentSet: slotConfig.equipmentSet,
|
|
31315
|
+
setItemShortcut: type === shared.ItemContainerType.Inventory ? handleSetShortcut : undefined,
|
|
31316
|
+
isDepotSystem: slotConfig.isDepotSystem
|
|
31308
31317
|
}));
|
|
31309
31318
|
}
|
|
31310
31319
|
return slots;
|
|
31311
|
-
}, [itemContainer.slotQty, itemContainer.slots,
|
|
31320
|
+
}, [itemContainer.slotQty, itemContainer.slots, slotConfig, onMouseOver, handleItemClick, onDragStartHandler, onDragEndHandler, handleQuantitySelect, handlePlaceDrop, handleOutsideDrop, handleSetShortcut, type]);
|
|
31312
31321
|
return React__default.createElement(ItemSlotDraggingProvider, null, React__default.createElement(ItemSlotDetailsProvider, null, React__default.createElement(DraggedItem, {
|
|
31313
31322
|
atlasIMG: atlasIMG,
|
|
31314
31323
|
atlasJSON: atlasJSON,
|
|
@@ -31334,7 +31343,7 @@ var ItemContainer$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
31334
31343
|
ref: containerRef,
|
|
31335
31344
|
isScrollable: itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL,
|
|
31336
31345
|
isFullScreen: isFullScreen
|
|
31337
|
-
},
|
|
31346
|
+
}, renderSlots)), quantitySelect.isOpen && React__default.createElement(ItemQuantitySelectorModal, {
|
|
31338
31347
|
quantitySelect: quantitySelect,
|
|
31339
31348
|
setQuantitySelect: setQuantitySelect
|
|
31340
31349
|
}), React__default.createElement(ItemSlotToolTips, {
|