blib/lib/Gtk2/Ex/MindMapView/HotSpot/Grip.pm untested

filter: Statementstmt 0.0% 0 / 40 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 54 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
hotspot_button_press
2.0
hotspot_button_release
2.0
CRAP 2.0
1 package Gtk2::Ex::MindMapView::HotSpot::Grip;
2  
3 our $VERSION = '0.000001';
4  
5 use warnings;
6 use strict;
7 use Carp;
8  
9 use Glib ':constants';
10  
11 use Gnome2::Canvas;
12  
13 use base 'Gtk2::Ex::MindMapView::HotSpot';
14  
15 sub new
16 {
17 my $class = shift(@_);
18  
19 my $self = $class->SUPER::new(@_);
20  
21 $self->{x} = 0;
22  
23 $self->{y} = 0;
24  
25 $self->{x_prime} = 0;
26  
27 $self->{y_prime} = 0;
28  
29 return $self;
30 }
31  
32  
33 # $self->hotspot_button_press($item, $event);
34  
35 sub hotspot_button_press
36 {
37 my ($self, $item, $event) = @_;
38  
39 my @coords = $self->{item}->w2i($event->coords); # cursor position.
40  
41 $self->{x_prime} = $coords[0];
42  
43 $self->{y_prime} = $coords[1];
44 }
45  
46  
47 # $self->hotspot_button_release($item, $event);
48  
49 sub hotspot_button_release
50 {
51 my ($self, $item, $event) = @_;
52  
53 $self->{item}->signal_emit('layout');
54 }
55  
56  
57 # $self->hotspot_motion_notify($item, $event);
58  
59 sub hotspot_motion_notify
60 {
61 my ($self, $item, $event) = @_;
62  
63 my @coords = $self->{item}->w2i($event->coords); # cursor position.
64  
65 $self->{x} = $coords[0];
66  
67 $self->{y} = $coords[1];
68  
69 $self->{item}->resize($self->{side}, ($self->{x} - $self->{x_prime}), ($self->{y} - $self->{y_prime}));
70  
71 $self->{x_prime} = $self->{x};
72  
73 $self->{y_prime} = $self->{y};
74 }
75  
76  
77  
78 1; # Magic true value required at end of module
79 __END__