Skip to content

why does dnd_drop_zone overwrite frame colors? #4331

Answered by j-n-f
j-n-f asked this question in Q&A
Discussion options

You must be logged in to vote

The workaround looks like this:

// Layout used to create an isolated context for style changes. May be a better way to do this.
ui.with_layout(egui::Layout::default(), |ui| {
    // when `dnd_drop_zone` overrides color, it will use this
    ui.visuals_mut().widgets.inactive.bg_fill = egui::Color32::TRANSPARENT;

    // this will be the displayed color of the drop zone
    let color_frame = egui::Frame::default().fill(egui::Color32::BLACK)
        .show(ui, |ui| {
            let drop_frame = egui::Frame::default();
            // We have control over drop zone color
            ui.dnd_drop_zone::<Location, ()>(drop_frame, |ui| { /* ... */ })
        });
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by j-n-f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant