Jocy
2017-05-17 16:08:51 +02:00
parent d636da86cb
commit b5494576d2
5 changed files with 27 additions and 8 deletions

View File

@ -61,7 +61,6 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener {
} else {
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSY_TRACKMANIA);
}
$pos = new Position();
$pos->setX($posX);
$pos->setY($posY);
@ -69,6 +68,16 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener {
return $pos;
}
private function getElementCountbeforeAdminMenu(){
$count = 0;
foreach($this->menuEntries as $k => $entry){
if($k < SidebarMenuManager::ORDER_ADMIN_MENU){
$count++;
}
}
return $count;
}
/**
* Returns PositionObject of a menu item of the sidebar, or null if it's not found
*
@ -81,6 +90,10 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener {
$itemMarginFactor = 1.2;
$pos = $this->getSidebarPosition();
$count = $this->getElementCountbeforeAdminMenu();
$pos->setY($pos->getY() + $itemSize * $itemMarginFactor * $count);
if (isset($this->yPositions[$id])) {
$pos->setY($this->yPositions[$id]);
return $pos;