Fix last_pos shifting and add unit test

This commit is contained in:
Alessandro Ranellucci 2013-01-27 13:06:45 +01:00
parent 4c62c1b570
commit 50526dea5a
3 changed files with 24 additions and 2 deletions

View file

@ -57,9 +57,10 @@ sub set_shift {
my $self = shift;
my @shift = @_;
# if shift increases (goes towards right), last_pos decreases because it goes towards left
$self->last_pos->translate(
scale ($shift[X] - $self->shift_x),
scale ($shift[Y] - $self->shift_y),
scale ($self->shift_x - $shift[X]),
scale ($self->shift_x - $shift[Y]),
);
$self->shift_x($shift[X]);