royibernthal Posted June 28, 2017 Share Posted June 28, 2017 How can I make the TextBlock's size fit its parent size the way this buttons does? http://www.babylonjs-playground.com/#ZI9AK7#16 Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 28, 2017 Share Posted June 28, 2017 It is possible somehow. But I think that you should change the textBlock.text not the textBlock. And width and height is probably the canvas size. And I am unsure that % must be written in apostrophees. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 28, 2017 Author Share Posted June 28, 2017 Width and height by default I think are 1, which means '100%'. If you write it like that then apostrophees are required, otherwise you can write a number between 0-1 which will be interpreted as %. The thing is the dimensions in percentage don't affect the text size, neither does scale. By changing textBlock.text do you mean changing the font size? Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 28, 2017 Share Posted June 28, 2017 3 hours ago, royibernthal said: Width and height by default I think are 1, which means '100%'. If you write it like that then apostrophees are required, otherwise you can write a number between 0-1 which will be interpreted as %. The thing is the dimensions in percentage don't affect the text size, neither does scale. By changing textBlock.text do you mean changing the font size? Ok the percentage is correct... I am not using GUI a lot so I may be wrong. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 29, 2017 Author Share Posted June 29, 2017 I'm not really sure what you're suggesting to be honest Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Share Posted June 29, 2017 6 hours ago, royibernthal said: I'm not really sure what you're suggesting to be honest To make the text fit the plane. Like the text is equivalent to 100% of the plane. But, the text there is tiny. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 29, 2017 Author Share Posted June 29, 2017 Well, that's what I'm trying to do, that's the issue. Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Share Posted June 29, 2017 10 minutes ago, royibernthal said: Well, that's what I'm trying to do, that's the issue. Lol I thought you were asking what is the question about and I didn't read the username. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 29, 2017 Share Posted June 29, 2017 As we already discussed: you can't unless using brute force to find the good fontSize Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 29, 2017 Author Share Posted June 29, 2017 Right I forgot I don't have a problem with manually selecting the right font size, but is a huge font size the best option? Won't it hurt performance? At the moment locally I'm using fontSize 500. http://www.babylonjs-playground.com/#ZI9AK7#18 Quote Link to comment Share on other sites More sharing options...
Borislav Posted June 29, 2017 Share Posted June 29, 2017 5 hours ago, royibernthal said: Right I forgot I don't have a problem with manually selecting the right font size, but is a huge font size the best option? Won't it hurt performance? At the moment locally I'm using fontSize 500. http://www.babylonjs-playground.com/#ZI9AK7#18 It won't hurt the performance. And following statistics I can say it is ok to put big text. Before: 60 fps After: 60 fps No Change Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 29, 2017 Author Share Posted June 29, 2017 On computer I can run crazy things on 60 fps, I wonder though if it's best practice, and if not - what is. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.