From e1f58177317e2ef82ff6bad7f7b9971550b55e8f Mon Sep 17 00:00:00 2001 From: Seb Shader Date: Fri, 28 Jan 2022 21:18:39 -0800 Subject: [PATCH] try to "hover" after mousewheel scroll simulate hovering over correct box after scroll, hopefully.. --- color-themes-plugin.tcl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/color-themes-plugin.tcl b/color-themes-plugin.tcl index 3a84770..1f7e3e7 100644 --- a/color-themes-plugin.tcl +++ b/color-themes-plugin.tcl @@ -208,6 +208,17 @@ proc ::color-themes::click {box} { green -width 7 } +proc ::color-themes::scroll {box coord units boxincr} { + variable num_themes + # not sure of a better way to simulate hovering.. + set ocanvy [.colortheme_dialog.theme_list.c canvasy 0] + .colortheme_dialog.theme_list.c yview scroll [expr {- ($units)}] units + set boxnum [expr max(0, min($box + int($coord + \ + [.colortheme_dialog.theme_list.c canvasy 0] - $ocanvy)/$boxincr, \ + $num_themes-1))] + {::color-themes::motion} $boxnum +} + proc ::color-themes::apply {names} { variable selected_theme if {$selected_theme eq ""} {return} @@ -306,9 +317,8 @@ proc ::color-themes::opendialog {} { $boxheight -background $::pd_colors(canvas_fill) \ -highlightthickness 0 grid .colortheme_dialog.theme_list.c.f$counter.c - bind .colortheme_dialog.theme_list.c.f$counter.c { - .colortheme_dialog.theme_list.c yview scroll [expr {- (%D)}] units - } + bind .colortheme_dialog.theme_list.c.f$counter.c \ + [list {::color-themes::scroll} $counter %y %D $boxincr] bind .colortheme_dialog.theme_list.c.f$counter.c \ [list {::color-themes::motion} $counter] bind .colortheme_dialog.theme_list.c.f$counter.c \