fix(segmented-button): hover style not being applied
This commit is contained in:
parent
f386609414
commit
e9766389c4
2 changed files with 3 additions and 4 deletions
|
|
@ -11,7 +11,6 @@ mod selection;
|
||||||
pub use self::selection::{MultiSelect, Selectable, SingleSelect};
|
pub use self::selection::{MultiSelect, Selectable, SingleSelect};
|
||||||
|
|
||||||
use crate::widget::IconSource;
|
use crate::widget::IconSource;
|
||||||
use crate::Element;
|
|
||||||
use slotmap::{SecondaryMap, SlotMap};
|
use slotmap::{SecondaryMap, SlotMap};
|
||||||
use std::any::{Any, TypeId};
|
use std::any::{Any, TypeId};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
|
||||||
|
|
@ -298,13 +298,13 @@ where
|
||||||
let bounds = self.variant_button_bounds(bounds, nth);
|
let bounds = self.variant_button_bounds(bounds, nth);
|
||||||
if bounds.contains(cursor_position) {
|
if bounds.contains(cursor_position) {
|
||||||
if self.model.items[key].enabled {
|
if self.model.items[key].enabled {
|
||||||
|
// Record that the mouse is hovering over this button.
|
||||||
|
state.hovered = key;
|
||||||
|
|
||||||
if let Some(on_activate) = self.on_activate.as_ref() {
|
if let Some(on_activate) = self.on_activate.as_ref() {
|
||||||
if let Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
if let Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
||||||
| Event::Touch(touch::Event::FingerLifted { .. }) = event
|
| Event::Touch(touch::Event::FingerLifted { .. }) = event
|
||||||
{
|
{
|
||||||
// Record that the mouse is hovering over this button.
|
|
||||||
state.hovered = key;
|
|
||||||
|
|
||||||
shell.publish(on_activate(key));
|
shell.publish(on_activate(key));
|
||||||
return event::Status::Captured;
|
return event::Status::Captured;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue