fix: restore SelectedParts after plate switch in ActionClone
SetPlate clears SelectedParts, which broke bounds drawing and rotation for surviving actions. Add OnPlateChanged hook so ActionClone can re-populate SelectedParts after a plate switch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,8 @@ namespace OpenNest.Actions
|
|||||||
|
|
||||||
public virtual bool SurvivesPlateChange => false;
|
public virtual bool SurvivesPlateChange => false;
|
||||||
|
|
||||||
|
public virtual void OnPlateChanged() { }
|
||||||
|
|
||||||
public abstract void DisconnectEvents();
|
public abstract void DisconnectEvents();
|
||||||
|
|
||||||
public abstract void CancelAction();
|
public abstract void CancelAction();
|
||||||
|
|||||||
@@ -100,6 +100,12 @@ namespace OpenNest.Actions
|
|||||||
|
|
||||||
public override bool SurvivesPlateChange => true;
|
public override bool SurvivesPlateChange => true;
|
||||||
|
|
||||||
|
public override void OnPlateChanged()
|
||||||
|
{
|
||||||
|
plateView.SelectedParts.Clear();
|
||||||
|
plateView.SelectedParts.AddRange(parts);
|
||||||
|
}
|
||||||
|
|
||||||
public override void DisconnectEvents()
|
public override void DisconnectEvents()
|
||||||
{
|
{
|
||||||
plateView.KeyDown -= plateView_KeyDown;
|
plateView.KeyDown -= plateView_KeyDown;
|
||||||
|
|||||||
@@ -129,6 +129,8 @@ namespace OpenNest.Controls
|
|||||||
|
|
||||||
if (currentAction == null || !currentAction.SurvivesPlateChange)
|
if (currentAction == null || !currentAction.SurvivesPlateChange)
|
||||||
SetAction(typeof(ActionSelect));
|
SetAction(typeof(ActionSelect));
|
||||||
|
else
|
||||||
|
currentAction.OnPlateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Status
|
public string Status
|
||||||
|
|||||||
Reference in New Issue
Block a user