mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-05 07:51:36 -05:00
fix: prevent Delete key from corrupting quantity during ActionClone
ObservableList.Remove fired ItemRemoved even when the item wasn't in the list, causing Plate to decrement Quantity.Nested for clone preview parts that were never added — producing -1 counts. Delete in PlateView now cancels ActionClone instead of trying to remove its preview parts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c5943e22eb
commit
7e86313d7c
2 files changed
+7
-2
No files matched your search
@@ -46,7 +46,8 @@ namespace OpenNest.Collections
|
||||
public bool Remove(T item)
|
||||
{
|
||||
var success = items.Remove(item);
|
||||
ItemRemoved?.Invoke(this, new ItemRemovedEventArgs<T>(item, success));
|
||||
if (success)
|
||||
ItemRemoved?.Invoke(this, new ItemRemovedEventArgs<T>(item, success));
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -386,7 +386,11 @@ namespace OpenNest.Controls
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Delete:
|
||||
if (selectedCutOff != null)
|
||||
if (currentAction is ActionClone)
|
||||
{
|
||||
SetAction(typeof(ActionSelect));
|
||||
}
|
||||
else if (selectedCutOff != null)
|
||||
{
|
||||
Plate.CutOffs.Remove(selectedCutOff);
|
||||
selectedCutOff = null;
|
||||
|
||||
Reference in new issue
Block a user