Skip to content

ScrollBar (at_bottom, at_top) #493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2025
Merged

Conversation

JaskRendix
Copy link
Contributor

@JaskRendix JaskRendix commented Mar 22, 2025

PR refactors the ScrollBar widget.

  • introduced _update_slider_position_flags() to manage the _at_bottom and _at_top flags, ensuring they reflect the slider's position
  • created _update_slider_rect() to centralize the logic for updating the slider's rectangle, reducing code duplication
  • created _set_slider_position() to set the slider's position, update the rectangle, update the flags, and render, making it easier to manage slider changes
  • added is_at_bottom() and is_at_top() to provide ways to check the slider's position
  • implemented bump_to_top() and bump_to_bottom() for easy movement to the slider's extreme positions
  • extracted mouse event handling into _handle_mouse_event() and touch event handling into _handle_touch_event(), making the update() method less cluttered
  • extracted the render shadow code into _render_shadow()
  • added new unittest

could you add it to the pygame-menu-ce?

@ppizarror
Copy link
Owner

Hi @JaskRendix . Do you think you will add future changes? to wait them for publishing the new v4.5.2

@JaskRendix
Copy link
Contributor Author

@ppizarror the main ones were bottom_to_top and top_to_bottom, so no need to hurry

@ppizarror ppizarror merged commit 8f2eea5 into ppizarror:master Mar 24, 2025
10 checks passed
@ppizarror
Copy link
Owner

@JaskRendix. Today I just updated https://pypi.org/project/pygame-menu-ce/ to the latest version. Let me know if you have any issues. Greetings!

@JaskRendix JaskRendix deleted the patch-1 branch March 24, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants