summaryrefslogtreecommitdiffstats
path: root/widget/src/text_editor.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-21 06:13:08 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-21 06:15:12 +0200
commit7373dd856b8837c2d91067b45e43b8f0e767c917 (patch)
tree576b67a588769645fe915f925f9ef8c95ee625c2 /widget/src/text_editor.rs
parentda5dd2526a2d9ee27e9405ed19c0f7a641160c54 (diff)
downloadiced-7373dd856b8837c2d91067b45e43b8f0e767c917.tar.gz
iced-7373dd856b8837c2d91067b45e43b8f0e767c917.tar.bz2
iced-7373dd856b8837c2d91067b45e43b8f0e767c917.zip
Scroll at least one line on macOS in `TextEditor`
Diffstat (limited to 'widget/src/text_editor.rs')
-rw-r--r--widget/src/text_editor.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs
index ac927fbc..76f3cc18 100644
--- a/widget/src/text_editor.rs
+++ b/widget/src/text_editor.rs
@@ -545,7 +545,11 @@ impl Update {
action(Action::Scroll {
lines: match delta {
mouse::ScrollDelta::Lines { y, .. } => {
- -y.round() as i32 * 4
+ if y > 0.0 {
+ -(y * 4.0).min(1.0) as i32
+ } else {
+ 0
+ }
}
mouse::ScrollDelta::Pixels { y, .. } => {
-y.signum() as i32