Dealing with dot objects.

$canvaseditor dots
returns all dot objects on canvas
$canvaseditor dots show
shows all dot objects on canvas
$canvaseditor dots -selected
returns all dots in selection
$canvaseditor -unselected
returns non-selected dots

Options -gravity refer to objects, option -end refers to line.

If option -gravity is given, and objects with that constraint exist within choice, then only these, otherwise all objects are used.

obj method canvaseditor dots args {
  set noGravityArgs [ldifference $args -gravity]
  lappend canvasOptions
  lappend objectOptions
  lappend elements 
  while {[string index $args 0] eq "-"} {
    set args [lassign $args option]
    if {$option in {-selected -unselected}} then {
      lappend canvasOptions $option
    } else {
      lappend objectOptions $option
  if {"-selected" in $canvasOptions} then {
    set dots [concat {*}[$self selected dots {*}$objectOptions]]
  } else {
    set dots [concat {*}[$self elements dots {*}$objectOptions]]
    if {"-unselected" in $canvasOptions} then {
      set dots [ldifference $dots [$self dots -selected]]
  if {$dots eq {} && "-gravity" in $objectOptions} then {
    $self dots {*}$noGravityArgs
  } else {
    lmap dot [lunique $dots] {
      $dot {*}$args

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