Small request - vertically align the text object?

Discussion and feedback on Construct 2

Post » Mon Jun 25, 2012 8:30 pm

Could it be possible to make the text object have a vertical alignment property like the horizontal alignment property? It's kind of hard to center the alignment vertically currently.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Tue Jun 26, 2012 6:37 am

Have you tried using the editor grid?
B
42
S
11
G
5
Posts: 446
Reputation: 6,417

Post » Tue Jun 26, 2012 7:24 am

That won't work for what I want to do with it because I want to position it dynamically at runtime.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Tue Jun 26, 2012 8:02 am

i've you try to use the textheight property ? ... (you can only get the textheight a tick after a new text is updated in a text object, so you need perhaps to get the textheight on every tick and change Y pos dynamically)naelian2012-06-26 08:13:01
B
16
S
5
G
3
Posts: 298
Reputation: 5,240

Post » Tue Jun 26, 2012 8:14 pm

yeah Id go with what naelian said. Get the height of the text (or just use a static size if it doesnt change) and then set its y to viewheight/2-(height/2)

if the text objects hotspot is in the center thatll center it on the screen regardless of size
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Tue Jun 26, 2012 11:54 pm

Oh hey, I didn't realize that expression existed. Thanks!
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Wed Jul 18, 2012 5:20 pm

I would also like to have a 'Vertical alignment' property (top, middle, bottom) of the text object. This would be useful when you for instance have a clickable menu, and wish to have a symmetrical space around the text where you can click.

Is this something that can be implemented?
B
20
S
5
G
4
Posts: 51
Reputation: 4,139

Post » Wed Jul 18, 2012 10:59 pm

Subscribe.

I have some dynamic text that is prepared to be max. 3 lines. Sometimes it's 3 lines long but sometimes it's 2 or 1. I want that text to be centered vertically, so if only 1 or 2 lines of text are present, the remaining space (at top and bottom) are equal.

If this could be implemented would be really great! :D
B
8
S
1
Posts: 19
Reputation: 724

Post » Thu Jul 19, 2012 12:18 am

I'll see if I can add it for the next build.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Jul 19, 2012 4:47 am

Awesome, thanks Ashley!
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Artpunk and 14 guests