Closed rugubara closed 9 months ago
I was a bit confused with the anchoring system as well, but x and y values need to be negative in order for it to be placed properly.
so you will need to set:
panelRect.x = -panelRect.x - panelRect.width
and
panelRect.y = -panelRect.y - panelRect.height
before creating the panel. The coordinates of the relative rectangle will place the top left of the panel relative to the bottom right of the container.
This should fix the issue, however I do admit that we should not have to subtract the width and height from the positions in order to properly place the panel. @MyreMylar should look into this
Describe the bug Alignment of UIPanel and UILabel using anchor = {'right': 'right'} hides the element being aligned.
To Reproduce baseRect is the bounding rect of the pygame surface
Run and observe no panel
replace right with left or centerx - and observe the correct placement of the panel.
Repeat for UILabel and observe similar behaviour
Expected behaviour I expected to see that the userConfigPanel is placed glued to the top and right edges of the optionsPanel.
Screenshots Operation with anchor={'right': 'right'} Operation with anchor={'left': 'left'}
Platform and software (please complete the following information):
Additional context The output of the pygame-gui debug:
Layer: 0
root_container: thickness - 3
Layer: 1
panel panel.#panel_container: thickness - 2
Layer: 2
panel.panel panel.panel.#panel_container: thickness - 0
Full code of the method, creating the UI: