From f5b7ac537a6e5fbe9316dd29f7b6a73e2606d2d9 Mon Sep 17 00:00:00 2001 From: ribet Date: Tue, 24 Jul 2007 07:39:00 +0000 Subject: Evolution de Bruno : possibilité d'activer/désactiver le comportement d'anti-recouvrement avec l'attribut -visible. --- src/MTools/Comp/MAntiRecouvrement.pm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/MTools') diff --git a/src/MTools/Comp/MAntiRecouvrement.pm b/src/MTools/Comp/MAntiRecouvrement.pm index a9afb07..04d7caa 100644 --- a/src/MTools/Comp/MAntiRecouvrement.pm +++ b/src/MTools/Comp/MAntiRecouvrement.pm @@ -47,6 +47,16 @@ sub new { $self -> recordProperty ('-visible', 1); $self -> recordEvent ('ITEM_MOVED'); $self -> {__objects} = (); + $self -> plisten ('-visible', sub { + my ($src, $key, $val, $old) = @_; + if (defined $self -> {__objects}) + { + for (my $i = @{$self -> {__objects}} - 1; $i >= 0; $i --) + { + @{$self -> {__objects}} [$i] -> {__added} = $val; + } + } + }); $self -> {__known_objects} = (); $self -> {__ask_move} = (); $self -> {__ask_reaction} = (); @@ -81,7 +91,7 @@ sub addObject { push (@{$self -> {__objects}}, $ob); } $ob -> update_bbox (); - $ob -> {__added} = 1; + $ob -> {__added} = $self -> mget ('-visible'); $ob -> translate (0, 0); } @@ -102,7 +112,7 @@ sub __on_handle_moving_on_track { my ($first_work, $first_track, $current_track, $intersection); while (scalar @{$self -> {__ask_move}} > 0) { - $first_work = $self -> {__ask_move} -> [0]; + $first_work = $self -> {__ask_move} -> [0]; $first_track = $first_work -> [0]; my ($firstx, $firsty) = ($first_track -> mget ('x'), $first_track -> mget ('y')); for (my $i = 0; $i < @{$self -> {__objects}}; $i++) @@ -112,7 +122,7 @@ sub __on_handle_moving_on_track { my ($x, $y) = ($current_track -> mget ('x'), $current_track -> mget ('y')); $intersection = __intersection ( $firstx, $firsty, - $first_track -> mget ('width'), $first_track -> mget ('height'), + $first_track -> mget ('width'), $first_track -> mget ('height'), $x, $y, $current_track -> mget ('width'), $current_track-> mget ('height') ); -- cgit v1.1