From aa9ee1f5b3a5d8393f54f0cd54a281aee442425b Mon Sep 17 00:00:00 2001 From: merlin Date: Wed, 28 Nov 2007 15:43:38 +0000 Subject: Ajout du comportement de visiblite de la multiselection (mconfigure (-visible => 0) desactive la mutliselection) --- src/MTools/Comp/MMultiSelection.pm | 54 +++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 13 deletions(-) (limited to 'src/MTools') 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 { -- cgit v1.1