aboutsummaryrefslogtreecommitdiff
path: root/src/MTools/Comp/MMultiSelection.pm
diff options
context:
space:
mode:
authormerlin2007-11-28 15:43:38 +0000
committermerlin2007-11-28 15:43:38 +0000
commitaa9ee1f5b3a5d8393f54f0cd54a281aee442425b (patch)
treebaed114cd5b6b178b5264d4354cbb1a30c2520d0 /src/MTools/Comp/MMultiSelection.pm
parentacf4000cc2e32c95ace53b5e83a5476afeea8acc (diff)
downloadmtc-aa9ee1f5b3a5d8393f54f0cd54a281aee442425b.zip
mtc-aa9ee1f5b3a5d8393f54f0cd54a281aee442425b.tar.gz
mtc-aa9ee1f5b3a5d8393f54f0cd54a281aee442425b.tar.bz2
mtc-aa9ee1f5b3a5d8393f54f0cd54a281aee442425b.tar.xz
Ajout du comportement de visiblite de la multiselection (mconfigure (-visible => 0) desactive la mutliselection)
Diffstat (limited to 'src/MTools/Comp/MMultiSelection.pm')
-rw-r--r--src/MTools/Comp/MMultiSelection.pm54
1 files changed, 41 insertions, 13 deletions
diff --git a/src/MTools/Comp/MMultiSelection.pm b/src/MTools/Comp/MMultiSelection.pm
index df72cad..d79f64b 100644
--- a/src/MTools/Comp/MMultiSelection.pm
+++ b/src/MTools/Comp/MMultiSelection.pm
@@ -105,9 +105,13 @@ sub new {
$self -> recordProperty ('delay', 0);
$self -> recordProperty ('inertie', 0.6);
+ $self -> recordProperty ('-visible', 1);
$self -> recordEvent ('PRESSED');
$self -> recordEvent ('MOVED');
$self -> recordEvent ('RELEASED');
+ $self -> recordEvent ('PRESSED_OFF');
+ $self -> recordEvent ('MOVED_OFF');
+ $self -> recordEvent ('RELEASED_OFF');
$self -> recordEvent ('FLECHEPRESSED');
$self -> recordEvent ('FLECHEMOVED');
$self -> recordEvent ('FLECHERELEASED');
@@ -306,16 +310,32 @@ sub __clear {
sub __pressed {
my ($self, $x, $y, $t) = @_;
- $self -> __clear ();
- push (@{$self -> {__points}}, [$x, $y]);
- $self -> notify ('DESELECT_ALL');
- $self -> notify ('PRESSED', $x, $y, $t);
+ if ($self -> mget ('-visible'))
+ {
+ $self -> __clear ();
+ push (@{$self -> {__points}}, [$x, $y]);
+ $self -> notify ('DESELECT_ALL');
+ $self -> notify ('PRESSED', $x, $y, $t);
+ }
+ else
+ {
+ $self -> notify ('PRESSED_OFF', $x, $y, $t);
+ }
}
sub __released {
my ($self, $x, $y, $t) = @_;
- my $pt = $self -> {__points}[@{$self -> {__points}} - 2];
- $self -> notify ('RELEASED', $x - $pt -> [0], $y - $pt -> [1], $t);
+ if ($self -> mget ('-visible'))
+ {
+ my $pt = $self -> {__points}[@{$self -> {__points}} - 2];
+ $self -> notify ('RELEASED', $x - $pt -> [0], $y - $pt -> [1], $t);
+ }
+ else
+ {
+ $self -> __clear ();
+ $self -> notify ('RELEASED_OFF', $x, $y, $t);
+ }
+
}
sub __fin_moved {
@@ -328,13 +348,21 @@ sub __fin_moved {
sub __moved {
my ($self, $x, $y, $t) = @_;
- push (@{$self -> {__points}}, [$x, $y]);
- my @pts = @{$self -> {__points}};
- $zinc -> coords ($self -> {__curve}, 0, \@pts);
- $zinc -> coords ($self -> {__curve_bck}, 0, \@pts);
- my $pt = $self -> {__points}[@{$self -> {__points}} - 2];
- $self -> notify ('MOVED', $x - $pt -> [0], $y - $pt -> [1], $t);
- $self -> __update_all ();
+ if ($self -> mget ('-visible'))
+ {
+ push (@{$self -> {__points}}, [$x, $y]);
+ my @pts = @{$self -> {__points}};
+ $zinc -> coords ($self -> {__curve}, 0, \@pts);
+ $zinc -> coords ($self -> {__curve_bck}, 0, \@pts);
+ my $pt = $self -> {__points}[@{$self -> {__points}} - 2];
+ $self -> notify ('MOVED', $x - $pt -> [0], $y - $pt -> [1], $t);
+ $self -> __update_all ();
+ }
+ else
+ {
+ $self -> __clear ();
+ $self -> notify ('MOVED_OFF', $x, $y, $t);
+ }
}
sub translate {