diff options
author | csaba <csaba> | 2024-06-20 15:59:17 (GMT) |
---|---|---|
committer | csaba <csaba> | 2024-06-20 15:59:17 (GMT) |
commit | 581a06b7efecf3d1acd01cf774fc1821f16b6b31 (patch) | |
tree | 6c0ade56dbb8fb84b3cc24d0274193d2d4060ac3 /library | |
parent | c396a4b95748839c327870844fef288f1b7d973e (diff) | |
download | tk-581a06b7efecf3d1acd01cf774fc1821f16b6b31.zip tk-581a06b7efecf3d1acd01cf774fc1821f16b6b31.tar.gz tk-581a06b7efecf3d1acd01cf774fc1821f16b6b31.tar.bz2 |
Improvements in the proc ::tk::ScrollByPixels.
Diffstat (limited to 'library')
-rw-r--r-- | library/tk.tcl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/tk.tcl b/library/tk.tcl index 7153974..bcbf8ce 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -558,12 +558,12 @@ proc ::tk::PreciseScrollDeltas {dxdy} { return [list $deltaX $deltaY] } -# Helper for smooth scrolling of widgets that support xview moveto, -# yview moveto, height and width. +## Helper for smooth scrolling of widgets that support xview moveto and +## yview moveto. proc ::tk::ScrollByPixels {w deltaX deltaY} { - set width [expr {1.0 * [$w cget -width]}] - set height [expr {1.0 * [$w cget -height]}] + set width [expr {1.0 * [winfo width $w]}] + set height [expr {1.0 * [winfo height $w]}] set X [lindex [$w xview] 0] set Y [lindex [$w yview] 0] set x [expr {$X - $deltaX / $width}] |