ppizarror / pygame-menu

A menu for pygame. Simple, and easy to use
https://pygame-menu.readthedocs.io/
Other
555 stars 141 forks source link

Dropselect content position incorrect during floating + translate #418

Closed jsgithub20 closed 1 year ago

jsgithub20 commented 2 years ago

Environment information Describe your environment information, such as:

Describe the bug When the Dropselect widget is set to float with a "translate" position, the content box (pull-down list) occurs away from the Dropselect widget when clicking the arrow to the right end of the Dropselect widget

To Reproduce The following code reproduce the phenomenon selector_map = sub_menu1.add.dropselect( title='', items=[("Map0", 0), ("Map1", 1), ("Map3", 2)], font_size=26, selection_box_width=173, selection_box_height=100, selection_option_padding=(0, 5), selection_option_font_size=20 ) selector_map.set_float(True, False, True) selector_map.translate(650, 100)

Expected behavior When the Dropselect widget is move to a "translate" position, the pull-down list should occur at the normal position when clicked.

Additional context Making the following change (remark the two lines) to "dropselect.py" fix this issue: def translate(self, x: NumberType, y: NumberType) -> 'DropSelect': super(DropSelect, self).translate(x, y)

if self._drop_frame is not None:

    #     self._drop_frame.translate(x, y)
    return self
ppizarror commented 2 years ago

Hi, I'll check it out asap :)

ppizarror commented 1 year ago

Indeed on May 10 I done exactly the same https://github.com/ppizarror/pygame-menu/pull/408 ... sorry for the extreme delay. Today I updated the library to v4.3.0, which incorporates this patch.

Greetings! 😄