@rpg-engine/long-bow 0.2.89 → 0.2.91

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.
@@ -33477,6 +33477,7 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
33477
33477
  onDragEnd = _ref.onDragEnd,
33478
33478
  onDragStart = _ref.onDragStart,
33479
33479
  onPlaceDrop = _ref.onPlaceDrop,
33480
+ onDrop = _ref.onOutsideDrop,
33480
33481
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
33481
33482
  openQuantitySelector = _ref.openQuantitySelector;
33482
33483
  var _useState = useState(false),
@@ -33497,10 +33498,13 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
33497
33498
  }),
33498
33499
  dragPosition = _useState5[0],
33499
33500
  setDragPosition = _useState5[1];
33501
+ var _useState6 = useState(null),
33502
+ dropPosition = _useState6[0],
33503
+ setDropPosition = _useState6[1];
33500
33504
  var dragContainer = useRef(null);
33501
- var _useState6 = useState([]),
33502
- contextActions = _useState6[0],
33503
- setContextActions = _useState6[1];
33505
+ var _useState7 = useState([]),
33506
+ contextActions = _useState7[0],
33507
+ setContextActions = _useState7[1];
33504
33508
  useEffect(function () {
33505
33509
  setDragPosition({
33506
33510
  x: 0,
@@ -33510,6 +33514,11 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
33510
33514
  setContextActions(generateContextMenu(item, containerType));
33511
33515
  }
33512
33516
  }, [item]);
33517
+ useEffect(function () {
33518
+ if (onDrop && item && dropPosition) {
33519
+ onDrop(item, dropPosition);
33520
+ }
33521
+ }, [dropPosition]);
33513
33522
  var getStackInfo = function getStackInfo(itemId, stackQty) {
33514
33523
  // if (itemToRender?.isStackable && itemToRender?.stackQty) {
33515
33524
  var isFractionalStackQty = stackQty % 1 !== 0;
@@ -33632,11 +33641,21 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
33632
33641
  }
33633
33642
  }, React.createElement(Draggable, {
33634
33643
  defaultClassName: item ? 'draggable' : 'empty-slot',
33635
- onStop: function onStop() {
33636
- if (!item) {
33637
- return;
33638
- }
33639
- if (wasDragged) {
33644
+ onStop: function onStop(e, data) {
33645
+ if (wasDragged && item) {
33646
+ var _e$target;
33647
+ //@ts-ignore
33648
+ var classes = Array.from((_e$target = e.target) == null ? void 0 : _e$target.classList);
33649
+ var isOutsideDrop = classes.some(function (elm) {
33650
+ //elm matches ItemContainer string
33651
+ return elm.includes('rpgui-content');
33652
+ });
33653
+ if (isOutsideDrop) {
33654
+ setDropPosition({
33655
+ x: data.x,
33656
+ y: data.y
33657
+ });
33658
+ }
33640
33659
  setWasDragged(false);
33641
33660
  var target = dragContainer.current;
33642
33661
  if (!target || !wasDragged) return;
@@ -33738,6 +33757,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
33738
33757
  onItemDragEnd = _ref.onItemDragEnd,
33739
33758
  onItemDragStart = _ref.onItemDragStart,
33740
33759
  onItemPlaceDrop = _ref.onItemPlaceDrop,
33760
+ onItemOutsideDrop = _ref.onItemOutsideDrop,
33741
33761
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved;
33742
33762
  var neck = equipmentSet.neck,
33743
33763
  leftHand = equipmentSet.leftHand,
@@ -33787,6 +33807,9 @@ var EquipmentSet = function EquipmentSet(_ref) {
33787
33807
  onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
33788
33808
  if (onItemPlaceDrop) onItemPlaceDrop(item, slotIndex, itemContainerType);
33789
33809
  },
33810
+ onOutsideDrop: function onOutsideDrop(item, position) {
33811
+ if (onItemOutsideDrop) onItemOutsideDrop(item, position);
33812
+ },
33790
33813
  atlasIMG: atlasIMG,
33791
33814
  atlasJSON: atlasJSON
33792
33815
  });
@@ -34557,6 +34580,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
34557
34580
  onItemDragEnd = _ref.onItemDragEnd,
34558
34581
  onItemDragStart = _ref.onItemDragStart,
34559
34582
  onItemPlaceDrop = _ref.onItemPlaceDrop,
34583
+ _onOutsideDrop = _ref.onOutsideDrop,
34560
34584
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
34561
34585
  initialPosition = _ref.initialPosition;
34562
34586
  var _useState = useState({
@@ -34602,6 +34626,9 @@ var ItemContainer$1 = function ItemContainer(_ref) {
34602
34626
  onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
34603
34627
  if (onItemPlaceDrop) onItemPlaceDrop(item, slotIndex, itemContainerType);
34604
34628
  },
34629
+ onOutsideDrop: function onOutsideDrop(item, position) {
34630
+ if (_onOutsideDrop) _onOutsideDrop(item, position);
34631
+ },
34605
34632
  atlasIMG: atlasIMG,
34606
34633
  atlasJSON: atlasJSON
34607
34634
  }));