Tables: Clear scroll value when reactivating scroll. Assert when passing width/weight to TableSetupColumn() without an explicit sizing policy at either table or column label.

Clearing scroll was initially made desirable by tests exhibiting side effects but generally feels saner.
table->UserOuterSize is poorly used in this commit but will be by subsequent commits.
This commit is contained in:
ocornut
2021-01-19 21:53:35 +01:00
parent 0ea4408fd4
commit 3fef132f62
2 changed files with 14 additions and 3 deletions

View File

@ -2037,6 +2037,7 @@ struct ImGuiTable
ImVec2 HostBackupPrevLineSize; // Backup of InnerWindow->DC.PrevLineSize at the end of BeginTable()
ImVec2 HostBackupCurrLineSize; // Backup of InnerWindow->DC.CurrLineSize at the end of BeginTable()
ImVec2 HostBackupCursorMaxPos; // Backup of InnerWindow->DC.CursorMaxPos at the end of BeginTable()
ImVec2 UserOuterSize; // outer_size.x passed to BeginTable()
ImVec1 HostBackupColumnsOffset; // Backup of OuterWindow->DC.ColumnsOffset at the end of BeginTable()
float HostBackupItemWidth; // Backup of OuterWindow->DC.ItemWidth at the end of BeginTable()
int HostBackupItemWidthStackSize;// Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable()
@ -2084,6 +2085,7 @@ struct ImGuiTable
bool IsResetDisplayOrderRequest;
bool IsUnfrozenRows; // Set when we got past the frozen row.
bool IsOuterRectMinFitX; // Set when outer_size.x == 0.0f in BeginTable(), scrolling is disabled, and there are no stretch columns.
bool IsDefaultSizingPolicy; // Set if user didn't explicitely set a sizing policy in BeginTable()
bool MemoryCompacted;
bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis