-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
GridObjectCollection layout: anchor parent to left/center/right and top/middle/bottom #6550
GridObjectCollection layout: anchor parent to left/center/right and top/middle/bottom #6550
Conversation
// Copyright (c) Microsoft Corporation. https://docs.opensource.microsoft.com/content/releasing/copyright-headers.html Refers to: Assets/MixedRealityToolkit.Examples/Demos/UX/Collections/Scripts/GridObjectLayoutControl.cs:1 in 77406ff. [](commit_id = 77406ff, deletion_comment = False) |
Assets/MixedRealityToolkit.Examples/Demos/UX/Collections/Scripts/GridObjectLayoutControl.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it. Could we mitigate the breaking change by falling back to the row property if the collection is already set up? Perhaps check the layout type and column count and then set it from row?
Assets/MixedRealityToolkit.Examples/Demos/UX/Collections/Scripts/GridObjectLayoutControl.cs
Outdated
Show resolved
Hide resolved
Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Collections/GridObjectCollection.cs
Outdated
Show resolved
Hide resolved
set | ||
{ | ||
anchor = value; | ||
UpdateCollection(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: only UpdateCollection on value change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the same comment applies to the LayoutOrder one too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about why the other fields don't call UpdateCollection() after and realized this is because you may want to change multiple properties in a frame, and only need to recompute once. Decided to follow that existing pattern to save on layout compute.
Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Collections/GridObjectCollection.cs
Show resolved
Hide resolved
Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Collections/GridObjectCollection.cs
Outdated
Show resolved
Hide resolved
Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Collections/GridObjectCollection.cs
Outdated
Show resolved
Hide resolved
Assets/MixedRealityToolkit.Examples/Demos/UX/Collections/Scripts/GridObjectLayoutControl.cs
Outdated
Show resolved
Hide resolved
Assets/MixedRealityToolkit.Examples/Demos/UX/Collections/Scripts/GridObjectLayoutControl.cs
Outdated
Show resolved
Hide resolved
Assets/MixedRealityToolkit.Examples/Demos/UX/Collections/Scripts/GridObjectLayoutControl.cs
Show resolved
Hide resolved
Assets/MixedRealityToolkit.Examples/Demos/UX/Collections/Scripts/GridObjectLayoutControl.cs
Show resolved
Hide resolved
Assets/MixedRealityToolkit.Examples/Demos/UX/Collections/Scripts/GridObjectLayoutControl.cs
Outdated
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
@julenka - PR looks good to me, however I had a few broader concerns regarding the feature -
I would prefer if 1 above is addressed in this PR. For 2 - in general we would all benefit from opening another issue for improving the documentation of this feature. |
Looks like .NET validation is failing with
|
Great point! I had thought maybe it's not needed since the grid object collection docs are already pretty broad, but actually those docs could be improved. I'll add it as a to do for this PR. Thanks for the great feedback @ritijain! |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
@cre8ivepark friendly ping. Would especially appreciate your input regarding the layout of the example scene: |
@julenka, that scene looks wonderful! |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cre8ivepark Small comment on your image, but the top right layout color looks kinda like the "missing material magenta". The bottom right one has some outlining it looks like, but I'm not sure about the top right one. Not sure if it's just the image or something we want to update. |
@keveleigh Oh, it is just spectrum color change when it viewed from a different angle. |
Overview
The current GridObjectCollection will tile the objects with the parent object in the center of the collection - this great if you have a collection that you want to appear in the middle of something, but if you have a UI where you have a grid of buttons, which you want to appear going from the top left of a place and then growing toward the bottom right, this makes things difficult (you need to duplicate the layout logic to figure out where the buttons will be, and then move the parent object to JUST the right location).
This change adds the ability to lay out the buttons so that the parent is in the left/center/right x top/middle/bottom of the collection.
Changes
Fixes: Adding tile direction aka "anchor" aka "alignment" support to GridObjectCollection #4777
Add a new field named "anchor" to specify how objects should be tiled. Works with all types of surfaces.

Adds tests to verify that all anchor layouts tile content correctly
When layout type is "Columns then rows", ask user to specify number of columns instead of number of rows.


Modify Rows and Columns property so that users cannot change rows if layout type is
ColumnsThenRows
, and vice versaBreaking changes
To Do
Verification