Nodragem Posted November 17, 2018 Share Posted November 17, 2018 Hello, I was wondering if there is an equivalent to the following in BABYLON.GUI: https://doc.babylonjs.com/how_to/dynamictexture#fit-text-into-an-area EDIT: I found the textBlock property resizeToFit, but that does not seem to do what I think, here a playground example: https://www.babylonjs-playground.com/#XCPP9Y#724 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 17, 2018 Share Posted November 17, 2018 Hi @Nodragem You can use fontSize = "100%" to fit fontSize to container, however, it only works for height, so width will still overflow if text is too long. Quote Link to comment Share on other sites More sharing options...
JohnK Posted November 17, 2018 Share Posted November 17, 2018 Here are some PGs playing around with width, needs more thought and work https://www.babylonjs-playground.com/#XCPP9Y#725 and with % https://www.babylonjs-playground.com/#XCPP9Y#726 Quote Link to comment Share on other sites More sharing options...
Nodragem Posted November 17, 2018 Author Share Posted November 17, 2018 wow, that is amazing @JohnK! I am going to use that. but... what is the resizeToFit property for? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 19, 2018 Share Posted November 19, 2018 I guess it forces the textblock to fit to the container. Quote Link to comment Share on other sites More sharing options...
Nodragem Posted November 24, 2018 Author Share Posted November 24, 2018 @Sebavan : as stated in the first post, that does not seem to be the case on my side, and that's why @JohnK came up with a nice solution Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 25, 2018 Share Posted November 25, 2018 @Nodragem ResizeToFit resizes the textblock, not the fontsize, perhaps it should be changed to do both. https://www.babylonjs-playground.com/#XCPP9Y#736 ( uncomment line 44 ) Quote Link to comment Share on other sites More sharing options...
Nodragem Posted November 25, 2018 Author Share Posted November 25, 2018 yep that would be nice; maybe a feature request on Github? 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.