use Math.abs when calculating lasso area (#673)

This commit is contained in:
Charlotte Weaver
2019-03-27 21:02:31 -07:00
committed by GitHub
parent 153f240c43
commit 096d477893

View File

@@ -397,7 +397,10 @@ class Graph extends React.Component {
const minimumPolygoneArea = 10;
const { dispatch } = this.props;
if (polygon.length < 3 || d3.polygonArea(polygon) < minimumPolygoneArea) {
if (
polygon.length < 3 ||
Math.abs(d3.polygonArea(polygon)) < minimumPolygoneArea
) {
// if less than three points, or super small area, treat as a clear selection.
dispatch({ type: "lasso deselect" });
} else {