deleteSelection

$canvaseditor deleteSelection
unjoins selected lines, undraws selected elements

obj method canvaseditor deleteSelection {} {
  if {[llength [my selection]] > 0} then {
    set before [$self dump]
    set stack [$self stackSequence yes]
    set selection [my selection]
    foreach obj [my selection] {
      lappend beforeLines\
        "[our garbage] release $obj"\
        [$obj restoreCode]\
        "$obj draw"
      lappend afterLines\
        "$obj draw no"\
        "[our garbage] add $obj"
      if {[$obj isa line]} then {
        foreach dot [$obj dots -end] {
          foreach line [$dot lines] {
            if {$line in $selection} continue
            $obj unjoin $line
            break
          }
        }
      }
      $self select $obj
      $obj draw no
      [our garbage] add $obj
    }
    lappend beforeLines "$self raiseTags $stack"
    set before [join $beforeLines \n]
    set after [join $afterLines \n]
    $self initUndoRedo $before $after
  }
}

© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z