royibernthal Posted September 5, 2017 Share Posted September 5, 2017 Deltakosh - When using adaptive scaling it'd be great to have all Text Blocks font sizes adapt to the resized stage automatically instead of scaling / resizing the Text Blocks - which looks very poor. I'm actually doing on PIXI something similar and it works great: Quote fontSize = Math.floor(idealFontSize * newWidth / idealWidth); For instance, the idealWidth (of the stage) is 800, at that size the "idealFontSize" is 36. When the window is resized to the width 400, the new font size of the Text Block will be 18. (36*400/800) When applying this solution, naturally any other kind of scaling / resizing can't be applied to Text Blocks. What do you think? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 5, 2017 Share Posted September 5, 2017 Hello, fontSize already support automatic scaling: https://www.babylonjs-playground.com/#51J3JL Quote Link to comment Share on other sites More sharing options...
royibernthal Posted September 5, 2017 Author Share Posted September 5, 2017 Hmm true, I noticed a bug though - The font size is only adapted while the text block is added to stage, it should be adapted on addControl as well. Try to remove the text block, resize the window, then add the text block again: https://www.babylonjs-playground.com/#51J3JL#2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 6, 2017 Share Posted September 6, 2017 Seems to work for me The fontSize is correct even after adding the control again Quote Link to comment Share on other sites More sharing options...
royibernthal Posted September 6, 2017 Author Share Posted September 6, 2017 Step 1: resize window to smallest Step 2: hide Step 3: resize window to biggest Step 4: show Result: Very small text until resized again Still correct for you? I'm using the latest Chrome on Windows 10 and I made sure to clear my cache. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 6, 2017 Share Posted September 6, 2017 Ok gotcha!. Let me try to fix that Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 6, 2017 Share Posted September 6, 2017 Ok fixed! Will be available in a couple of minutes royibernthal 1 Quote Link to comment Share on other sites More sharing options...
royibernthal Posted September 6, 2017 Author Share Posted September 6, 2017 Great thanks 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.