| 1 | use 5.14.0; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use CairoX::Sweet::Standard; | ||
| 5 | |||
| 6 | our $VERSION = '0.0108'; # VERSION | ||
| 7 | # PODNAME: CairoX::Sweet::Core::MoveTo | ||
| 8 | |||
| 9 | class CairoX::Sweet::Core::MoveTo with CairoX::Sweet::Role::PathCommand using Moose { | ||
| 10 | |||
| 11 | use CairoX::Sweet::Core::Point; | ||
| 12 | |||
| 13 | has point => ( | ||
| 14 | is => 'ro', | ||
| 15 | isa => Point, | ||
| 16 | required => 1, | ||
| 17 | ); | ||
| 18 | # default value sets in BUILDARGS | ||
| 19 | has is_relative => ( | ||
| 20 | is => 'ro', | ||
| 21 | isa => Bool, | ||
| 22 | required => 1, | ||
| 23 | ); | ||
| 24 | |||
| 25 | around BUILDARGS($orig: $self, Num $x, Num $y, Bool :$is_relative? = 0) { | ||
| 26 | $self->$orig(point => CairoX::Sweet::Core::Point->new(x => $x, y => $y), is_relative => $is_relative); | ||
| 27 | } | ||
| 28 | method out { | ||
| 29 | return $self->point->out; | ||
| 30 | } | ||
| 31 | method method { | ||
| 32 | return $self->is_relative ? 'rel_move_to' : 'move_to'; | ||
| 33 | } | ||
| 34 | method location { | ||
| 35 | return $self->point; | ||
| 36 | } | ||
| 37 | method move_location(:$x = 0, :$y = 0) { | ||
| 38 | $self->point->move(x => $x, y => $y); | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | 1; | ||
| 43 | |||
| 44 | __END__ | ||
| 45 | |||
| 46 | =pod | ||
| 47 | |||
| 48 | =encoding UTF-8 | ||
| 49 | |||
| 50 | =head1 NAME | ||
| 51 | |||
| 52 | CairoX::Sweet::Core::MoveTo | ||
| 53 | |||
| 54 | =head1 VERSION | ||
| 55 | |||
| 56 | Version 0.0108, released 2015-03-21. | ||
| 57 | |||
| 58 | =head1 SOURCE | ||
| 59 | |||
| 60 | L<https://github.com/Csson/p5-CairoX-Sweet> | ||
| 61 | |||
| 62 | =head1 HOMEPAGE | ||
| 63 | |||
| 64 | L<https://metacpan.org/release/CairoX-Sweet> | ||
| 65 | |||
| 66 | =head1 AUTHOR | ||
| 67 | |||
| 68 | Erik Carlsson <info@code301.com> | ||
| 69 | |||
| 70 | =head1 COPYRIGHT AND LICENSE | ||
| 71 | |||
| 72 | This software is copyright (c) 2015 by Erik Carlsson <info@code301.com>. | ||
| 73 | |||
| 74 | This is free software; you can redistribute it and/or modify it under | ||
| 75 | the same terms as the Perl 5 programming language system itself. | ||
| 76 | |||
| 77 | =cut |