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

Align functions sometimes don't move things to appropriate quadrant #35

Open
luciansmith opened this issue Dec 19, 2024 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@luciansmith
Copy link

If I set the layout size to 1000,1000, call autolayout, then align some element (i.e. 'alignTop'), sometimes the position of those elements is not in the appropriate swath of the layout: when I call 'alignTop', for example, nine times out of 10, the Y value is 30, and often it's in the 30's to 200's. But sometimes it's close to the middle, like '432'. I think that's too far off to really say that's at the 'top' of the layout; it's more like the hCenter.

One time, I got 'nan' values, which is also not ideal, but I don't know how to reliably get that to repeat.

@adelhpour
Copy link
Member

adelhpour commented Dec 19, 2024

'alginTop' function calculates the min of the 'y' values of the selected items and set the 'y' values of all the items to that one. So, I wouldn't be surprised if you occasionally get something near to the center due to the randomness of the autolayout. In my test, I compare all the 'y' values to the min value after calling 'alignTop'.

@luciansmith
Copy link
Author

I think this behavior is not what people would expect. I think think if you're aligning elements to 'the top', people think of 'the top' as 'the top of the page' not 'the top of the cluster of elements that I don't know where they are'.

That said, it's possible that people might want your behavior in some conditions. Maybe a 'relative=true/false' argument to the functions?

(for version 2; I think the current state of things is probably fine for now.)

@adelhpour
Copy link
Member

Great. We will implement it in the version 0.2.

@adelhpour adelhpour added the enhancement New feature or request label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants