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 a drag-and-drop display regression #8228

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions crates/viewer/re_ui/src/list_item/list_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

use egui::{NumExt, Response, Shape, Ui};

use crate::{
list_item::{ContentContext, DesiredWidth, LayoutInfoStack, ListItemContent},
ContextExt as _,
};
use crate::list_item::{ContentContext, DesiredWidth, LayoutInfoStack, ListItemContent};
use crate::{DesignTokens, UiExt as _};

struct ListItemResponse {
Expand Down Expand Up @@ -338,6 +335,10 @@ impl ListItem {
style_response.hovered = true;
}

if egui::DragAndDrop::has_any_payload(ui.ctx()) {
//style_response.hovered = false;
}
abey79 marked this conversation as resolved.
Show resolved Hide resolved

let mut collapse_response = None;

let visuals = ui.style().interact_selectable(&style_response, selected);
Expand Down Expand Up @@ -389,13 +390,20 @@ impl ListItem {
if drag_target {
ui.painter().set(
background_frame,
Shape::rect_stroke(bg_rect_to_paint, 0.0, ui.ctx().hover_stroke()),
Shape::rect_stroke(
bg_rect_to_paint.expand(-1.0),
0.0,
egui::Stroke::new(1.0, ui.visuals().selection.bg_fill),
),
);
}

let bg_fill = force_background.or_else(|| {
if !drag_target && interactive {
if !response.hovered() && ui.rect_contains_pointer(bg_rect) {
if !response.hovered()
&& ui.rect_contains_pointer(bg_rect)
&& !egui::DragAndDrop::has_any_payload(ui.ctx())
{
// if some part of the content is active and hovered, our background should
// become dimmer
Some(visuals.bg_fill)
Expand Down
Loading