Skip to content
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

Adding tile direction aka "anchor" aka "alignment" support to GridObjectCollection #4777

Closed
2 tasks done
wiwei opened this issue Jun 7, 2019 · 4 comments
Closed
2 tasks done
Assignees

Comments

@wiwei
Copy link
Contributor

wiwei commented Jun 7, 2019

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 (i.e. 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 is trivially "workaroundable" by just setting the xOffset and yOffset starting values to zero, but it would probably be helpful to have an option on the object collections to provide a "which direction will they grow from"

  • Add a single field "anchor" with the following values: "Upper Left", "Upper Center",...,"Middle Left",..."Bottom Left",...,"Bottom Right". This matches what Unity has for Text Meshes:
    image

  • Update "Rows" to be "Rows or Columns", since if the layout is "Columns then rows", then the layout actually uses the "Rows" field to determine the maximum number of columns to use, not rows :-)

@wiwei wiwei added the Feature Request Feature request from the community label Jun 7, 2019
@radicalad
Copy link
Member

I'd recommend we make a net new GridObjectCollection (different name just not sure what) with a different set of Layout logic. Much like how ScatterObjectCollection is now a separate control. If you have a good name suggestion, I can add it to my PR for #4724 - I rewrote the Layout method for ScrollingObjectCollection because moving GridObjectCollection was a nightmare (for the same reason).

@julenka
Copy link
Contributor

julenka commented Nov 1, 2019

@radicalad, I think we can actually do this without needing to rewrite or GridObjectCollection, or create a new class. While I like the idea of starting from a clean slate, re-using GridObjectCollection has a few advantages:

  1. People using GridObjectCollection will benefit without needing to redo their assets
  2. People will be able to more easily switch layouts
  3. The name "GridObjectCollection" feels like the best name for what this does :-( I can't think of a better name, and "GridObjectCollection2" is something we are trying to avoid.

@julenka
Copy link
Contributor

julenka commented Nov 1, 2019

How about the following spec:

  • When the "Surface Type" is "Plane" we have a section called "grid alignment", with the following options:

    Vertical Alignment: Can be "Top, Middle, or Bottom"
    Horizontal Alignment: Can be "Left, Center, or Right"

    This matches alignment options commonly found in table layouts such as the table editor in Word:
    image

    Another option would be to have a single field "anchor" with the following values: "Upper Left", "Upper Center",...,"Middle Left",..."Bottom Left",...,"Bottom Right". This matches what Unity has for Text Meshes:
    image

  • Update "Rows" to be "Rows or Columns", since if the layout is "Columns then rows", then the layout actually uses the "Rows" field to determine the maximum number of columns to use, not rows :-)

Now that I've seen the "anchor" example already used in Text Meshes, I'd prefer that, since that's a known pattern in Unity.

@julenka julenka changed the title Adding tile direction support to GridObjectCollection Adding tile direction aka "anchor" aka "alignment" support to GridObjectCollection Nov 1, 2019
@julenka
Copy link
Contributor

julenka commented Nov 4, 2019

@radicalad I've got the "anchor" field working in GridObjectCollection without needing to rewrite it, the code change was actually fairly minimal. I don't think we need to rewrite GridObjectCollection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants