Fixed stacking of events that are just very close to each other.

This commit is contained in:
Andrey Savchenko committed 2018-02-22 18:01:46 +02:00
1 parent 1e75033f25
commit 7cc65ca1a2
1 file changed
+6 -2
+6 -2
View File
@@ -21,13 +21,17 @@ class Recursive_Record_Iterator extends \ArrayIterator implements \RecursiveIter
foreach ( $records as $key => $record ) { foreach ( $records as $key => $record ) {
if ( $record->get_origin() < $end ) { $origin = $record->get_origin();
$overlaps = $origin < $end; // Float comparison alarm.
$borders = abs( $origin - $end ) < 0.0001; // If effectively equal.
if ( $overlaps && ! $borders ) {
unset( $records[ $key ] ); unset( $records[ $key ] );
$this->children[] = $record; $this->children[] = $record;
continue; continue;
} }
$end = $record->get_origin() + $record->get_duration(); $end = $origin + $record->get_duration();
} }
parent::__construct( $records, $flags ); parent::__construct( $records, $flags );