Fix keyboard splitter adjustment to avoid float boundary issues (resulted in splitter getting stuck at some points).

This commit is contained in:
tznind
2022-12-24 14:02:10 +00:00
parent b1c7efea7f
commit d576799ef9

View File

@@ -477,8 +477,10 @@ namespace Terminal.Gui {
/// <returns></returns>
private Pos ConvertToPosFactor (Pos p, int parentLength)
{
int position = p.Anchor (parentLength);
return new Pos.PosFactor (position / (float)parentLength);
// calculate position in the 'middle' of the cell at p distance along parentLength
float position = p.Anchor (parentLength) + 0.5f;
return new Pos.PosFactor (position / parentLength);
}
}
}