xy

$dot xy
returns coords for canvas
$dot xy yes
returns list of attributes -x, -y
$dot xy pointer
returns coords for mouse pointer

obj method dot xy {{raw display}} {
  if {[string is true -strict $raw]} then {
    # $dot xy yes
    list [$self cget -x] [$self cget -y]
  } else {
    variable zoom
    set x [* $zoom [$self cget -x]]
    set y [* $zoom [$self cget -y]]
    if {$raw ni {display pointer}} then {
      # $dot xy no
      list $x $y
    } else {
      # $dot xy display
      set dx [- [int $x] [$self canvas canvasx [int $x]]]
      set dy [- [int $y] [$self canvas canvasy [int $y]]]
      list [+ $x $dx] [+ $y $dy]
    }
  }
}

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