fix(plateview): keep the selection when Ctrl is held

Ctrl+click on empty space no longer clears the selected parts, so a
window drag with Ctrl adds to the selection; Ctrl+Shift+click on a part
now adds it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-11-19 20:36:11 -05:00
1 parent 4be141b038
commit 6cf6a78306
1 file changed
+8 -6
+8 -6
View File
@@ -116,7 +116,9 @@ namespace OpenNest.Actions
if (e.Button == MouseButtons.Left)
{
if (plateView.SelectedParts.Count > 0)
// Ctrl adds to the selection: a click off the parts starts a window without
// clearing what is already selected.
if (plateView.SelectedParts.Count > 0 && !IsControlHeld)
{
var part = plateView.GetPartAtControlPoint(e.Location);
@@ -201,15 +203,13 @@ namespace OpenNest.Actions
if (part == null)
{
plateView.DeselectAll();
if (!IsControlHeld)
plateView.DeselectAll();
status = Status.SetFirstPoint;
return false;
}
if (
Control.ModifierKeys != Keys.Control
&& plateView.SelectedParts.Contains(part) == false
)
if (!IsControlHeld && plateView.SelectedParts.Contains(part) == false)
plateView.DeselectAll();
// A common-line member brings its whole group, so a drag moves the joined parts together.
@@ -253,6 +253,8 @@ namespace OpenNest.Actions
private RectangleF GetRectangle() => GetRectangle(Point1, Point2);
private static bool IsControlHeld => (Control.ModifierKeys & Keys.Control) == Keys.Control;
public SelectionType SelectionType
{
get { return Point1.X < Point2.X ? SelectionType.Contains : SelectionType.Intersect; }