diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-22 15:29:53 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-22 15:29:53 (GMT) |
commit | 68fc0a0ef4781d53802b28f569935acedc875a92 (patch) | |
tree | a61c0e8557619f26c7f56678a0da6eff1883868c /library | |
parent | 127c180c66bf291cae359b4c83fcfce3961af8be (diff) | |
download | tk-68fc0a0ef4781d53802b28f569935acedc875a92.zip tk-68fc0a0ef4781d53802b28f569935acedc875a92.tar.gz tk-68fc0a0ef4781d53802b28f569935acedc875a92.tar.bz2 |
Use some more "(x|y)view scroll units" automatic rounding in bindings.
Diffstat (limited to 'library')
-rw-r--r-- | library/demos/cscroll.tcl | 15 | ||||
-rw-r--r-- | library/iconlist.tcl | 6 | ||||
-rw-r--r-- | library/listbox.tcl | 8 | ||||
-rw-r--r-- | library/ttk/utils.tcl | 8 |
4 files changed, 23 insertions, 14 deletions
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl index 7bbb91c..1740f94 100644 --- a/library/demos/cscroll.tcl +++ b/library/demos/cscroll.tcl @@ -58,7 +58,20 @@ $c bind all <Any-Leave> "scrollLeave $c" $c bind all <1> "scrollButton $c" bind $c <2> "$c scan mark %x %y" bind $c <B2-Motion> "$c scan dragto %x %y" -if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} { +if {[package vsatisfies [package provide Tk] 8.7-]} { + bind $c <MouseWheel> { + %W yview scroll [expr {%D/-30.0}] units + } + bind $c <Option-MouseWheel> { + %W yview scroll [expr {%D/-3.0}] units + } + bind $c <Shift-MouseWheel> { + %W xview scroll [expr {%D/-30.0}] units + } + bind $c <Shift-Option-MouseWheel> { + %W xview scroll [expr {%D/-3.0}] units + } +} elseif {[tk windowingsystem] eq "aqua"} { bind $c <MouseWheel> { %W yview scroll [expr {-(%D)}] units } diff --git a/library/iconlist.tcl b/library/iconlist.tcl index 30352a1..65c66b1 100644 --- a/library/iconlist.tcl +++ b/library/iconlist.tcl @@ -509,11 +509,7 @@ package require Tk 8.6 if {$noScroll || $::tk_strictMotif} { return } - if {$amount > 0} { - $canvas xview scroll [expr {(-119-$amount) / 120}] units - } else { - $canvas xview scroll [expr {-($amount / 120)}] units - } + $canvas xview scroll [expr {$amount/-120.0}] units } method Btn1 {x y} { focus $canvas diff --git a/library/listbox.tcl b/library/listbox.tcl index 7400494..500c32e 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -177,16 +177,16 @@ bind Listbox <B2-Motion> { } bind Listbox <MouseWheel> { - %W yview scroll [expr {%D/-30}] units + %W yview scroll [expr {%D/-30.0}] units } bind Listbox <Option-MouseWheel> { - %W yview scroll [expr {%D/-3}] units + %W yview scroll [expr {%D/-3.0}] units } bind Listbox <Shift-MouseWheel> { - %W xview scroll [expr {%D/-30}] units + %W xview scroll [expr {%D/-30.0}] units } bind Listbox <Shift-Option-MouseWheel> { - %W xview scroll [expr {%D/-3}] units + %W xview scroll [expr {%D/-3.0}] units } # ::tk::ListboxBeginSelect -- diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl index 4827aa3..3729254 100644 --- a/library/ttk/utils.tcl +++ b/library/ttk/utils.tcl @@ -298,12 +298,12 @@ proc ttk::bindMouseWheel {bindtag callback} { # bind TtkScrollable <MouseWheel> \ - { %W yview scroll [expr {%D/-120}] units } + { %W yview scroll [expr {%D/-120.0}] units } bind TtkScrollable <Option-MouseWheel> \ - { %W yview scroll [expr {%D/-12}] units } + { %W yview scroll [expr {%D/-12.0}] units } bind TtkScrollable <Shift-MouseWheel> \ - { %W xview scroll [expr {%D/-120}] units } + { %W xview scroll [expr {%D/-120.0}] units } bind TtkScrollable <Shift-Option-MouseWheel> \ - { %W xview scroll [expr {%D/-12}] units } + { %W xview scroll [expr {%D/-12.0}] units } #*EOF* |