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

Always allocate area for the DockArea. #143

Merged
merged 3 commits into from
Jun 16, 2023
Merged

Conversation

Adanos020
Copy link
Owner

Fixes #142

The bug and the fix are trivial:

fn allocate_area_for_root(&mut self, ui: &mut Ui) {
    let style = self.style.as_ref().unwrap();
    let mut rect = ui.available_rect_before_wrap();

    if let Some(margin) = style.dock_area_padding {
        rect.min  = margin.left_top();
        rect.max -= margin.right_bottom();
        ui.painter().rect(
            rect,
            margin.top,
            style.separator.color_idle,
            Stroke::new(margin.top, style.border.color),
        );
    }

    if self.tree.is_empty() {
        ui.allocate_rect(rect, Sense::hover()); // <------ THIS SHOULDN'T BE IN THIS BRANCH
        return;
    }

    self.tree[NodeIndex::root()].set_rect(rect);
}

@Adanos020 Adanos020 merged commit 45d3403 into main Jun 16, 2023
4 checks passed
@Adanos020 Adanos020 deleted the fix-dockarea-in-group branch June 16, 2023 19:08
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.

Dock doesn't appear to have a size set after crate update
1 participant