MyreMylar / pygame_gui

A GUI system for pygame.
MIT License
698 stars 83 forks source link

UIDropDownMenu does not work with negative relative rect #179

Closed RocketRider closed 2 years ago

RocketRider commented 3 years ago

I want my elements to be relative to the right border, so I am using negative positions:

self._anchors = {'left': 'right', 'right': 'right', 'top': 'top', 'bottom': 'top'}
self.request_cs_spinner = pygame_gui.elements.UIDropDownMenu(relative_rect=pygame.Rect((-275, 220), (200, 30)),
                                                                     options_list=["1", "2"], manager=self._ui_manager,
                                                                     anchors=self._anchors, starting_option="1")

This results in an empty box. image

When I do the same with a "normal" position it works as expected:

        self.request_cs_spinner = pygame_gui.elements.UIDropDownMenu(relative_rect=pygame.Rect((275, 220), (200, 30)),
                                                                     options_list=["1", "2"], manager=self._ui_manager,
                                                                     anchors=self._anchors, starting_option="1")

With other elements, like buttons, it works as expected.

I tested it with 0.57, branch 'version_060' and the master. I am using pygame 2.0.0.

RocketRider commented 3 years ago

UIWindow seems to have the same issue

MyreMylar commented 3 years ago

I'll investigate this.