royibernthal Posted October 5, 2017 Share Posted October 5, 2017 Deltakosh we discussed this in the past, I'd like TextBlocks to automatically set their own width and height according to their measured text size, instead of having to manually set it for each case - which seems tedious and redundant to me. It should be very possible to the best of my understanding, something along the lines of finding the max width among the parsed lines and the combined height of all lines according to rootY and fontOffset in _renderLines(). https://github.com/BabylonJS/Babylon.js/blob/master/gui/src/controls/textBlock.ts What do you think? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted October 5, 2017 Share Posted October 5, 2017 how do normal html inputs establish their initial size? Quote Link to comment Share on other sites More sharing options...
royibernthal Posted October 5, 2017 Author Share Posted October 5, 2017 I'm not sure I understand, how is it related to the subject? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted October 5, 2017 Share Posted October 5, 2017 whoops, I thought the textblock was the text input for the GUI... just a brain fart I forgot its for displaying basic text. Nevermind. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted October 5, 2017 Author Share Posted October 5, 2017 Thought as much, no problem Deltakosh what do you think? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 6, 2017 Share Posted October 6, 2017 Do you want to start a PR? we could then discuss over it Quote Link to comment Share on other sites More sharing options...
royibernthal Posted October 8, 2017 Author Share Posted October 8, 2017 Sure, here you go: https://github.com/BabylonJS/Babylon.js/pull/2915 Quote Link to comment Share on other sites More sharing options...
focomoso Posted March 14, 2018 Share Posted March 14, 2018 Did this make it into the stable version? I'm trying to use getRawFontSize() in v3.2.0-alpha10, but it's throwing an error. Or is there another way to get the actual width of GUI text? Quote Link to comment Share on other sites More sharing options...
Guest Posted March 15, 2018 Share Posted March 15, 2018 http://www.babylonjs-playground.com/#44KYLP#3 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.