adjustSelWidthHeightNumeric

$canvaseditor adjustSelWidthHeightNumeric
returns list of width and height
$canvaseditor adjustSelWidthHeightNumeric width (num)
changes width to (num)
$canvaseditor adjustSelWidthHeightNumeric height (num)
changes height to (num)

obj method canvaseditor adjustSelWidthHeightNumeric args {
  #
  lassign [$self bbox] left top right bottom
  #
  set width [- $right $left]
  set height [- $bottom $top]
  #
  if {$args eq ""} then {
    list $width $height
  } else {
    lassign $args dim num
    if {[string match w* $dim]} then {
      # width
      set num [fexpr $num]
      set factor [/ $num $width]
      $self scaleSelectionNumeric $factor 1.0
    } elseif {[string match h* $dim]} then {
      # height
      set num [fexpr $num]
      set factor [/ [double $num] $height]
      $self scaleSelectionNumeric 1.0 $factor
    }
    $self adjustSelWidthHeightNumeric
  }
}

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