Skip to content

Commit

Permalink
Rolled back some ListItem changes that triggered unwanted interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
abey79 committed Jan 30, 2024
1 parent 7f57f40 commit b4084fe
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crates/re_ui/src/list_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,14 @@ impl<'a> ListItem<'a> {
}

// Handle buttons
// Note: `response.hovered()` always returns `false` when a drag is in process, which is the desired
// behavior as we don't want to display the buttons while dragging.
let button_response = if self.active && response.hovered() {
// Note: We should be able to just use `response.hovered()` here, which only returns `true` if no drag is in
// progress. Due to the response merging we do above, this breaks though. This is why we do an explicit
// rectangle and drag payload check.
//TODO(ab): refactor responses to address that.
let should_show_buttons = self.active
&& ui.rect_contains_pointer(rect)
&& !egui::DragAndDrop::has_any_payload(ui.ctx());
let button_response = if should_show_buttons {
if let Some(buttons) = self.buttons_fn {
let mut ui =
ui.child_ui(rect, egui::Layout::right_to_left(egui::Align::Center));
Expand Down

0 comments on commit b4084fe

Please sign in to comment.