Skip to content

Commit

Permalink
docs(custom_widget): make button sticky when clicking with mouse (rat…
Browse files Browse the repository at this point in the history
  • Loading branch information
kdheepak authored and IlyaSelivanov committed Oct 16, 2023
1 parent 21209ef commit fb8fd52
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/custom_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,12 @@ fn handle_mouse_event(
_ => 2,
};
if old_selected_button != *selected_button {
button_states[old_selected_button] = State::Normal;
button_states[*selected_button] = State::Selected;
if button_states[old_selected_button] != State::Active {
button_states[old_selected_button] = State::Normal;
}
if button_states[*selected_button] != State::Active {
button_states[*selected_button] = State::Selected;
}
}
}
MouseEventKind::Down(MouseButton::Left) => {
Expand Down

0 comments on commit fb8fd52

Please sign in to comment.