scaleObj

$dot scaleObj x y x0 y0 refX refY mode
does dotwise scaling interactive

Invoked by objects line, fill, group.


obj method dot scaleObj {x y x0 y0 refX refY {mode both}} {
  set baseHlen [- $refX $x0]
  set hLen [- $x $x0]
  if {$mode eq "vertical"} then {
    set hScale 1.0
  } else {
    set hScale [/ [double $hLen] $baseHlen]
  }
  #
  set baseVlen [- $refY $y0]
  set vLen [- $y $y0]
  if {$mode eq "horizontal"} then {
    set vScale 1.0
  } else {
    set vScale [/ [double $vLen] $baseVlen]
  }
  #
  if {$mode eq "proportional"} then {
    set hScale [max $hScale $vScale]
    set vScale $hScale
  }
  #
  set x1 [my baseX]
  set y1 [my baseY]
  set hDist0 [- $x1 $x0]
  set vDist0 [- $y1 $y0]
  set hDist1 [* $hDist0 $hScale]
  set vDist1 [* $vDist0 $vScale]
  set x2 [+ $x0 $hDist1]
  set y2 [+ $y0 $vDist1]
  $self configure -x $x2 -y $y2
}

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