mirror of
https://github.com/ratatui-org/ratatui
synced 2025-02-16 14:08:44 +00:00
docs(custom_widget): make button sticky when clicking with mouse (#561)
This commit is contained in:
parent
089f8ba66a
commit
e5caf170c8
1 changed files with 6 additions and 2 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue