Skip to content

Commit

Permalink
Merge pull request #10765 from FlaminSarge/feed-drag
Browse files Browse the repository at this point in the history
Allow dragging items from Item Feed to any bucket, similar to postmaster items
  • Loading branch information
bhollis authored Oct 25, 2024
2 parents ce15385 + 921d1c3 commit 90a5ff9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Next

* Allow dragging Item Feed items to any slot, removing the need to scroll to a specific item slot to drag them to a character. They will automatically go to the correct slot on the given character (in the same way Postmaster items function).

## 8.43.0 <span class="changelog-date">(2024-10-20)</span>

## 8.42.0 <span class="changelog-date">(2024-10-13)</span>
Expand Down
14 changes: 8 additions & 6 deletions src/app/inventory/DraggableInventoryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import { DimItem } from './item-types';

interface Props {
item: DimItem;
anyBucket?: boolean;
children?: React.ReactNode;
}

let dragTimeout: number | null = null;

export default function DraggableInventoryItem({ children, item }: Props) {
export default function DraggableInventoryItem({ children, item, anyBucket = false }: Props) {
const selectionProps = $featureFlags.elgatoStreamDeck
? // eslint-disable-next-line
useStreamDeckSelection({
Expand All @@ -33,11 +34,12 @@ export default function DraggableInventoryItem({ children, item }: Props) {

const [_collect, dragRef] = useDrag<DimItem>(
() => ({
type: item.location.inPostmaster
? 'postmaster'
: item.notransfer
? `${item.owner}-${item.bucket.hash}`
: item.bucket.hash.toString(),
type:
item.location.inPostmaster || anyBucket
? 'postmaster'
: item.notransfer
? `${item.owner}-${item.bucket.hash}`
: item.bucket.hash.toString(),
item: () => {
hideItemPopup();

Expand Down
4 changes: 3 additions & 1 deletion src/app/item-feed/ItemFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ const Item = memo(function Item({ item, tag }: { item: DimItem; tag: TagValue |
{isPhonePortrait ? (
itemIcon
) : (
<DraggableInventoryItem item={item}>{itemIcon}</DraggableInventoryItem>
<DraggableInventoryItem item={item} anyBucket={true}>
{itemIcon}
</DraggableInventoryItem>
)}
<div className={styles.info}>
<div className={styles.title}>
Expand Down

0 comments on commit 90a5ff9

Please sign in to comment.