refactor(touchpad): convert some toggles to radios
Closes #287 Closes #288
This commit is contained in:
parent
15833bc254
commit
144ea0fbd6
1 changed files with 30 additions and 49 deletions
|
|
@ -135,35 +135,21 @@ fn click_behavior() -> Section<crate::pages::Message> {
|
||||||
|
|
||||||
settings::view_section(&*section.title)
|
settings::view_section(&*section.title)
|
||||||
// Secondary click via two fingers, and middle-click via three fingers
|
// Secondary click via two fingers, and middle-click via three fingers
|
||||||
.add(
|
.add(settings::item_row(vec![widget::radio(
|
||||||
settings::item::builder(&*CLICK_BEHAVIOR_CLICK_FINGER).toggler(
|
&*CLICK_BEHAVIOR_CLICK_FINGER,
|
||||||
page.input_touchpad
|
ClickMethod::Clickfinger,
|
||||||
.click_method
|
page.input_touchpad.click_method,
|
||||||
.as_ref()
|
|option| Message::SetSecondaryClickBehavior(Some(option), true),
|
||||||
.map_or(false, |x| matches!(x, ClickMethod::Clickfinger)),
|
|
||||||
|enabled| {
|
|
||||||
Message::SetSecondaryClickBehavior(
|
|
||||||
enabled.then_some(ClickMethod::Clickfinger),
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
.into()]))
|
||||||
// Secondary and middle-click via button areas.
|
// Secondary and middle-click via button areas.
|
||||||
.add(
|
.add(settings::item_row(vec![widget::radio(
|
||||||
settings::item::builder(&*CLICK_BEHAVIOR_BUTTON_AREAS).toggler(
|
&*CLICK_BEHAVIOR_BUTTON_AREAS,
|
||||||
page.input_touchpad
|
ClickMethod::ButtonAreas,
|
||||||
.click_method
|
page.input_touchpad.click_method,
|
||||||
.as_ref()
|
|option| Message::SetSecondaryClickBehavior(Some(option), true),
|
||||||
.map_or(false, |x| matches!(x, ClickMethod::ButtonAreas)),
|
|
||||||
|enabled| {
|
|
||||||
Message::SetSecondaryClickBehavior(
|
|
||||||
enabled.then_some(ClickMethod::ButtonAreas),
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
.into()]))
|
||||||
.add(
|
.add(
|
||||||
settings::item::builder(&*TAP_TO_CLICK).toggler(
|
settings::item::builder(&*TAP_TO_CLICK).toggler(
|
||||||
page.input_touchpad
|
page.input_touchpad
|
||||||
|
|
@ -196,32 +182,27 @@ fn scrolling() -> Section<crate::pages::Message> {
|
||||||
|
|
||||||
settings::view_section(§ion.title)
|
settings::view_section(§ion.title)
|
||||||
// Two-finger scrolling toggle
|
// Two-finger scrolling toggle
|
||||||
.add(
|
.add(settings::item_row(vec![widget::radio(
|
||||||
settings::item::builder(&*super::SCROLLING_TWO_FINGER).toggler(
|
&*super::SCROLLING_TWO_FINGER,
|
||||||
page.input_touchpad
|
ScrollMethod::TwoFinger,
|
||||||
.scroll_config
|
page.input_touchpad
|
||||||
.as_ref()
|
.scroll_config
|
||||||
.map_or(false, |x| matches!(x.method, Some(ScrollMethod::TwoFinger))),
|
.as_ref()
|
||||||
|enabled| {
|
.and_then(|x| x.method),
|
||||||
Message::SetScrollMethod(
|
|option| Message::SetScrollMethod(Some(option), true),
|
||||||
enabled.then_some(ScrollMethod::TwoFinger),
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
.into()]))
|
||||||
// Edge scrolling toggle
|
// Edge scrolling toggle
|
||||||
.add(
|
.add(settings::item_row(vec![widget::radio(
|
||||||
settings::item::builder(&*super::SCROLLING_EDGE).toggler(
|
&*super::SCROLLING_EDGE,
|
||||||
page.input_touchpad
|
ScrollMethod::Edge,
|
||||||
.scroll_config
|
page.input_touchpad
|
||||||
.as_ref()
|
.scroll_config
|
||||||
.map_or(false, |x| matches!(x.method, Some(ScrollMethod::Edge))),
|
.as_ref()
|
||||||
|enabled| {
|
.and_then(|x| x.method),
|
||||||
Message::SetScrollMethod(enabled.then_some(ScrollMethod::Edge), true)
|
|option| Message::SetScrollMethod(Some(option), true),
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
.into()]))
|
||||||
// Scroll speed slider
|
// Scroll speed slider
|
||||||
.add(settings::item(&*super::SCROLLING_SPEED, {
|
.add(settings::item(&*super::SCROLLING_SPEED, {
|
||||||
let value = page
|
let value = page
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue