summaryrefslogtreecommitdiffstats
path: root/library/demos
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2023-11-23 20:25:06 (GMT)
committermarc_culler <marc.culler@gmail.com>2023-11-23 20:25:06 (GMT)
commit014459077ba67c7477c4392ceb0f3525311b79d8 (patch)
tree94735c29e8fb7fb6364d70205e2b03d6f75a25f8 /library/demos
parent35f3b55d406eb50ce5da2d70ff50cba959f1f139 (diff)
downloadtk-014459077ba67c7477c4392ceb0f3525311b79d8.zip
tk-014459077ba67c7477c4392ceb0f3525311b79d8.tar.gz
tk-014459077ba67c7477c4392ceb0f3525311b79d8.tar.bz2
Support smooth scrolling of Canvas widgets and demonstrate it in the simple scrollable canvas demo.
Diffstat (limited to 'library/demos')
-rw-r--r--library/demos/cscroll.tcl7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index 98a4be2..a72a08b 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -108,6 +108,13 @@ if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide Tk
%W xview scroll [expr {(%D-2)/-3}] units
}
}
+ #Touchpad scrolling
+ bind $c <Control-MouseWheel> {
+ lassign [tk::PreciseScrollDeltas %D] deltaX deltaY
+ if {$deltaX != 0 || $deltaY != 0} {
+ tk::CanvasScrollByPixels %W $deltaX $deltaY
+ }
+ }
}
if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} {