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
|
public class ActionClone : Action
|
||||||
{
|
{
|
||||||
private readonly List<LayoutPart> parts;
|
private readonly List<LayoutPart> parts;
|
||||||
|
private readonly List<Part> sourceParts;
|
||||||
|
|
||||||
private double lastScale;
|
private double lastScale;
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ namespace OpenNest.Actions
|
|||||||
plateView.MouseDown += plateView_MouseDown;
|
plateView.MouseDown += plateView_MouseDown;
|
||||||
plateView.Paint += plateView_Paint;
|
plateView.Paint += plateView_Paint;
|
||||||
|
|
||||||
|
sourceParts = partsToClone;
|
||||||
parts = new List<LayoutPart>();
|
parts = new List<LayoutPart>();
|
||||||
lastScale = double.NaN;
|
lastScale = double.NaN;
|
||||||
|
|
||||||
@@ -61,6 +63,16 @@ namespace OpenNest.Actions
|
|||||||
Apply();
|
Apply();
|
||||||
break;
|
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:
|
case Keys.F:
|
||||||
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
|
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
|
||||||
Fill();
|
Fill();
|
||||||
|
|||||||
@@ -386,11 +386,7 @@ namespace OpenNest.Controls
|
|||||||
switch (e.KeyCode)
|
switch (e.KeyCode)
|
||||||
{
|
{
|
||||||
case Keys.Delete:
|
case Keys.Delete:
|
||||||
if (currentAction is ActionClone)
|
if (selectedCutOff != null)
|
||||||
{
|
|
||||||
SetAction(typeof(ActionSelect));
|
|
||||||
}
|
|
||||||
else if (selectedCutOff != null)
|
|
||||||
{
|
{
|
||||||
Plate.CutOffs.Remove(selectedCutOff);
|
Plate.CutOffs.Remove(selectedCutOff);
|
||||||
selectedCutOff = null;
|
selectedCutOff = null;
|
||||||
@@ -853,6 +849,7 @@ namespace OpenNest.Controls
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void redrawTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
private void redrawTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
|||||||
Reference in New Issue
Block a user