components/Board: ignore invalid selections

This commit is contained in:
Artur Tamborski 2020-11-27 22:27:07 +01:00
parent a383c0b1d7
commit ec3be89ad4

View File

@ -41,6 +41,12 @@ export default class Board extends React.Component<IBoardProps, IBoardState> {
} }
handleMouseUp(endPos: Point) { handleMouseUp(endPos: Point) {
const x = Math.abs(endPos.x - this.state.startPos.x);
const y = Math.abs(endPos.y - this.state.startPos.y);
if (!(x === 0 || y === 0 || x === y))
return;
this.setState({...this.state, endPos, isSelecting: false}); this.setState({...this.state, endPos, isSelecting: false});
} }