Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Conversation

1nput0utput
Copy link

@appleguy This small change allows content alignment like in the UIButton. The reason I had initially implemented this was to align 4 ASButtonNodes with flexBasis set with ASRelativeDimension(type: .Percent, value: 0.25). I simply wanted the ability to align ASButtonNode's content to make my whole view look good. I will create another PR for other behaviours I have in my app.

screen shot 2015-12-20 at 9 36 10 pm

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1nput0utput can you set _contentHorizontalAlignment, and _contentVerticalAlignment, to the default values in the -init method for the button? (use the ivars, not the property for efficiency). Then here, set the stack properties directly to the ivar values without checking them. Nothing guarantees that the enum values won't be zero anyway, so I'm not sure it is ideal to use the ternary operator to check if they have been set to non-default values.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@appleguy I'll make the changes. It'll be much legible.

@appleguy
Copy link
Contributor

Thanks for thinking about improvements to ASButtonNode! @rcancro, @nguyenhuy, @Adlai-Holler - any ideas on a different way to do this with the current layout system, or does this seem like the best way? It does minimize exposing different properties of the stack, and we can't really expose the stack layout spec directly anyway without holding a reference to it, which is not allowed with the current design.

@appleguy appleguy added this to the 1.9.5 milestone Dec 21, 2015
@1nput0utput 1nput0utput force-pushed the ASButtonNodeExposeContentAignment branch from ad3d9bc to 108ce6d Compare December 22, 2015 19:24
@appleguy
Copy link
Contributor

@1nput0utput thank you! This is nice and clean, simple but useful!

appleguy added a commit that referenced this pull request Dec 23, 2015
…nment

[ASButtonNode] Content alignement properties for image and text.
@appleguy appleguy merged commit c020dcf into facebookarchive:master Dec 23, 2015
@appleguy appleguy modified the milestones: 1.9.4, 1.9.5 Dec 23, 2015
peter-iakovlev pushed a commit to peter-iakovlev/AsyncDisplayKit that referenced this pull request Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants