aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorribet2007-07-24 07:39:00 +0000
committerribet2007-07-24 07:39:00 +0000
commitf5b7ac537a6e5fbe9316dd29f7b6a73e2606d2d9 (patch)
tree1e1653259533e48fd1b4a970e811325a8ae631db /src
parente61ee56e425cc7bd0c878729ec84b746a96c7e24 (diff)
downloadmtc-f5b7ac537a6e5fbe9316dd29f7b6a73e2606d2d9.zip
mtc-f5b7ac537a6e5fbe9316dd29f7b6a73e2606d2d9.tar.gz
mtc-f5b7ac537a6e5fbe9316dd29f7b6a73e2606d2d9.tar.bz2
mtc-f5b7ac537a6e5fbe9316dd29f7b6a73e2606d2d9.tar.xz
Evolution de Bruno : possibilité d'activer/désactiver le comportement d'anti-recouvrement avec l'attribut -visible.
Diffstat (limited to 'src')
-rw-r--r--src/MTools/Comp/MAntiRecouvrement.pm16
1 files changed, 13 insertions, 3 deletions
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')
);