Skip to content

fix:Panel2D works with only size provided, no borders#1168

Open
suchiii29 wants to merge 2 commits intofury-gl:v2from
suchiii29:fix/panel2d-without-borders
Open

fix:Panel2D works with only size provided, no borders#1168
suchiii29 wants to merge 2 commits intofury-gl:v2from
suchiii29:fix/panel2d-without-borders

Conversation

@suchiii29
Copy link
Copy Markdown

Hey! I was going through the issues and found that Panel2D crashes
when you create it with just the size and no border arguments.

The problem was that self.borders was never initialized when
has_border=False, so _get_actors() and _update_actors_position()
were failing trying to access it.

I fixed it by:

  • setting self.borders = {} when has_border is False
  • adding has_border checks before accessing borders in the two methods

Tested it locally and it works fine now.

Fixes #1155

Copy link
Copy Markdown

@VanshAgarwal24036 VanshAgarwal24036 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch on the issue and fix.

One suggestion: it might be helpful to add a small regression test to verify that Panel2D works properly when has_border=False (e.g., adding actors, updating positions, and adding the panel to a scene).

Also, I noticed the PR removes the commented TabPanel2D class. Since this change is unrelated to the issue being fixed here, it might be better to restore that commented section in this PR.

@suchiii29
Copy link
Copy Markdown
Author

Thanks for the review! I've restored the commented TabPanel2D section. I'll add a regression test for the fix too, working on it now.

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.

Panel2D Does not work without borders

2 participants