diff options
author | marc_culler <marc.culler@gmail.com> | 2023-11-20 21:45:27 (GMT) |
---|---|---|
committer | marc_culler <marc.culler@gmail.com> | 2023-11-20 21:45:27 (GMT) |
commit | edaf075b9b0ff023177a8167a0ad159d56336fe3 (patch) | |
tree | e2be0091af9ee922e3168f54c6dd53ca83452289 /library/text.tcl | |
parent | 50ca6a3d2a0242016747053b1f08ce4c0ddaee3c (diff) | |
download | tk-edaf075b9b0ff023177a8167a0ad159d56336fe3.zip tk-edaf075b9b0ff023177a8167a0ad159d56336fe3.tar.gz tk-edaf075b9b0ff023177a8167a0ad159d56336fe3.tar.bz2 |
Add smooth scrolling for Text widgets on macOS.
Diffstat (limited to 'library/text.tcl')
-rw-r--r-- | library/text.tcl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/library/text.tcl b/library/text.tcl index eb73db0..c582fe3 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -456,6 +456,15 @@ bind Text <B2-Motion> { } set ::tk::Priv(prevPos) {} +bind Text <Control-MouseWheel> { + lassign [tk::PreciseScrollDeltas %D] deltaX deltaY + if {$deltaX != 0} { + %W xview scroll $deltaX pixels + } + if {$deltaY != 0} { + %W yview scroll $deltaY pixels + } +} bind Text <MouseWheel> { tk::MouseWheel %W y %D -4.0 pixels } |