]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/commitdiff
Also set the width/height of a rectangle when both corners were passed
authorVincent Pit <vince@profvince.com>
Thu, 22 Jul 2010 22:30:27 +0000 (00:30 +0200)
committerVincent Pit <vince@profvince.com>
Thu, 22 Jul 2010 22:30:27 +0000 (00:30 +0200)
lib/LaTeX/TikZ/Set/Rectangle.pm

index 79dda06e264f662f83eb6c26bf916f300c250cac..5c20fa8e95a0a769d3c84ce9cbfd085fa66ba3b9 100644 (file)
@@ -63,9 +63,12 @@ around 'BUILDARGS' => sub {
  my $class = shift;
 
  if (@_ == 2 and $tc1->check($_[0]) and $tc2->check($_[1])) {
+  my ($from, $to) = @_;
   @_ = (
-   from => $_[0],
-   to   => $_[1],
+   from   => $from,
+   to     => $to,
+   width  => $to->x - $from->x,
+   height => $to->y - $from->y,
   );
  } else {
   my %args = @_;