Skip to content

Commit

Permalink
Update response api and allow clicking of buttons inside the handle.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Jul 12, 2023
1 parent f262272 commit fb3a833
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 71 deletions.
11 changes: 5 additions & 6 deletions examples/scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,19 @@ fn main() -> eframe::Result<()> {
.show(ui, |ui| {
let response = dnd.ui::<ItemType, _>(ui, items.iter_mut(), |item, ui, handle, dragging| {
ui.horizontal(|ui| {
if handle.ui_impl(ui, Some(Sense::click()), |ui| {
if handle.ui(ui, |ui| {
ui.label("grab");
// if ui.button("click me").clicked() {
// println!("clicked");
// }
}).clicked() {
println!("clicked {}", item.number);
}
ui.label(&item.number.to_string());
});
});

if let Some(response) = response.completed {
let from = response.from;
let to = response.to;
shift_vec(from, to, &mut items)
}
response.update_vec(&mut items);
})
});

Expand Down
Loading

0 comments on commit fb3a833

Please sign in to comment.