Skip to content

Commit 98121c3

Browse files
committed
make InputRoll handle its own ShowColumnTextOnHover redrawing on pointed cell change
1 parent 4912e4b commit 98121c3

2 files changed

Lines changed: 11 additions & 17 deletions

File tree

src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,21 +1047,12 @@ protected override void OnMouseMove(MouseEventArgs e)
10471047

10481048
Cell newCell = CalculatePointedCell(_currentX.Value, _currentY.Value);
10491049

1050-
if (!newCell.Equals(CurrentCell))
1050+
bool changed = CellChanged(newCell);
1051+
if (changed && (ShowColumnTextOnHover || IsHoveringOnColumnCell || WasHoveringOnColumnCell))
10511052
{
1052-
CellChanged(newCell);
1053-
1054-
if (IsHoveringOnColumnCell
1055-
|| (WasHoveringOnColumnCell && !IsHoveringOnColumnCell))
1056-
{
1057-
Refresh();
1058-
}
1059-
else if (_columnDown != null)
1060-
{
1061-
Refresh();
1062-
}
1053+
Refresh();
10631054
}
1064-
else if (_columnDown != null) // Kind of silly feeling to have this check twice, but the only alternative I can think of has it refreshing twice when pointed column changes with column down, and speed matters
1055+
else if (_columnDown != null)
10651056
{
10661057
Refresh();
10671058
}
@@ -1588,13 +1579,15 @@ private void OrientationChanged()
15881579
/// <summary>
15891580
/// Call this function to change the CurrentCell to newCell
15901581
/// </summary>
1591-
private void CellChanged(Cell newCell)
1582+
/// <returns>true if CurrentCell was changed</returns>
1583+
private bool CellChanged(Cell newCell)
15921584
{
1585+
if (newCell == CurrentCell) return false;
1586+
15931587
_lastCell = CurrentCell;
15941588
CurrentCell = newCell;
15951589

1596-
if (PointedCellChanged is not null
1597-
&& !(_lastCell?.Column == CurrentCell.Column && _lastCell?.RowIndex == CurrentCell.RowIndex)) //TODO isn't this just `Cell.==`? --yoshi
1590+
if (PointedCellChanged is not null)
15981591
{
15991592
PointedCellChanged(this, new CellEventArgs(_lastCell, CurrentCell));
16001593
}
@@ -1607,6 +1600,8 @@ private void CellChanged(Cell newCell)
16071600
{
16081601
_hoverTimer.Stop();
16091602
}
1603+
1604+
return true;
16101605
}
16111606

16121607
private void VerticalBar_ValueChanged(object sender, EventArgs e)

src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,6 @@ private void TasView_PointedCellChanged(object sender, InputRoll.CellEventArgs e
12791279

12801280
if (e.NewCell.RowIndex is null || !MouseButtonHeld)
12811281
{
1282-
SetTasViewRowCount(); // redraw
12831282
return;
12841283
}
12851284

0 commit comments

Comments
 (0)