summaryrefslogtreecommitdiffstats
path: root/library/text.tcl
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2023-11-11 18:37:19 (GMT)
committermarc_culler <marc.culler@gmail.com>2023-11-11 18:37:19 (GMT)
commitb2a0dd551db91af30c2bcfb822c975503190e77b (patch)
tree9d2c132cfcf362779224227366d62d8bf8a52784 /library/text.tcl
parenta9341a2df78f4af62fd48cbecb50023e34e2e760 (diff)
downloadtk-b2a0dd551db91af30c2bcfb822c975503190e77b.zip
tk-b2a0dd551db91af30c2bcfb822c975503190e77b.tar.gz
tk-b2a0dd551db91af30c2bcfb822c975503190e77b.tar.bz2
Implement smooth scrolling for macOS in a way which can be adapted to other platforms.
Diffstat (limited to 'library/text.tcl')
-rw-r--r--library/text.tcl24
1 files changed, 20 insertions, 4 deletions
diff --git a/library/text.tcl b/library/text.tcl
index e5a4c11..eeb20fd 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -457,16 +457,32 @@ bind Text <B2-Motion> {
set ::tk::Priv(prevPos) {}
bind Text <MouseWheel> {
- tk::MouseWheel %W y [tk::ScaleNum %D] -4.0 pixels
+ if {[ expr %s & 512 ]} {
+ tk::MouseWheel %W y %D -1.0 pixels
+ } else {
+ tk::MouseWheel %W y [tk::ScaleNum %D] -4.0 pixels
+ }
}
bind Text <Option-MouseWheel> {
- tk::MouseWheel %W y [tk::ScaleNum %D] -1.2 pixels
+ if {[ expr %s & 512 ]} {
+ tk::MouseWheel %W y %D pixels
+ } else {
+ tk::MouseWheel %W y [tk::ScaleNum %D] -1.2 pixels
+ }
}
bind Text <Shift-MouseWheel> {
- tk::MouseWheel %W x [tk::ScaleNum %D] -4.0 pixels
+ if {[ expr %s & 512 ]} {
+ tk::MouseWheel %W x %D -1.0 pixels
+ } else {
+ tk::MouseWheel %W x [tk::ScaleNum %D] -4.0 pixels
+ }
}
bind Text <Shift-Option-MouseWheel> {
- tk::MouseWheel %W x [tk::ScaleNum %D] -1.2 pixels
+ if {[ expr %s & 512 ]} {
+ tk::MouseWheel %W x %D -1.0 pixels
+ } else {
+ tk::MouseWheel %W x [tk::ScaleNum %D] -1.2 pixels
+ }
}
# ::tk::TextClosestGap --