fix: event
This commit is contained in:
parent
9245211325
commit
e04b44fa04
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user