diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-22 15:02:23 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-22 15:02:23 (GMT) |
commit | 127c180c66bf291cae359b4c83fcfce3961af8be (patch) | |
tree | 75c30064dcd65da3c0b1a72f00f0985cee83c720 /library | |
parent | e1486d48b18bdd738d42c22f61f597b17ea02fc4 (diff) | |
download | tk-127c180c66bf291cae359b4c83fcfce3961af8be.zip tk-127c180c66bf291cae359b4c83fcfce3961af8be.tar.gz tk-127c180c66bf291cae359b4c83fcfce3961af8be.tar.bz2 |
Allow using floating-point number in "scroll (x|y)view (units|pages)". They are rounded away from zero towards an integer.
Diffstat (limited to 'library')
-rw-r--r-- | library/listbox.tcl | 8 | ||||
-rw-r--r-- | library/scrlbar.tcl | 8 | ||||
-rw-r--r-- | library/ttk/utils.tcl | 12 |
3 files changed, 14 insertions, 14 deletions
diff --git a/library/listbox.tcl b/library/listbox.tcl index 4a76a18..7400494 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}] units } bind Listbox <Option-MouseWheel> { - %W yview scroll [expr {-(%D/3)}] units + %W yview scroll [expr {%D/-3}] units } bind Listbox <Shift-MouseWheel> { - %W xview scroll [expr {-(%D/30)}] units + %W xview scroll [expr {%D/-30}] units } bind Listbox <Shift-Option-MouseWheel> { - %W xview scroll [expr {-(%D/3)}] units + %W xview scroll [expr {%D/-3}] units } # ::tk::ListboxBeginSelect -- diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index d797b24..2b3503a 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -130,16 +130,16 @@ bind Scrollbar <<LineEnd>> { } bind Scrollbar <MouseWheel> { - tk::ScrollByUnits %W v [expr {-(%D / 30)}] + tk::ScrollByUnits %W v [expr {%D/-30.0}] } bind Scrollbar <Option-MouseWheel> { - tk::ScrollByUnits %W v [expr {-(%D / 3)}] + tk::ScrollByUnits %W v [expr {%D/-3.0}] } bind Scrollbar <Shift-MouseWheel> { - tk::ScrollByUnits %W h [expr {-(%D / 30)}] + tk::ScrollByUnits %W h [expr {%D/-30.0}] } bind Scrollbar <Shift-Option-MouseWheel> { - tk::ScrollByUnits %W h [expr {-(%D / 3)}] + tk::ScrollByUnits %W h [expr {%D/-3.0}] } # tk::ScrollButtonDown -- diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl index fc8b4e0..4827aa3 100644 --- a/library/ttk/utils.tcl +++ b/library/ttk/utils.tcl @@ -285,8 +285,8 @@ proc ttk::copyBindings {from to} { # proc ttk::bindMouseWheel {bindtag callback} { - bind $bindtag <MouseWheel> [append callback { [expr {-(%D / 120)}]}] - bind $bindtag <Option-MouseWheel> [append callback { [expr {-(%D / 12)}]}] + bind $bindtag <MouseWheel> [append callback { [expr {%D/-120.0}]}] + bind $bindtag <Option-MouseWheel> [append callback { [expr {%D/-12.0}]}] } ## Mousewheel bindings for standard scrollable widgets. @@ -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}] units } bind TtkScrollable <Option-MouseWheel> \ - { %W yview scroll [expr {-(%D / 12)}] units } + { %W yview scroll [expr {%D/-12}] units } bind TtkScrollable <Shift-MouseWheel> \ - { %W xview scroll [expr {-(%D / 120)}] units } + { %W xview scroll [expr {%D/-120}] units } bind TtkScrollable <Shift-Option-MouseWheel> \ - { %W xview scroll [expr {-(%D / 12)}] units } + { %W xview scroll [expr {%D/-12}] units } #*EOF* |