mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Fixed column using a "funny scale factor" (non power of two) #67
This commit is contained in:
parent
0b10cf4bd7
commit
74363c5a43
@ -4883,7 +4883,7 @@ float GetColumnOffset(int column_index)
|
|||||||
const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(column_index);
|
const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(column_index);
|
||||||
RegisterAliveId(column_id);
|
RegisterAliveId(column_id);
|
||||||
const float default_t = column_index / (float)window->DC.ColumnsCount;
|
const float default_t = column_index / (float)window->DC.ColumnsCount;
|
||||||
const float t = (float)window->StateStorage.GetInt(column_id, (int)(default_t * 8096)) / 8096; // Cheaply store our floating point value inside the integer (could store an union into the map?)
|
const float t = (float)window->StateStorage.GetInt(column_id, (int)(default_t * 8192)) / 8192; // Cheaply store our floating point value inside the integer (could store an union into the map?)
|
||||||
|
|
||||||
const float offset = window->DC.ColumnStartX + t * (window->Size.x - g.Style.ScrollBarWidth - window->DC.ColumnStartX);
|
const float offset = window->DC.ColumnStartX + t * (window->Size.x - g.Style.ScrollBarWidth - window->DC.ColumnStartX);
|
||||||
return offset;
|
return offset;
|
||||||
@ -4898,7 +4898,7 @@ void SetColumnOffset(int column_index, float offset)
|
|||||||
|
|
||||||
const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(column_index);
|
const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(column_index);
|
||||||
const float t = (offset - window->DC.ColumnStartX) / (window->Size.x - g.Style.ScrollBarWidth - window->DC.ColumnStartX);
|
const float t = (offset - window->DC.ColumnStartX) / (window->Size.x - g.Style.ScrollBarWidth - window->DC.ColumnStartX);
|
||||||
window->StateStorage.SetInt(column_id, (int)(t*8096));
|
window->StateStorage.SetInt(column_id, (int)(t*8192));
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetColumnWidth(int column_index)
|
float GetColumnWidth(int column_index)
|
||||||
|
Loading…
Reference in New Issue
Block a user