-
Notifications
You must be signed in to change notification settings - Fork 1
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
Re implement grid #163
Re implement grid #163
Conversation
…ring layout - When itemDimensions are calculated it is the itemWidth + itemSpacing.X. - When we render we advance the cursor by the current itemDimensions. - When calculating how many columns we can support we take the itemDimensions and add itemSpacing.X for each item in the row. When calculating the rowWidth we shouldn't add any itemSpacing as it is already accounted for in the itemDimensions. This is most notable when the grid is in left aligned mode (coming soon)
- Added GridAlignment (Maybe rename to GridRowAlignment?). Left and Center - Continued investigation and fixing of various layout calculation issues. -- itemDimensions was including itemSpacing, but that was being passed to the drawDelegate as the item size. This meant that the item was being reported larger than it actually was and attempts to center or align the icon within the cell wouldn't be accurate -- columnWidths.Sum() was exceeding the contentRegionAvailable and causing rows to go too long. Moved the logic for calculating the columnWidths list into where we were calculating maxRowWidth (this needs to be thought about more) - Updated the demo to have options for controlling the grid now that we have another variant. -- Can control the order, layout, count, iconSize etc from ImGui controls within the demo to test a variety of combinations I don't expect this to be the final commit we take, but is in a working state and can be discussed/iterated on.
Only reduce the column count and get the "previous" data if there is valid "previous" data to use (ie. More than 1 column)
itemDimensions and itemDimensionsWithSpacing are equally sized lists so we can use the already calculated value and add the spacing on top of it.
Matches the functionality of Windows Explorer - Uses the available column height before moving onto the next column
- Remove old interface methods - "Update" to the latest ImGuiStyler library for CenterWithin fixes (There is a problem with the releases where 1.0.15-pre.17 is newer than 1.0.15)
Mostly renames and moving various around to make more sense
- Grid2 -> Grid - Remove ColumnMajor logic from RowMajor code paths - Add scrollbar for RowMajor - Tweak demo
One change I would like to make to this is to add the option make the grid fit to the growing axis. For row major that means fit to height and for column major that means fit to width. edit: Done |
- Review feedback and various improvements - Pass through an id so the grid id can be differentiated - Various variable renames - Significant changes to the ColumnMajor implementation to simplify the implementation -- Remove additional arrays that were being created -- Simplify setting the column and cell cursor position
- Remove whitespace - Accumulate, don't recalculate columnMajor grid column cursor position
- Support different sized rows - Refactor grid layout calculation for the ColumnMajor implementation. If this does well in review I would like to roll out a similar implementation for RowMajor as I believe it is a simple and straight forward implementation. - Add GridOptions to customise how the grid draws -- FitToContents which causes the Child to grow or shrink to cover all grid cells (no scrolling) - More debug drawing for the entire grid size
Made several more changes to the ColumnMajor implementation to include more functionality (different sized rows). Would like to get it reviewed as I think the implementation is simple and straight forward, but the fact I'm using some classes for the calculations could be controversial |
Thanks to Matt for assisting. Covers a lot of feedback given.
- Use the ColumnMajor implementation style - Found and fixed a few small issues with ColumnMajor during this process
Can draw the grid without specifying additional options.
- Turned the Options into a class and moved optional members in there - Size is now an optional arg and defaults to using ImGui.GetContentRegionAvail() - Split the public interface to remove the GridOrder enum and have Row/ColumnMajorGrid function - Changed an IList to array as suggested by the IDE
The previous implementation of ColumnMajor layout in the grid was not working as a user would expect, so I re-wrote it. While doing so it was very problematic to keep RowMajor and ColumnMajor within the same implementation so they have been split into their own classes.
This has been built on top of "Add row icon alignment fix layout calculations #146" (#146) and is designed to replace it.