minecraft-inventory 0.1.29 → 0.1.30
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
|
@@ -61,6 +61,8 @@ export interface InventoryOverlayProps {
|
|
|
61
61
|
renderEntity?: ((width: number, height: number) => React.ReactNode) | null
|
|
62
62
|
/** Hide the "INV" version watermark (opt-out) */
|
|
63
63
|
noWatermark?: boolean
|
|
64
|
+
/** Called when the gear button is clicked. When provided, a small settings gear appears in the overlay. */
|
|
65
|
+
onOpenSettings?: () => void
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
export function InventoryOverlay({
|
|
@@ -90,9 +92,11 @@ export function InventoryOverlay({
|
|
|
90
92
|
entityDisplayDebug = false,
|
|
91
93
|
renderEntity,
|
|
92
94
|
noWatermark = false,
|
|
95
|
+
onOpenSettings,
|
|
93
96
|
}: InventoryOverlayProps) {
|
|
94
97
|
const { heldItem, sendAction, setHeldItem, focusedSlot, setFocusedSlot } = useInventoryContext()
|
|
95
98
|
const { scale } = useScale()
|
|
99
|
+
const [settingsHovered, setSettingsHovered] = useState(false)
|
|
96
100
|
|
|
97
101
|
useCloseOnWClick(onClose)
|
|
98
102
|
|
|
@@ -326,10 +330,42 @@ export function InventoryOverlay({
|
|
|
326
330
|
lineHeight: 1,
|
|
327
331
|
}}
|
|
328
332
|
>
|
|
329
|
-
INV 0.1.
|
|
333
|
+
INV 0.1.30
|
|
330
334
|
</a>
|
|
331
335
|
)}
|
|
332
336
|
|
|
337
|
+
{/* Settings gear button */}
|
|
338
|
+
{onOpenSettings && (
|
|
339
|
+
<button
|
|
340
|
+
className="mc-inv-settings-btn"
|
|
341
|
+
onClick={(e) => { e.stopPropagation(); onOpenSettings() }}
|
|
342
|
+
onMouseDown={(e) => e.stopPropagation()}
|
|
343
|
+
onMouseEnter={() => setSettingsHovered(true)}
|
|
344
|
+
onMouseLeave={() => setSettingsHovered(false)}
|
|
345
|
+
title="Settings"
|
|
346
|
+
style={{
|
|
347
|
+
position: 'absolute',
|
|
348
|
+
top: 4,
|
|
349
|
+
right: 4,
|
|
350
|
+
background: 'none',
|
|
351
|
+
border: 'none',
|
|
352
|
+
padding: 2,
|
|
353
|
+
cursor: 'pointer',
|
|
354
|
+
color: settingsHovered ? 'rgba(255,255,255,0.8)' : 'rgba(255,255,255,0.35)',
|
|
355
|
+
pointerEvents: 'auto',
|
|
356
|
+
zIndex: 2,
|
|
357
|
+
lineHeight: 1,
|
|
358
|
+
display: 'flex',
|
|
359
|
+
alignItems: 'center',
|
|
360
|
+
justifyContent: 'center',
|
|
361
|
+
}}
|
|
362
|
+
>
|
|
363
|
+
<svg viewBox="0 0 20 20" width={14} height={14} fill="currentColor">
|
|
364
|
+
<path d="M8.5 0h3l.5 2.5 1.3.5L15.5 1.5l2.1 2.1-1.5 2.2.5 1.3L19.1 8v3l-2.5.5-.5 1.3 1.5 2.2-2.1 2.1-2.2-1.5-1.3.5L11.5 19h-3L8 16.5l-1.3-.5L4.5 17.5l-2.1-2.1 1.5-2.2L3.4 12 .9 11.5v-3L3.4 8l.5-1.3L2.4 4.5 4.5 2.4l2.2 1.5L8 3.4 8.5 0zM10 6.5a3.5 3.5 0 100 7 3.5 3.5 0 000-7z"/>
|
|
365
|
+
</svg>
|
|
366
|
+
</button>
|
|
367
|
+
)}
|
|
368
|
+
|
|
333
369
|
{/* Debug bounds */}
|
|
334
370
|
{debugBounds && (
|
|
335
371
|
<div
|