Fix collection drawer render order bug #65
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
I've fixed a bug with the way
ReorderableList
elements were being drawn inCollectionEditor
/GenericPropertyDrawer
that should result in each item in the collection being rendered properly in the ReorderableList itself inline with their indexed position rather than directly below the list and in between the developer description. The chief thing to note here is that usage of ReorderableList is akin to a property drawer in that it does not respect GUILayout elements.Before
After
Testing
I've created some test collection variables in an additional test commit to inspect and if there any custom types that would normally span a single line in height they should also work with this change. One of the results of this fix is that each element should be sized properly for the height of the property drawer rendering it.
Changes
Fixed issue with reorderable list elements
elementHeightCallback
so that the height of the element rect can vary depending on the generic T type element's property drawer and changed the element drawing logic to use a non-layout version of the same method from GenericPropertyDrawer. The end result is that these elements are now drawn inline with the reorderable list element instead of below the entire list.