Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4420
Modified Files: Tag: devel_0_39 desire.tk Log Message: more key_nav mangling
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.324 retrieving revision 1.1.2.325 diff -C2 -d -r1.1.2.324 -r1.1.2.325 *** desire.tk 13 Aug 2006 08:09:29 -0000 1.1.2.324 --- desire.tk 13 Aug 2006 08:30:32 -0000 1.1.2.325 *************** *** 2444,2447 **** --- 2444,2449 ---- def Canvas key_nav_left_shift {} {$self key_nav "left" 1}
+ proc inside {x x0 x1} {return [expr $x>=$x0 && $x<=$x1]} + def* Canvas key_nav {direction shift} { set group "" *************** *** 2461,2512 **** while {![llength $group]} { set left [expr $x1 - $xs*$off]; set right [expr $x1 + $xs + $xs*$off] ! set top [expr $y1 + $ys*$off]; set bottom [expr $y1 - $ys - $ys*$off] foreach item $children { switch $direction { up { ! if {$_($item:y1) < $y1} { ! if {$_($item:x1) >= $left && $_($item:x1) <= $right} { ! lappend group $item; lappend distances [expr abs($_($item:y1) - $y1)] ! } ! set x2 [expr $_($item:x1) + $_($item:xs)] ! if {$x2 >= $left && $x2 <= $right} { ! lappend group $item; lappend distances [expr abs($_($item:y1) - $y1)] ! } ! } } down { ! if {$_($item:y1) > $y1} { ! if {$_($item:x1) >= $left && $_($item:x1) <= $right} { ! lappend group $item; lappend distances [expr abs($_($item:y1) - $y1)] ! } ! set x2 [expr $_($item:x1) + $_($item:xs)] ! if {$x2 >= $left && $x2 <= $right} { ! lappend group $item; lappend distances [expr abs($_($item:y1) - $y1)] ! } ! } } right { ! if {$_($item:x1) > $x1} { ! if {$_($item:y1) <= $top && $_($item:y1) >= $bottom} { ! lappend group $item; lappend distances [expr abs($_($item:x1) - $x1)] ! } ! set y2 [expr $_($item:y1) - $_($item:ys)] ! if {$y2 <= $top && $y2 >= $bottom} { ! lappend group $item; lappend distances [expr abs($_($item:x1) - $x1)] ! } ! } } left { ! if {$_($item:x1) < $x1} { ! if {$_($item:y1) <= $top && $_($item:y1) >= $bottom} { ! lappend group $item; lappend distances [expr abs($_($item:x1) - $x1)] ! } ! set y2 [expr $_($item:y1) - $_($item:ys)] ! if {$y2 <= $top && $y2 >= $bottom} { ! lappend group $item; lappend distances [expr abs($_($item:x1) - $x1)] ! } ! } } } } incr off --- 2463,2495 ---- while {![llength $group]} { set left [expr $x1 - $xs*$off]; set right [expr $x1 + $xs + $xs*$off] ! set top [expr $y1 - $ys*$off]; set bottom [expr $y1 + $ys + $ys*$off] foreach item $children { + set ix1 $_($item:x1); set ix2 [expr $ix1 + $_($item:xs)] + set iy1 $_($item:y1); set iy2 [expr $iy1 + $_($item:ys)] switch $direction { up { ! if {$iy1 >= $y1} {continue} ! set add [expr [inside $ix1 $left $right] || [inside $ix2 $left $right]] } down { ! if {$iy1 <= $y1} {continue} ! set add [expr [inside $ix1 $left $right] || [inside $ix2 $left $right]] } right { ! if {$ix1 <= $x1} {continue} ! set add [expr [inside $iy1 $top $bottom] || [inside $iy2 $top $bottom]] } left { ! if {$ix1 >= $x1} {continue} ! set add [expr [inside $iy1 $top $bottom] || [inside $iy2 $top $bottom]] } } + if {$add} { + lappend group $item + lappend distances [switch $axis { + y {expr abs($iy1-$y1)} + x {expr abs($ix1-$x1)} + }] + } } incr off