protected function prepareModels()
{
if (($models = $this->allModels) === null) {
return [];
}
$child = [];
foreach ($models as $key => &$model) {
$model['timestamp'] *= 1000;
$model['duration'] *= 1000;
$model['child'] = 0;
$model['css']['width'] = $this->getWidth($model);
$model['css']['left'] = $this->getLeft($model);
$model['css']['color'] = $this->getColor($model);
foreach ($child as $id => $timestamp) {
if ($timestamp > $model['timestamp']) {
++$models[$id]['child'];
} else {
unset($child[$id]);
}
}
$child[$key] = $model['timestamp'] + $model['duration'];
}
return $models;
}