fix(segmented-button): hover style not being applied

This commit is contained in:
Michael Aaron Murphy 2023-01-19 22:32:58 +01:00
parent f386609414
commit e9766389c4
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
2 changed files with 3 additions and 4 deletions

View file

@ -11,7 +11,6 @@ mod selection;
pub use self::selection::{MultiSelect, Selectable, SingleSelect};
use crate::widget::IconSource;
use crate::Element;
use slotmap::{SecondaryMap, SlotMap};
use std::any::{Any, TypeId};
use std::borrow::Cow;

View file

@ -298,13 +298,13 @@ where
let bounds = self.variant_button_bounds(bounds, nth);
if bounds.contains(cursor_position) {
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 Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
| Event::Touch(touch::Event::FingerLifted { .. }) = event
{
// Record that the mouse is hovering over this button.
state.hovered = key;
shell.publish(on_activate(key));
return event::Status::Captured;
}