Document findItemIndex function in ContextMenu

This commit is contained in:
Arjen Hiemstra 2017-04-24 13:13:00 +02:00
parent 27256cae9e
commit bca27ad11f

View File

@ -114,13 +114,23 @@ Menu
}
}
// Find the index of an item in the list of child items of this menu.
//
// This is primarily intended as a helper function so we do not have to
// hard-code the position of the extruder selection actions.
//
// \param item The item to find the index of.
//
// \return The index of the item or -1 if it was not found.
function findItemIndex(item)
{
for(var i in base.items)
{
if(base.items[i] == item)
{
return i;
}
}
return -1;
}