Commit 11affd46 authored by Christian Winter's avatar Christian Winter

selection improved

parent 88f5b6ee
......@@ -118,22 +118,22 @@ class MouseHandler {
let pointsToChangeSelection = [];
if (Preferences.selectVertices && Preferences.selectEdges) {
// TODO weird number but should be a third?
let limit = 0.25;
for (let i = 0; i < lines.length; i++) {
if (Utilities.distancePointToLine(mousePosition, lines[i]) <= cursorRange) {
// TODO PERFORMANCE
let startDist = lines[i].start.position.subtractVector(mousePosition).sqrMagnitude();
let endDist = lines[i].end.position.subtractVector(mousePosition).sqrMagnitude();
if (startDist < endDist * limit)
pointsToChangeSelection.push(lines[i].start);
else if (endDist < startDist * limit)
pointsToChangeSelection.push(lines[i].end);
else {
pointsToChangeSelection.push(lines[i].start);
pointsToChangeSelection.push(lines[i].end);
}
let s, e, m, _m;
for (let line of lines) {
s = Utilities.pointWithinCircle(line.start, mousePosition, cursorRange);
e = Utilities.pointWithinCircle(line.end, mousePosition, cursorRange);
_m = line.start.position.addVector(line.end.position);
_m = _m.divide(2);
_m = new LineEnding(_m.x, _m.y, line);
m = Utilities.pointWithinCircle(_m, mousePosition, cursorRange);
if (s && !m && !e)
pointsToChangeSelection.push(line.start);
else if (!s && !m && e)
pointsToChangeSelection.push(line.end);
else if (m || Utilities.distancePointToLine(mousePosition, line) <= cursorRange + line.thickness) {
pointsToChangeSelection.push(line.start);
pointsToChangeSelection.push(line.end);
}
}
} else if (Preferences.selectEdges) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment