feat: add Delete key to remove source parts during ActionClone
Enables a "move" workflow: clone parts to a new position, then press Delete to remove the originals. Previously Delete just cancelled the clone action. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ namespace OpenNest.Actions
|
||||
public class ActionClone : Action
|
||||
{
|
||||
private readonly List<LayoutPart> parts;
|
||||
private readonly List<Part> sourceParts;
|
||||
|
||||
private double lastScale;
|
||||
|
||||
@@ -28,6 +29,7 @@ namespace OpenNest.Actions
|
||||
plateView.MouseDown += plateView_MouseDown;
|
||||
plateView.Paint += plateView_Paint;
|
||||
|
||||
sourceParts = partsToClone;
|
||||
parts = new List<LayoutPart>();
|
||||
lastScale = double.NaN;
|
||||
|
||||
@@ -61,6 +63,16 @@ namespace OpenNest.Actions
|
||||
Apply();
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
foreach (var part in sourceParts)
|
||||
plateView.Plate.Parts.Remove(part);
|
||||
|
||||
if (plateView.Plate.CutOffs.Count > 0)
|
||||
plateView.Plate.RegenerateCutOffs(plateView.CutOffSettings);
|
||||
|
||||
plateView.Invalidate();
|
||||
break;
|
||||
|
||||
case Keys.F:
|
||||
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
|
||||
Fill();
|
||||
|
||||
@@ -386,11 +386,7 @@ namespace OpenNest.Controls
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Delete:
|
||||
if (currentAction is ActionClone)
|
||||
{
|
||||
SetAction(typeof(ActionSelect));
|
||||
}
|
||||
else if (selectedCutOff != null)
|
||||
if (selectedCutOff != null)
|
||||
{
|
||||
Plate.CutOffs.Remove(selectedCutOff);
|
||||
selectedCutOff = null;
|
||||
@@ -853,6 +849,7 @@ namespace OpenNest.Controls
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
private void redrawTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
|
||||
Reference in New Issue
Block a user