@rpg-engine/long-bow 0.2.96 → 0.2.97

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.
@@ -10,6 +10,7 @@ export interface IEquipmentSetProps {
10
10
  onItemPlaceDrop?: (item: IItem | null, slotIndex: number, itemContainerType: ItemContainerType | null) => void;
11
11
  onItemOutsideDrop?: (item: IItem, position: IPosition) => void;
12
12
  checkIfItemCanBeMoved: () => boolean;
13
+ checkIfItemShouldDragEnd?: () => boolean;
13
14
  onMouseOver?: (e: any, slotIndex: number, item: IItem | null) => void;
14
15
  onSelected?: (optionId: string) => void;
15
16
  initialPosition?: {
@@ -10,6 +10,7 @@ export interface IItemContainerProps {
10
10
  onOutsideDrop?: (item: IItem, position: IPosition) => void;
11
11
  onItemPlaceDrop?: (item: IItem | null, slotIndex: number, itemContainerType: ItemContainerType | null) => void;
12
12
  checkIfItemCanBeMoved: () => boolean;
13
+ checkIfItemShouldDragEnd?: () => boolean;
13
14
  onMouseOver?: (e: any, slotIndex: number, item: IItem | null) => void;
14
15
  onSelected?: (optionId: string, item: IItem) => void;
15
16
  type: ItemContainerType;
@@ -15,6 +15,7 @@ interface IProps {
15
15
  onDragEnd: (quantity?: number) => void;
16
16
  onOutsideDrop?: (item: IItem, position: IPosition) => void;
17
17
  checkIfItemCanBeMoved: () => boolean;
18
+ checkIfItemShouldDragEnd?: () => boolean;
18
19
  openQuantitySelector?: (maxQuantity: number, callback: () => void) => void;
19
20
  onPlaceDrop: (item: IItem | null, slotIndex: number, itemContainerType: ItemContainerType | null) => void;
20
21
  atlasJSON: any;
@@ -33484,7 +33484,8 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33484
33484
  onPlaceDrop = _ref.onPlaceDrop,
33485
33485
  onDrop = _ref.onOutsideDrop,
33486
33486
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
33487
- openQuantitySelector = _ref.openQuantitySelector;
33487
+ openQuantitySelector = _ref.openQuantitySelector,
33488
+ checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd;
33488
33489
  var _useState = React.useState(false),
33489
33490
  isTooltipVisible = _useState[0],
33490
33491
  setTooltipVisible = _useState[1];
@@ -33515,6 +33516,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33515
33516
  x: 0,
33516
33517
  y: 0
33517
33518
  });
33519
+ setIsFocused(false);
33518
33520
  if (item) {
33519
33521
  setContextActions(generateContextMenu(item, containerType));
33520
33522
  }
@@ -33615,7 +33617,6 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33615
33617
  };
33616
33618
  var resetItem = function resetItem() {
33617
33619
  setTooltipVisible(false);
33618
- setIsFocused(false);
33619
33620
  setWasDragged(false);
33620
33621
  };
33621
33622
  var onSuccesfulDrag = function onSuccesfulDrag(quantity) {
@@ -33675,9 +33676,11 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33675
33676
  });
33676
33677
  setTimeout(function () {
33677
33678
  if (checkIfItemCanBeMoved()) {
33679
+ if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd()) return;
33678
33680
  if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) openQuantitySelector(item.stackQty, onSuccesfulDrag);else onSuccesfulDrag(item.stackQty);
33679
33681
  } else {
33680
33682
  resetItem();
33683
+ setIsFocused(false);
33681
33684
  setDragPosition({
33682
33685
  x: 0,
33683
33686
  y: 0
@@ -33718,7 +33721,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33718
33721
  onMouseLeave: function onMouseLeave() {
33719
33722
  setTooltipVisible(false);
33720
33723
  }
33721
- }, onRenderSlot(item))), isTooltipVisible && item && React__default.createElement(ItemTooltip, {
33724
+ }, onRenderSlot(item))), isTooltipVisible && item && !isFocused && React__default.createElement(ItemTooltip, {
33722
33725
  label: item.name
33723
33726
  }), !isContextMenuDisabled && isContextMenuVisible && contextActions && React__default.createElement(RelativeListMenu, {
33724
33727
  options: contextActions,
@@ -33764,7 +33767,8 @@ var EquipmentSet = function EquipmentSet(_ref) {
33764
33767
  onItemDragStart = _ref.onItemDragStart,
33765
33768
  onItemPlaceDrop = _ref.onItemPlaceDrop,
33766
33769
  onItemOutsideDrop = _ref.onItemOutsideDrop,
33767
- checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved;
33770
+ checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
33771
+ checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd;
33768
33772
  var neck = equipmentSet.neck,
33769
33773
  leftHand = equipmentSet.leftHand,
33770
33774
  ring = equipmentSet.ring,
@@ -33810,6 +33814,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
33810
33814
  if (onItemDragEnd) onItemDragEnd(quantity);
33811
33815
  },
33812
33816
  checkIfItemCanBeMoved: checkIfItemCanBeMoved,
33817
+ checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
33813
33818
  onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
33814
33819
  if (onItemPlaceDrop) onItemPlaceDrop(item, slotIndex, itemContainerType);
33815
33820
  },
@@ -34585,7 +34590,8 @@ var ItemContainer$1 = function ItemContainer(_ref) {
34585
34590
  onItemPlaceDrop = _ref.onItemPlaceDrop,
34586
34591
  _onOutsideDrop = _ref.onOutsideDrop,
34587
34592
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
34588
- initialPosition = _ref.initialPosition;
34593
+ initialPosition = _ref.initialPosition,
34594
+ checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd;
34589
34595
  var _useState = React.useState({
34590
34596
  isOpen: false,
34591
34597
  maxQuantity: 1,
@@ -34619,6 +34625,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
34619
34625
  if (onItemDragEnd) onItemDragEnd(quantity);
34620
34626
  },
34621
34627
  checkIfItemCanBeMoved: checkIfItemCanBeMoved,
34628
+ checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
34622
34629
  openQuantitySelector: function openQuantitySelector(maxQuantity, callback) {
34623
34630
  setQuantitySelect({
34624
34631
  isOpen: true,