-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Column width data is no longer lost when dragged to the right side of the window #1499
Conversation
…ould collapse the columns, losing their width data. With this change, the old column widths are remembered until the columns are no longer being dragged. This means columns can be collapsed by dragging them all the way to the right side of the window, and then expanded again by dragging them back to the left, without losing their width data until the columns are actually deselected and no longer being dragged.
Geoffrey, I understand the problem, thought I think maybe we should bite the bullet and reorganize the columns code to store data in dedicated structures. The main reason it is using StateStorage instead of ColumnsData[] right now is because we can have multiple column sets, so ColumnsData[] is just transient storage. But it's a little silly right now to keep that system. I'll try to do this refactor at some point, have e.g. a ImGuiColumnsData structure with all the columns state, keyed by main nColumns() id. Omar |
Yeah that's understandable. If I find the time I may try exploring the ImGuiColumnsData storage myself and see where it takes us. Thanks for the quick response! |
I actually started working on refactoring those structures just now, so will probably push something shortly with the cleanup, and your feature will be much simpler to implement then. |
Ooh awesome, thanks Omar! :D |
Geoffrey, this is now pushed (commit ddbcda8 which you'll notice is now much simpler). I also reorganized the data structures so working on columns will be easier onward. |
Looks great! |
Fixed an issue where dragging the columns to the edge of the window would collapse the columns (since they are now forced within the window) and their width data would be lost. With this change, the old column widths are remembered until the columns are no longer being dragged. This means columns can be collapsed by dragging them all the way to the right side of the window, and then expanded again by dragging them back to the left, without losing their width data until the columns are actually deselected and no longer being dragged.
I'm not super happy with how the column state is being stored in the StateStorage object, but this was the quickest fix I could put in using the existing tech.
With this change, this is how the column state storage looks: