Skip to content

Commit

Permalink
Merge pull request #655 from MyreMylar/fix-text-hyper-link-mousescroll
Browse files Browse the repository at this point in the history
Fixing hyperlinks after mousewheel
  • Loading branch information
MyreMylar authored Nov 10, 2024
2 parents 8235cd8 + 19059d7 commit 4caccad
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pygame_gui/elements/ui_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ def __init__(self,
parent_element=parent_element,
object_id=object_id,
anchors=anchors,
visible=visible)
visible=visible,
should_grow_automatically=True)

self._create_valid_ids(container=container,
parent_element=parent_element,
Expand Down
2 changes: 1 addition & 1 deletion pygame_gui/elements/ui_scrolling_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self,
element_id: Union[List[str], None] = None,
anchors: Optional[Dict[str, Union[str, UIElement]]] = None,
visible: int = 1,
should_grow_automatically: bool = True,
should_grow_automatically: bool = False,
allow_scroll_x: bool = True,
allow_scroll_y: bool = True,
):
Expand Down
4 changes: 3 additions & 1 deletion pygame_gui/elements/ui_text_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ def __init__(self,
self.copy_text_enabled = True
self.paste_text_enabled = False

self.has_edit_cursor = False

self.rebuild_from_changed_theme_data()

@property
Expand Down Expand Up @@ -461,7 +463,7 @@ def update(self, time_delta: float):
self.edit_position = self.select_range[1]
self.cursor_has_moved_recently = True

if self.cursor_has_moved_recently:
if self.cursor_has_moved_recently and self.has_edit_cursor:
self.cursor_has_moved_recently = False

self.text_box_layout.set_cursor_position(self.edit_position)
Expand Down
1 change: 1 addition & 0 deletions pygame_gui/elements/ui_text_entry_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self,
self.text_box_rows = 0

self.cursor_on = False
self.has_edit_cursor = True

self.should_redraw_from_text_block = False

Expand Down
3 changes: 2 additions & 1 deletion tests/test_elements/test_ui_scrolling_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ def test_show_hide_rendering(self, _init_pygame, default_ui_manager, _display_su

container = UIScrollingContainer(relative_rect=pygame.Rect(100, 100, 200, 100),
manager=manager,
visible=0)
visible=0,
should_grow_automatically=True)
button_1 = UIButton(relative_rect=pygame.Rect(300, 100, 150, 30),
text="Test Button",
tool_tip_text="This is a test of the button's tool tip functionality.",
Expand Down

0 comments on commit 4caccad

Please sign in to comment.