obj method canvaseditor snapMode {{onOff on}} { set canvas [my canvas] if {$onOff} then { bind $canvas <<ControlClick>> [list apply [list {x y} { proc pointerXY {} "list $x $y" } [namespace current]] %x %y] bind $canvas <<ControlClick>> +[list apply [list self { set found [$self nearestDot -unselected] $self memory found $found set foundx [$found cget -x] set foundy [$found cget -y] # set currentBind [bind [my canvas] <Motion>] # lappend map if {[regexp {\[[^\]]+\mcanvasx\M[^\]]+\]} $currentBind cmdx]} then { lappend map $cmdx $foundx } if {[regexp {\[[^\]]+\mcanvasy\M[^\]]+\]} $currentBind cmdy]} then { lappend map $cmdy $foundy } # set cmd [string map $map $currentBind] eval $cmd $self finishTransform } [namespace current]] $self] bind $canvas <<ShiftControlClick>> [bind $canvas <<ControlClick>>] bind $canvas <<ShiftControlClick>> +[list apply { self { $self withUndo connectWarpedLineToDot [$self memory found] } } $self] bind $canvas <<ControlClick>> +break bind $canvas <<ShiftControlClick>> +break } else { bind $canvas <<ControlClick>> "" bind $canvas <<ShiftControlClick>> "" } }
© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z