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} key={i}
item={item} item={item}
className={activeSlotIndex === i ? styles.active : ''} className={activeSlotIndex === i ? styles.active : ''}
onClick={(event) => { onMouseDown={(event) => {
if (selfEntity) { if (selfEntity) {
selfEntity.activeSlotIndex = i; selfEntity.activeSlotIndex = i;
} }

View File

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