-
Notifications
You must be signed in to change notification settings - Fork 673
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
Add Pos.AnchorEnd ()
(no param) to automatically account for the view's dimension
#481
Comments
It's more or less equal to the Dim.Width(view) - n |
New docs make it more clear.
Closing. |
Re-opening. AnchorEnd functions well, but if you study the uses of it, in almost all cases one of two things happen
I propose in v2 we change this such that there are two constructors: Pos AnchorEnd () And Pos AnchorEnd (int margin) If the 1st is used, we apply (Pos.Right(view) - Pos.Left(view)). If the second is used, margin is applied as per the current implementation. What do yall think? |
The more options the better. Can you explain the differences between them in an image, please? In principle, it seems to make managing |
I had a typo originally where I wrote |
Ok now I understood. Go ahead. Goo work. |
Devil's advocate: I can imagine a case where you want, say, a text field to fill out the horizontal width of a dynamically-sized view, but also want a button to be anchored to the bottom right of the view, but offset it with more space than the view's margin. Admittedly you could do this by adding a subview for the buttons and give that margins, but especially if there's just one button that seems like overkill. |
The user may not want to touch the margin thickness addressing this and the |
@tig something is wrong with the Changing the Changing it to The change I made to the |
Ops sorry @tig I was wrong I forgot to take on account of the 0 number which already count 1 unit, My heads hurts and will explode ;-). |
But anyway something is wrong with the |
Well, the AnchorEnd unit tests are pretty lame, so it's not surprising to me that there's a nuanced bug or two in there (I'm suspect of any unit test that relies on I don't fully understand the scenario you're describing. My suggestion is for you to boil it down to the most simple and focused set of unit tests you can come up with. Use only |
Another great example of why we should fix this:
Haha. Everytime I run that I'm like "I should just fix this now". Then I'm like "Oh, Rabbit!" and I go elsewhere. Originally posted by @tig in #3323 (comment) |
Pos.AnchorEnd ()
(no param) to automatically account for the view's dimension
Fixes #481. Adds `Pos.AnchorEnd ()` (no param) to automatically account for the view's dimension.
Today:
AnchorEnd
unit testsAnchorEnd (x)
for the most common use-casesNote, if
margin:
was 0, or omitted, nothing would be shown. (Which just illustrates my point; the API is surpising)With proposed change:
Additionally,
margin:
is the wrong term for both today's behavior and my proposed behavior. WhatAnchorEnd
really does when a non-zeromargin
is specified is to shift the position left/up. So it's not reallymargin
, butshift
oroffset
.Updated API docs:
The text was updated successfully, but these errors were encountered: