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

Setting x and y of RNText is setting top left corner of textbox not the center of the text field like everything else #71

Open
BlueByLiquid opened this issue Sep 16, 2012 · 1 comment

Comments

@BlueByLiquid
Copy link

Most objects have x, y as the center however RNText is using the top left corner of the textbox when set. For example the following code should make the text be centered at the bottom right corner of the screen but instead it is near the middle:

local clickOnTheScreen = RNFactory.createText("Click on the screen", { size = 30, top = 0, left = 0, width = 200, height = 60 })
clickOnTheScreen.x = RNFactory.width/2.0;
clickOnTheScreen.y = RNFactory.height/2.0;

As a side note it would be nice to figure out the width of the top, left, width and height for the user (though I know this is not easy.

@MattiaFortunati
Copy link
Collaborator

Yes,

RNTexts don't work as other regular RNObjects regarding coordinates.
You have to practice a little bit with them, at the moment , but it would be nice to have their coordinates to work exactly as a regular RNObject.

Also, you are right, at the moment width and height are not stored in RNTexts as accessible values to the user. This could be a fast / one line improvement.

Thanks for the issue.

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

2 participants