fix(desktop): keep the plate list selection in sync with the header arrows

Navigating plates from the plate view header (or Ctrl+Left/Right) changed
the plate without updating the plate list, so its highlighted row pointed
at a different plate. Select, focus and scroll to the current plate's row
whenever the current plate changes, guarded so the list doesn't reload it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-10-22 11:37:03 -04:00
1 parent 63771b0029
commit c58ae6f9e1
1 file changed
+22 -2
+22 -2
View File
@@ -1025,13 +1025,32 @@ namespace OpenNest.Forms
private void FirePlateChanged(bool updateListView = true)
{
if (updateListView && PlateManager.CurrentIndex < platesListView.Items.Count)
platesListView.Items[PlateManager.CurrentIndex].Selected = true;
if (updateListView)
SelectCurrentPlateInList();
UpdatePlateHeader();
PlateChanged?.Invoke(this, EventArgs.Empty);
}
private void SelectCurrentPlateInList()
{
var index = PlateManager.CurrentIndex;
if (index < 0 || index >= platesListView.Items.Count)
return;
var item = platesListView.Items[index];
if (item.Selected)
return;
// Guarded so the list's own SelectedIndexChanged doesn't reload the plate.
var wasUpdating = updatingPlateList;
updatingPlateList = true;
item.Selected = true;
item.Focused = true;
item.EnsureVisible();
updatingPlateList = wasUpdating;
}
private void UpdatePlateHeader()
{
var plate = PlateManager.CurrentPlate;
@@ -1445,6 +1464,7 @@ namespace OpenNest.Forms
{
PlateView.Plate = PlateManager.CurrentPlate;
PlateView.ZoomToFit();
SelectCurrentPlateInList();
UpdatePlateHeader();
UpdateRemovePlateButton();
PlateChanged?.Invoke(this, EventArgs.Empty);