Skip to content
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

fix(core): 🐛 allow children to be hit outside the boundaries for non-… #676

Merged
merged 1 commit into from
Dec 22, 2024

Conversation

M-Adoo
Copy link
Collaborator

@M-Adoo M-Adoo commented Dec 22, 2024

…fixed-size container

Purpose of this Pull Request

As described in the title.

Checklist Before Merging

Please ensure the following are completed before merging:

  • If this is linked to an issue, include the link in your description.
  • If you've made changes to the code or documentation, make sure these are updated in the CHANGELOG.md file.
  • If you've introduced any break changes, briefly describe them in the Breaking section of the CHANGELOG.md file.

Additional Information

The bot will replace #pr in CHANGELOG.md with your pull request number. If your branch is out of sync, use git pull --rebase to update it.

If you're unsure about which branch to submit your Pull Request to, or when it will be released after being merged, please refer to our Release Guide.

If you're working on a widget and need help writing test cases, we have some macros that can assist you. Please refer to the Ribir Dev Helper documentation.

@M-Adoo M-Adoo enabled auto-merge December 22, 2024 04:03
@github-actions github-actions bot force-pushed the fix/hit-outside-container branch from 6431977 to a9d99a4 Compare December 22, 2024 04:03
@M-Adoo M-Adoo added the B-test Notify bot to start testing label Dec 22, 2024
@M-Adoo M-Adoo force-pushed the fix/hit-outside-container branch from a9d99a4 to bc28408 Compare December 22, 2024 04:06
@M-Adoo M-Adoo added B-test Notify bot to start testing and removed B-test Notify bot to start testing labels Dec 22, 2024
@M-Adoo M-Adoo force-pushed the fix/hit-outside-container branch from bc28408 to f200c57 Compare December 22, 2024 05:42
@M-Adoo M-Adoo added B-test Notify bot to start testing and removed B-test Notify bot to start testing labels Dec 22, 2024
let rect = ctx.widget_box_rect(c).unwrap();
size = size.max(rect.max().to_vector().to_size());
let child_size = ctx.perform_child_layout(c, stack_clamp);
size = size.max(child_size);
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems the size should be expand by the position + size_box? it seems a bit strange, if it just with red background in a top_left corner, as the example bellow:

stack! {
    background: Color::RED,
    @SizedBox {
        anchor: Anchor::left_top(100., 100.),
        size: Size::new(100., 100.),
    }
 }

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I want to keep the layout simple and consistent. If we make the size bigger towards the bottom right, why not make it bigger towards the top left if a child is in a negative position?

I set the stack's size to fit its children, ignoring their positions. This way allow their children hit and paint outside the stack.

@M-Adoo M-Adoo added this pull request to the merge queue Dec 22, 2024
Merged via the queue into RibirX:master with commit 956f393 Dec 22, 2024
15 checks passed
@M-Adoo M-Adoo deleted the fix/hit-outside-container branch December 22, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-test Notify bot to start testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants