royibernthal Posted June 5, 2017 Share Posted June 5, 2017 Alignment doesn't work properly when applying scale. For instance in this case the red rectangle should be aligned left: http://www.babylonjs-playground.com/#XCPP9Y#68 I'm getting the impression that under the hood it is first aligned then scaled, while it should probably be the opposite. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 6, 2017 Share Posted June 6, 2017 Also I also noticed that the red box is not really centered in the middle, but slightly offset. I noticed this also with text and buttons in the rectangle, the difference is some 2 pixels (2px). We can see this button, the text is slightly offset to the left and not perfectly centered. http://www.babylonjs-playground.com/#XCPP9Y#75 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 7, 2017 Share Posted June 7, 2017 Transforms are applied AFTER everything. I will improve the doc for this. You must play with width and height if you want to have alignment takes it in account Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 7, 2017 Share Posted June 7, 2017 @Dad72 I also fixed the alignment issue Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 7, 2017 Share Posted June 7, 2017 Ah, yes, it's perfect now. thank you DK Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 8, 2017 Author Share Posted June 8, 2017 20 hours ago, Deltakosh said: You must play with width and height if you want to have alignment takes it in account How can I do that? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 8, 2017 Share Posted June 8, 2017 just change width and height properties instead of scaling if you want to scale the control and still takes the alignement in account Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 8, 2017 Author Share Posted June 8, 2017 Oh I understand. Out of curiosity, what's the reason you don't apply scale before alignment? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 9, 2017 Share Posted June 9, 2017 Because the transform at applied by the canvas itself when drawing Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 9, 2017 Author Share Posted June 9, 2017 Got it 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.