@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.
@@ -33654,6 +33654,7 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
33654
33654
  dragScale = _ref.dragScale,
33655
33655
  isSelectingShortcut = _ref.isSelectingShortcut,
33656
33656
  equipmentSet = _ref.equipmentSet,
33657
+ setItemShortcut = _ref.setItemShortcut,
33657
33658
  isDepotSystem = _ref.isDepotSystem;
33658
33659
  var _useState = useState(false),
33659
33660
  isTooltipVisible = _useState[0],
@@ -33839,6 +33840,13 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
33839
33840
  defaultClassName: item ? 'draggable' : 'empty-slot',
33840
33841
  scale: dragScale,
33841
33842
  onStop: function onStop(e, data) {
33843
+ var target = e.target;
33844
+ if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
33845
+ var index = parseInt(target.id.split('_')[1]);
33846
+ if (!isNaN(index)) {
33847
+ setItemShortcut(item, index);
33848
+ }
33849
+ }
33842
33850
  if (wasDragged && item && !isSelectingShortcut) {
33843
33851
  var _e$target;
33844
33852
  //@ts-ignore
@@ -33853,9 +33861,9 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
33853
33861
  });
33854
33862
  }
33855
33863
  setWasDragged(false);
33856
- var target = dragContainer.current;
33857
- if (!target || !wasDragged) return;
33858
- var style = window.getComputedStyle(target);
33864
+ var _target = dragContainer.current;
33865
+ if (!_target || !wasDragged) return;
33866
+ var style = window.getComputedStyle(_target);
33859
33867
  var matrix = new DOMMatrixReadOnly(style.transform);
33860
33868
  var x = matrix.m41;
33861
33869
  var y = matrix.m42;
@@ -35381,11 +35389,13 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
35381
35389
  return React.createElement(Shortcut, {
35382
35390
  key: i,
35383
35391
  onPointerDown: function onPointerDown() {
35392
+ if (settingShortcutIndex !== -1) setSettingShortcutIndex(-1);
35384
35393
  removeShortcut(i);
35385
- if (!shortcuts[i] || shortcuts[i].type === ShortcutType.None) setSettingShortcutIndex(i);
35394
+ if (settingShortcutIndex === -1 && (!shortcuts[i] || shortcuts[i].type === ShortcutType.None)) setSettingShortcutIndex(i);
35386
35395
  },
35387
35396
  disabled: settingShortcutIndex !== -1 && settingShortcutIndex !== i,
35388
- isBeingSet: settingShortcutIndex === i
35397
+ isBeingSet: settingShortcutIndex === i,
35398
+ id: "shortcutSetter_" + i
35389
35399
  }, getContent(i));
35390
35400
  })));
35391
35401
  };
@@ -35441,6 +35451,11 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35441
35451
  var _useState2 = useState(-1),
35442
35452
  settingShortcutIndex = _useState2[0],
35443
35453
  setSettingShortcutIndex = _useState2[1];
35454
+ var handleSetShortcut = function handleSetShortcut(item, index) {
35455
+ if (item.type === ItemType.Consumable || item.type === ItemType.Tool) {
35456
+ setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
35457
+ }
35458
+ };
35444
35459
  var onRenderSlots = function onRenderSlots() {
35445
35460
  var slots = [];
35446
35461
  for (var i = 0; i < itemContainer.slotQty; i++) {
@@ -35457,9 +35472,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35457
35472
  onPointerDown: function onPointerDown(itemType, containerType, item) {
35458
35473
  if (settingShortcutIndex !== -1) {
35459
35474
  setSettingShortcutIndex(-1);
35460
- if (itemType === ItemType.Consumable || itemType === ItemType.Tool) {
35461
- setItemShortcut == null ? void 0 : setItemShortcut(item.key, settingShortcutIndex);
35462
- }
35475
+ handleSetShortcut(item, settingShortcutIndex);
35463
35476
  } else if (onItemClick) onItemClick(item, itemType, containerType);
35464
35477
  },
35465
35478
  onSelected: function onSelected(optionId, item) {
@@ -35491,6 +35504,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35491
35504
  atlasJSON: atlasJSON,
35492
35505
  isSelectingShortcut: settingShortcutIndex !== -1,
35493
35506
  equipmentSet: equipmentSet,
35507
+ setItemShortcut: type === ItemContainerType.Inventory ? handleSetShortcut : undefined,
35494
35508
  isDepotSystem: isDepotSystem
35495
35509
  }));
35496
35510
  }