From 49e48d55c2668fd2ef3e1ebb7534f8c4041d2fe6 Mon Sep 17 00:00:00 2001 From: cha0s Date: Fri, 28 Jun 2024 16:37:15 -0500 Subject: [PATCH] fun: easy till --- app/react-components/hotbar.jsx | 8 +++++++- app/react-components/slot.jsx | 4 ++++ app/react-components/ui.jsx | 12 ++++++++++++ public/assets/hoe/start.js | 6 +++--- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/react-components/hotbar.jsx b/app/react-components/hotbar.jsx index 3906780..1ac516a 100644 --- a/app/react-components/hotbar.jsx +++ b/app/react-components/hotbar.jsx @@ -15,7 +15,13 @@ export default function Hotbar({active, onActivate, slots}) { > onActivate(i)} + onMouseDown={(event) => { + onActivate(i) + event.stopPropagation(); + }} + onMouseUp={(event) => { + event.stopPropagation(); + }} onDragOver={(event) => { event.preventDefault(); }} diff --git a/app/react-components/slot.jsx b/app/react-components/slot.jsx index da5d428..37abe28 100644 --- a/app/react-components/slot.jsx +++ b/app/react-components/slot.jsx @@ -10,6 +10,8 @@ export default function Slot({ onDragOver, onDragStart, onDrop, + onMouseDown, + onMouseUp, qty = 1, }) { return ( @@ -24,6 +26,8 @@ export default function Slot({ onKeyDown={(event) => { event.preventDefault(); }} + onMouseDown={onMouseDown} + onMouseUp={onMouseUp} >
{ + client.send({ + type: 'Action', + payload: {type: 'use', value: 'keyDown'}, + }); + }} + onMouseUp={(event) => { + client.send({ + type: 'Action', + payload: {type: 'use', value: 'keyUp'}, + }); + }} >