obj configuremethod line -smooth yesNo { set tag line$self if {$yesNo} then { # curvy if {[llength [my dots]] == 2} then { set x0 [$self firstDot cget -x] set y0 [$self firstDot cget -y] set x1 [$self lastDot cget -x] set y1 [$self lastDot cget -y] set xA [expr {$x0 + ($x1 - $x0) / 3}] set yA [expr {$y0 + ($y1 - $y0) / 3}] set xB [expr {$x0 + ($x1 - $x0) / 3 * 2}] set yB [expr {$y0 + ($y1 - $y0) / 3 * 2}] set first [$self firstDot] set last [$self lastDot] $self remove all $self add\ $first [new dot -x $xA -y $yA] [new dot -x $xB -y $yB] $last } $self canvas itemconfigure $tag -smooth raw } else { # straight $self canvas itemconfigure $tag -smooth no my dots [lreplace [my dots] 1 end-1] } $self canvas coords $tag {*}[$self xy] }
© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z