minecraft-inventory 0.1.34 → 0.1.35
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/package.json
CHANGED
|
@@ -351,6 +351,13 @@ export function Slot({
|
|
|
351
351
|
[isMobile, disabled, heldItem, sendAction, index, pKeyActive, setPKeyActive, focusedSlot, setFocusedSlot, onClickOverride, cancelLongPress, mobileMenuOpen],
|
|
352
352
|
)
|
|
353
353
|
|
|
354
|
+
const handleMobilePickAll = useCallback(() => {
|
|
355
|
+
setMobileMenuOpen(false)
|
|
356
|
+
setShowTooltip(false)
|
|
357
|
+
setFocusedSlot(index)
|
|
358
|
+
sendAction({ type: 'click', slotIndex: index, button: 'left', mode: 'normal' })
|
|
359
|
+
}, [sendAction, index, setFocusedSlot])
|
|
360
|
+
|
|
354
361
|
const handleMobilePickHalf = useCallback(() => {
|
|
355
362
|
setMobileMenuOpen(false)
|
|
356
363
|
setShowTooltip(false)
|
|
@@ -537,6 +544,7 @@ export function Slot({
|
|
|
537
544
|
item={item}
|
|
538
545
|
x={mobileTouchPos.x}
|
|
539
546
|
y={mobileTouchPos.y}
|
|
547
|
+
onPickAll={handleMobilePickAll}
|
|
540
548
|
onPickHalf={handleMobilePickHalf}
|
|
541
549
|
onPickCustom={handleMobilePickCustom}
|
|
542
550
|
onDropOne={handleMobileDropOne}
|
|
@@ -553,6 +561,7 @@ interface MobileSlotMenuProps {
|
|
|
553
561
|
item: ItemStack
|
|
554
562
|
x: number
|
|
555
563
|
y: number
|
|
564
|
+
onPickAll(): void
|
|
556
565
|
onPickHalf(): void
|
|
557
566
|
onPickCustom(): void
|
|
558
567
|
onDropOne(): void
|
|
@@ -560,7 +569,7 @@ interface MobileSlotMenuProps {
|
|
|
560
569
|
onClose(): void
|
|
561
570
|
}
|
|
562
571
|
|
|
563
|
-
function MobileSlotMenu({ item, x, y, onPickHalf, onPickCustom, onDropOne, onDropAll, onClose }: MobileSlotMenuProps) {
|
|
572
|
+
function MobileSlotMenu({ item, x, y, onPickAll, onPickHalf, onPickCustom, onDropOne, onDropAll, onClose }: MobileSlotMenuProps) {
|
|
564
573
|
const { scale } = useScale()
|
|
565
574
|
const menuRef = useRef<HTMLDivElement>(null)
|
|
566
575
|
const [pos, setPos] = useState({ left: x, top: y })
|
|
@@ -605,11 +614,11 @@ function MobileSlotMenu({ item, x, y, onPickHalf, onPickCustom, onDropOne, onDro
|
|
|
605
614
|
<div className={styles.mobileMenuTitle}>
|
|
606
615
|
{item.displayName ?? item.name ?? `Item #${item.type}`} ×{item.count}
|
|
607
616
|
</div>
|
|
617
|
+
<button className={styles.mobileBtn} {...touchBtn(onPickAll)}>Select All ({item.count})</button>
|
|
608
618
|
<button className={styles.mobileBtn} {...touchBtn(onPickHalf)}>Pick Half ({Math.ceil(item.count / 2)})</button>
|
|
609
619
|
<button className={styles.mobileBtn} {...touchBtn(onPickCustom)}>Pick Amount…</button>
|
|
610
620
|
<button className={[styles.mobileBtn, styles.mobileBtnDanger].join(' ')} {...touchBtn(onDropOne)}>Drop One</button>
|
|
611
621
|
<button className={[styles.mobileBtn, styles.mobileBtnDanger].join(' ')} {...touchBtn(onDropAll)}>Drop All</button>
|
|
612
|
-
<button className={styles.mobileBtn} {...touchBtn(onClose)}>Cancel</button>
|
|
613
622
|
</div>
|
|
614
623
|
)
|
|
615
624
|
}
|