Skip to content

Commit

Permalink
Expand toggles click area to the hole ActionRow
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex committed Sep 18, 2024
1 parent abedc72 commit 7fd912c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
8 changes: 4 additions & 4 deletions neothesia-iced-widgets/src/segment_button/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn segment_button<T>(
kind: ButtonSegmentKind,
active: bool,
active_color: Color,
theme: &T,
_theme: &T,
status: iced_widget::button::Status,
) -> button::Style {
match status {
Expand Down Expand Up @@ -56,7 +56,7 @@ pub fn segment_button<T>(
}
iced_widget::button::Status::Hovered => {
let mut active =
segment_button(kind, active, active_color, theme, button::Status::Active);
segment_button(kind, active, active_color, _theme, button::Status::Active);

if let Some(iced_core::Background::Color(ref mut color)) = active.background {
color.r = (color.r + 0.05).min(1.0);
Expand All @@ -67,10 +67,10 @@ pub fn segment_button<T>(
active
}
iced_widget::button::Status::Pressed => {
segment_button(kind, active, active_color, theme, button::Status::Active)
segment_button(kind, active, active_color, _theme, button::Status::Active)
}
iced_widget::button::Status::Disabled => {
segment_button(kind, active, active_color, theme, button::Status::Active)
segment_button(kind, active, active_color, _theme, button::Status::Active)
}
}
}
8 changes: 4 additions & 4 deletions neothesia-iced-widgets/src/track_card/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn card<T>(_theme: &T) -> container::Style {

pub fn track_icon_button<T>(
color: iced_core::Color,
theme: &T,
_theme: &T,
status: button::Status,
) -> button::Style {
match status {
Expand All @@ -29,7 +29,7 @@ pub fn track_icon_button<T>(
..Default::default()
},
button::Status::Hovered => {
let mut active = track_icon_button(color, theme, button::Status::Active);
let mut active = track_icon_button(color, _theme, button::Status::Active);

if let Some(iced_core::Background::Color(ref mut color)) = active.background {
color.r = (color.r + 0.05).min(1.0);
Expand All @@ -39,7 +39,7 @@ pub fn track_icon_button<T>(

active
}
button::Status::Pressed => track_icon_button(color, theme, button::Status::Active),
button::Status::Disabled => track_icon_button(color, theme, button::Status::Active),
button::Status::Pressed => track_icon_button(color, _theme, button::Status::Active),
button::Status::Disabled => track_icon_button(color, _theme, button::Status::Active),
}
}
26 changes: 17 additions & 9 deletions neothesia/src/scene/menu_scene/iced_menu/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use iced_core::{
Alignment, Length, Padding,
};
use iced_runtime::Task;
use iced_widget::{button, column as col, container, pick_list, row, toggler};
use iced_widget::{button, column as col, container, mouse_area, pick_list, row, toggler};
use neothesia_iced_widgets::{ActionRow, BarLayout, Element, Layout, NeoBtn, PreferencesGroup};

use crate::{context::Context, output_manager::OutputDescriptor, scene::menu_scene::icons};
Expand Down Expand Up @@ -305,16 +305,24 @@ fn guidelines_group<'a>(_data: &'a Data, ctx: &Context) -> Element<'a, Event> {
PreferencesGroup::new()
.title("Render")
.push(
ActionRow::new()
.title("Vertical Guidelines")
.subtitle("Display octave indicators")
.suffix(vertical),
mouse_area(
ActionRow::new()
.title("Vertical Guidelines")
.subtitle("Display octave indicators")
.suffix(vertical),
)
.on_press(Event::VerticalGuidelines(!ctx.config.vertical_guidelines)),
)
.push(
ActionRow::new()
.title("Horizontal Guidelines")
.subtitle("Display measure/bar indicators")
.suffix(horizontal),
mouse_area(
ActionRow::new()
.title("Horizontal Guidelines")
.subtitle("Display measure/bar indicators")
.suffix(horizontal),
)
.on_press(Event::HorizontalGuidelines(
!ctx.config.horizontal_guidelines,
)),
)
.build()
}
Expand Down

0 comments on commit 7fd912c

Please sign in to comment.