[color] set focus on current model or close to the current operation

Resolves #345
This commit is contained in:
Raphael Coeffic
2021-06-28 09:00:12 +02:00
committed by Raphael Coeffic
parent 32aad89cf3
commit 79eee634fd
3 changed files with 50 additions and 4 deletions
+29
View File
@@ -240,6 +240,19 @@ void ModelsCategory::moveModel(ModelCell * model, int8_t step)
erase(current);
}
int ModelsCategory::getModelIndex(const ModelCell* model)
{
int idx = 0;
for (auto m : *this) {
if (model == m)
return idx;
++idx;
}
return -1;
}
void ModelsCategory::save(FIL * file)
{
#if !defined(SDCARD_YAML)
@@ -389,6 +402,22 @@ void ModelsList::setCurrentCategory(ModelsCategory * cat)
currentCategory = cat;
}
int ModelsList::getCurrentCategoryIdx() const
{
if (!currentCategory)
return -1;
int idx = 0;
for (auto cat : categories) {
if (currentCategory == cat)
return idx;
++idx;
}
return -1;
}
void ModelsList::setCurrentModel(ModelCell * cell)
{
currentModel = cell;