garrynewman / GWEN

Abandoned: GWEN - GUI Without Extravagant Nonsense.
MIT License
427 stars 102 forks source link

Fixed Menus resizing themselves to fit the canvas, based on their position relative to their parents instead of the canvas. #74

Closed MathiasPius closed 8 years ago

MathiasPius commented 11 years ago

Fixed Menus rendering only as shadows when drawing to a parent with negative Y-coordinates relative to its canvas.

The Menu::Layout function alters the height of the menu to fit the canvas, but uses only the coordinate relative to its parent to check if it fits, instead of the bounds relative to the canvas.

The problem was resolved by using LocalToCanvas() in place of Y() for comparing the position of the menu relative to the canvas.

Fixed the SFML2 renderer returning a height of 0 when MeasureText is called with an empty space (as is done in the multi-line label), resulting in the multi-line label sample rendering all the lines superpositioned.

The SFML2 renderer and OpenGL renderer now returns matching height values for strings. Additionally, I noticed that prior to this fix the SFML2 renderer took newlines into account when calculating text height, so a string like "X\nX" would return a height more than double that of what "X" would yield. This is not the case for the OpenGL renderer, so I'm unsure of whether this is intended or not.

MathiasPius commented 11 years ago

It'd be great if I could get some feedback on this tiny patch. Is this pull request poorly formatted or has it just been overlooked?