]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Formatter.pm
Make some accessors writable for the formatter object
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Formatter.pm
index 0838e46d0262176dc216efe45ba9dbf99ebf048f..6f3d56ebc92f785e343ede575609196e10edec4b 100644 (file)
@@ -17,6 +17,10 @@ our $VERSION = '0.01';
 
 use Sub::Name ();
 
+use LaTeX::TikZ::Point;
+
+use LaTeX::TikZ::Interface;
+
 use LaTeX::TikZ::Tools;
 
 use Any::Moose;
@@ -35,23 +39,23 @@ has 'format' => (
 );
 
 has 'scale' => (
- is      => 'ro',
+ is      => 'rw',
  isa     => 'Num',
  default => 1,
 );
 
 has 'width' => (
- is  => 'ro',
+ is  => 'rw',
  isa => 'Maybe[Num]',
 );
 
 has 'height' => (
- is  => 'ro',
+ is  => 'rw',
  isa => 'Maybe[Num]',
 );
 
 has 'origin' => (
- is     => 'ro',
+ is     => 'rw',
  isa    => 'Maybe[LaTeX::TikZ::Point::Autocoerce]',
  coerce => 1,
 );
@@ -113,9 +117,6 @@ sub render {
  my (@layers, @other_mods);
  $find_mods->($seq, \@layers, \@other_mods);
 
- my $o = $tikz->origin;
- $seq  = $seq->translate($o) if defined $o;
-
  my $w = $tikz->width;
  my $h = $tikz->height;
  my $canvas = '';
@@ -182,11 +183,13 @@ sub thickness {
  0.8 * $width * ($tikz->scale / 5);
 }
 
-use LaTeX::TikZ::Interface formatter => sub {
- shift;
+LaTeX::TikZ::Interface->register(
+ formatter => sub {
+  shift;
 
- __PACKAGE__->new(@_);
-};
+  __PACKAGE__->new(@_);
+ },
+);
 
 __PACKAGE__->meta->make_immutable;