InputRoll: fix right-click cell selection (use OnMouseMove instead of a separate logic that was being used purely because MouseMove wasn't being triggered, display the new selection so the user knows what's up, invoke SelectedIndexChanged event)

This commit is contained in:
SuuperW 2021-01-15 17:42:49 -06:00
parent 3ccd10bb36
commit 764f4ad81e
1 changed files with 10 additions and 9 deletions

View File

@ -1195,21 +1195,22 @@ namespace BizHawk.Client.EmuHawk
if (AllowRightClickSelection && e.Button == MouseButtons.Right) if (AllowRightClickSelection && e.Button == MouseButtons.Right)
{ {
if (!IsHoveringOnColumnCell && CurrentCell != null) // In the case that we have a context menu already open, we must manually update the CurrentCell as MouseMove isn't triggered while it is open.
{ if (CurrentCell == null)
_currentX = e.X; OnMouseMove(e);
_currentY = e.Y;
Cell newCell = CalculatePointedCell(_currentX.Value, _currentY.Value);
newCell.RowIndex += FirstVisibleRow;
if (!IsHoveringOnColumnCell)
{
// If this cell is not currently selected, clear and select // If this cell is not currently selected, clear and select
if (!_selectedItems.Contains(newCell)) if (!_selectedItems.Contains(CurrentCell))
{ {
_selectedItems.Clear(); _selectedItems.Clear();
SelectCell(CurrentCell); SelectCell(CurrentCell);
}
CellChanged(newCell); Refresh();
SelectedIndexChanged?.Invoke(this, new EventArgs());
}
} }
} }