Skip to content

Commit

Permalink
Fix a drag-and-drop display regression (#8228)
Browse files Browse the repository at this point in the history
### Related

* Closes #8204

### What

This PR fix a display regression introduced in 0.17

#### 0.16


https://github.com/user-attachments/assets/6855b0e0-b5d7-415d-9ea5-e8d51d3111fa

#### 0.17

Note the busy hover highlight and the confusing target-container white
frame.


https://github.com/user-attachments/assets/08085dca-3150-4f01-9d51-c3e981c08651

#### This PR



https://github.com/user-attachments/assets/c100b858-4d97-45f2-85a2-ea17e3f9d0c5
  • Loading branch information
abey79 authored and teh-cmc committed Nov 28, 2024
1 parent 90f97ab commit ce90d47
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 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 @@ -389,13 +386,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

0 comments on commit ce90d47

Please sign in to comment.