aboutsummaryrefslogtreecommitdiff
path: root/src/MTools/Comp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MTools/Comp')
-rw-r--r--src/MTools/Comp/MReconizer.pm61
1 files changed, 36 insertions, 25 deletions
diff --git a/src/MTools/Comp/MReconizer.pm b/src/MTools/Comp/MReconizer.pm
index f30ec20..bb59bae 100644
--- a/src/MTools/Comp/MReconizer.pm
+++ b/src/MTools/Comp/MReconizer.pm
@@ -52,12 +52,13 @@ sub new {
bless $self, $class;
$button = 1 if ! defined $button;
-
+ $self -> recordEvent ('RELEASED');
$self -> recordEvent ('RECONIZED');
$self -> recordEvent ('START_GESTURE_RECO');
$self -> recordProperty ('animation_duration', 0.5);
$self -> recordProperty ('color', 'blue');
$self -> recordProperty ('callback', undef);
+ $self -> recordProperty ('-visible', 1);
$self -> mconfigure (%options);
binding ($src, "<Button-$button>", [\&__pressed, $self, Ev('x'), Ev('y')]);
@@ -79,9 +80,9 @@ sub new {
$self -> {__fleche} = $zinc -> add ('curve', minstance($dessin), [[0,0],[0,0]],
-linecolor => 'blue',
-linewidth => 2,
- -priority => 10,
- -visible => 1,
- -sensitive => 0,
+ -priority => 10,
+ -visible => 1,
+ -sensitive => 0,
);
$self -> {__anim__disparition} = new MTools::Anim::MOpacity (
@@ -108,39 +109,49 @@ sub __clear () {
sub __pressed {
my ($self, $x, $y) = @_;
- raise($self -> {__dessin});
- ($x, $y) = $zinc -> transform('device', minstance ($self -> {__dessin}), [$x, $y]);
- if (defined $self -> {__dessin})
- {
- push (@{$self -> {__points}}, [$x, $y]);
+ if ($self -> mget ('-visible')) {
+ raise ($self -> {__dessin});
+ ($x, $y) = $zinc -> transform ('device', minstance ($self -> {__dessin}), [$x, $y]);
+ if (defined $self -> {__dessin})
+ {
+ push (@{$self -> {__points}}, [$x, $y]);
+ }
+ $self -> notify ('START_GESTURE_RECO', $x, $y);
}
- $self -> notify ('START_GESTURE_RECO', $x, $y);
}
sub __moved {
my ($self, $x, $y) = @_;
- ($x, $y) = $zinc -> transform('device', minstance ($self -> {__dessin}), [$x, $y]);
- push (@{$self -> {trace}},$x,$y);
+ if ($self -> mget ('-visible')) {
+ ($x, $y) = $zinc -> transform('device', minstance ($self -> {__dessin}), [$x, $y]);
+ push (@{$self -> {trace}},$x,$y);
- if (defined $self -> {__dessin})
- {
- push (@{$self -> {__points}}, [$x, $y]);
- my @pts = @{$self -> {__points}};
- $zinc -> coords ($self -> {__fleche}, 0, \@pts);
+ if (defined $self -> {__dessin})
+ {
+ push (@{$self -> {__points}}, [$x, $y]);
+ my @pts = @{$self -> {__points}};
+ $zinc -> coords ($self -> {__fleche}, 0, \@pts);
+ }
}
}
sub __released {
my ($self, $x, $y) = @_;
-
- my ($gesture,$explanation) = AnalyzeGesture(@{$self -> {trace}});
- $self -> {trace} = ();
- $self -> notify ('RECONIZED', $gesture, $explanation);
-
- if (defined $self -> {__dessin})
- {
- $self -> {__anim__disparition} -> start ();
+
+ if ($self -> mget ('-visible')) {
+ my ($gesture, $explanation) = AnalyzeGesture (@{$self -> {trace}});
+ $self -> {trace} = ();
+ $self -> notify ('RECONIZED', $gesture, $explanation);
+ if (defined $self -> {__dessin})
+ {
+ $self -> {__anim__disparition} -> start ();
+ }
+ }
+ else {
+ $self -> notify ('RELEASED', $x, $y);
+ $self -> __clear ();
}
+
}
sub getpoints {
my ($self) = @_;