Use mouse::Cursor::is_over in slider

This commit is contained in:
Héctor Ramón Jiménez 2024-09-13 23:46:51 +02:00
parent cdf02ddda9
commit 83041f6880
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 4 additions and 4 deletions

View file

@ -327,7 +327,7 @@ where
Event::Mouse(mouse::Event::WheelScrolled { delta })
if state.keyboard_modifiers.control() =>
{
if let Some(_) = cursor.position_over(layout.bounds()) {
if cursor.is_over(layout.bounds()) {
let delta = match delta {
mouse::ScrollDelta::Lines { x: _, y } => y,
mouse::ScrollDelta::Pixels { x: _, y } => y,
@ -343,7 +343,7 @@ where
}
}
Event::Keyboard(keyboard::Event::KeyPressed { key, .. }) => {
if cursor.position_over(layout.bounds()).is_some() {
if cursor.is_over(layout.bounds()) {
match key {
Key::Named(key::Named::ArrowUp) => {
let _ = increment(current_value).map(change);

View file

@ -332,7 +332,7 @@ where
Event::Mouse(mouse::Event::WheelScrolled { delta })
if state.keyboard_modifiers.control() =>
{
if let Some(_) = cursor.position_over(layout.bounds()) {
if cursor.is_over(layout.bounds()) {
let delta = match delta {
mouse::ScrollDelta::Lines { x: _, y } => y,
mouse::ScrollDelta::Pixels { x: _, y } => y,
@ -348,7 +348,7 @@ where
}
}
Event::Keyboard(keyboard::Event::KeyPressed { key, .. }) => {
if cursor.position_over(layout.bounds()).is_some() {
if cursor.is_over(layout.bounds()) {
match key {
Key::Named(key::Named::ArrowUp) => {
let _ = increment(current_value).map(change);