aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormerlin2007-11-26 08:48:22 +0000
committermerlin2007-11-26 08:48:22 +0000
commit446d1862e1502d307dd9b9a76aa51d786001dfb5 (patch)
tree54e1452828d2cd21a996f1edac3ea866e7639db2 /src
parentb613297337187c79468d631370814084dabed26f (diff)
downloadmtc-446d1862e1502d307dd9b9a76aa51d786001dfb5.zip
mtc-446d1862e1502d307dd9b9a76aa51d786001dfb5.tar.gz
mtc-446d1862e1502d307dd9b9a76aa51d786001dfb5.tar.bz2
mtc-446d1862e1502d307dd9b9a76aa51d786001dfb5.tar.xz
traitement de la propriete visible du comportement
Diffstat (limited to 'src')
-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) = @_;