]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Set/Rectangle.pm
Also set the width/height of a rectangle when both corners were passed
[perl/modules/LaTeX-TikZ.git] / 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 = @_;