Commit 154f6c58 authored by Christian Winter's avatar Christian Winter

if vertex + edge selection selected behaviour is as previously was

parent ee97ae52
Pipeline #4620898 passed with stage
in 1 minute and 3 seconds
......@@ -116,7 +116,26 @@ class MouseHandler {
let lines = File.currentLayer.lines.concat(Selection.data.lines).concat(Selection.data.partialLines);
let pointsToChangeSelection = [];
if (Preferences.selectEdges) {
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);
}
}
}
} else if (Preferences.selectEdges) {
for (let i = 0; i < lines.length; i++) {
if (Utilities.distancePointToLine(mousePosition, lines[i]) <= cursorRange) {
pointsToChangeSelection.push(lines[i].start);
......@@ -130,27 +149,6 @@ class MouseHandler {
}
}
/*
// 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);
}
}
}
*/
Selection.changeSelectionForPoints(pointsToChangeSelection);
if (pointsToChangeSelection != null) {
......
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