Skip to content

Commit

Permalink
Improvements in the proc ::tk::ScrollByPixels.
Browse files Browse the repository at this point in the history
  • Loading branch information
csaba committed Jun 20, 2024
1 parent c396a4b commit 581a06b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/tk.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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}]
Expand Down

0 comments on commit 581a06b

Please sign in to comment.