fix: event

This commit is contained in:
cha0s 2022-05-30 18:51:02 -05:00
parent 9245211325
commit e04b44fa04
2 changed files with 5 additions and 5 deletions

View File

@ -22,7 +22,7 @@ const HotbarComponent = (props) => {
key={i}
item={item}
className={activeSlotIndex === i ? styles.active : ''}
onClick={(event) => {
onMouseDown={(event) => {
if (selfEntity) {
selfEntity.activeSlotIndex = i;
}

View File

@ -14,7 +14,7 @@ const ItemSlotComponent = (props) => {
children,
className,
item,
onClick,
onMouseDown,
} = props;
const [qty, setQty] = useState(undefined);
useEvent(item, 'qtyChanged', useCallback(() => setQty(item.qty), [item]));
@ -43,7 +43,7 @@ const ItemSlotComponent = (props) => {
}
return (
<button
onClick={onClick}
onMouseDown={onMouseDown}
className={classnames(
styles['item-slot'],
'unselectable',
@ -66,7 +66,7 @@ ItemSlotComponent.defaultProps = {
children: null,
className: '',
item: null,
onClick: () => {},
onMouseDown: () => {},
};
ItemSlotComponent.propTypes = {
@ -79,7 +79,7 @@ ItemSlotComponent.propTypes = {
qty: PropTypes.number,
imageForSlot: PropTypes.func,
}),
onClick: PropTypes.func,
onMouseDown: PropTypes.func,
};
export default ItemSlotComponent;