This commit is contained in:
DD 2017-08-30 10:56:30 -04:00
parent cf19fc556f
commit c228a191cb

View file

@ -59,18 +59,18 @@ class LineMode extends React.Component {
const lineMode = this; const lineMode = this;
this.tool.onMouseDown = function (event) { this.tool.onMouseDown = function (event) {
if (event.event.button > 0) return; // only first mouse button if (event.event.button > 0) return; // only first mouse button
lineMode.onMouseDown(event); lineMode.onMouseDown(event);
}; };
this.tool.onMouseMove = function (event) { this.tool.onMouseMove = function (event) {
lineMode.onMouseMove(event); lineMode.onMouseMove(event);
}; };
this.tool.onMouseDrag = function (event) { this.tool.onMouseDrag = function (event) {
if (event.event.button > 0) return; // only first mouse button if (event.event.button > 0) return; // only first mouse button
lineMode.onMouseDrag(event); lineMode.onMouseDrag(event);
}; };
this.tool.onMouseUp = function (event) { this.tool.onMouseUp = function (event) {
if (event.event.button > 0) return; // only first mouse button if (event.event.button > 0) return; // only first mouse button
lineMode.onMouseUp(event); lineMode.onMouseUp(event);
}; };
@ -187,8 +187,8 @@ class LineMode extends React.Component {
// TODO don't erase the line if both ends are snapped to different points // TODO don't erase the line if both ends are snapped to different points
return; return;
} else if ( } else if (
this.path.lastSegment.point.getDistance(this.path.segments[this.path.segments.length - 2].point, true) < this.path.lastSegment.point.getDistance(this.path.segments[this.path.segments.length - 2].point, true) <
this.toleranceSquared()) { this.toleranceSquared()) {
this.path.removeSegment(this.path.segments.length - 1); this.path.removeSegment(this.path.segments.length - 1);
return; return;
} }