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

ASButtonNode highlighted titles shifts to the right #3352

Open
Gazomba opened this issue Jun 4, 2019 · 2 comments
Open

ASButtonNode highlighted titles shifts to the right #3352

Gazomba opened this issue Jun 4, 2019 · 2 comments

Comments

@Gazomba
Copy link

Gazomba commented Jun 4, 2019

I have a problem with ASButtonNode and attributedTitle for different control states and using fractional size. The title becomes shifted to the left.

I behaved correctly if I use a point size for the button.

I am running texture/asyncDisplayKit 2.8.1.

/* Set title */
testButton.setAttributedTitle(NSAttributedString(string: "NORMAL"), for: .normal)
testButton.setAttributedTitle(NSAttributedString(string: "HIGHLIGHTED"), for: .highlighted)

/* styling */
/** This works
 * testButton.style.width = ASDimensionMake("120pt") 
 **/
testButton.style.width = ASDimensionMake("30%")
testButton.style.height = ASDimensionMake(120)

The title should not get shifted to the right after tapping the button. Am I missing something?

Before highlighted:
Screenshot 2019-06-04 at 08 56 35
After highlighted:
Screenshot 2019-06-04 at 08 56 39

When changing ASButtonNode.mm line 206:

[self setNeedsLayout];

to:

[_titleNode setNeedsLayout];

It works as expected.

Related Stackoverflow post: https://stackoverflow.com/questions/56439080/asbuttonnode-attributedtitle-for-different-controlstates

@appleguy
Copy link
Contributor

appleguy commented Jun 4, 2019 via email

@Gazomba
Copy link
Author

Gazomba commented Jun 10, 2019

Yeah sorry, noticed. I did for some days ago.

TextureGroup/Texture#1534

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

No branches or pull requests

2 participants