From: Vincent Pit Date: Thu, 22 Jul 2010 22:30:27 +0000 (+0200) Subject: Also set the width/height of a rectangle when both corners were passed X-Git-Tag: v0.01~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=fcf49f47b7655e0bc3ed8c3da7f1004cbb70c7a5;p=perl%2Fmodules%2FLaTeX-TikZ.git Also set the width/height of a rectangle when both corners were passed --- diff --git a/lib/LaTeX/TikZ/Set/Rectangle.pm b/lib/LaTeX/TikZ/Set/Rectangle.pm index 79dda06..5c20fa8 100644 --- a/lib/LaTeX/TikZ/Set/Rectangle.pm +++ b/lib/LaTeX/TikZ/Set/Rectangle.pm @@ -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 = @_;