aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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')
);