fix(color): UI issues adding and removing labels (#7715)
This commit is contained in:
@@ -663,14 +663,8 @@ void ModelLabelsWindow::newLabel()
|
||||
new LabelDialog(tmpLabel, LABEL_LENGTH, STR_ENTER_LABEL, [=](std::string label) {
|
||||
int newlabindex = modelslabels.addLabel(label);
|
||||
if (newlabindex >= 0) {
|
||||
std::set<uint32_t> newset;
|
||||
newset.insert(newlabindex);
|
||||
auto labels = getLabels();
|
||||
lblselector->setNames(labels);
|
||||
lblselector->setSelected(newset);
|
||||
if (g_eeGeneral.labelSingleSelect)
|
||||
lblselector->setActiveItem(newlabindex);
|
||||
updateFilteredLabels(newset);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -869,8 +863,12 @@ void ModelLabelsWindow::buildBody(Window *window)
|
||||
std::set<uint32_t> newset;
|
||||
lblselector->setNames(labels);
|
||||
lblselector->setSelected(newset);
|
||||
if (g_eeGeneral.labelSingleSelect && selected == lblselector->getActiveItem())
|
||||
lblselector->setActiveItem(-1);
|
||||
if (g_eeGeneral.labelSingleSelect) {
|
||||
if (selected == lblselector->getActiveItem())
|
||||
lblselector->setActiveItem(-1);
|
||||
else
|
||||
newset.insert(lblselector->getActiveItem());
|
||||
}
|
||||
mdlselector->clearButtons();
|
||||
updateFilteredLabels(newset);
|
||||
});
|
||||
|
||||
@@ -358,8 +358,8 @@ int ModelMap::addLabel(std::string lbl)
|
||||
if (lbl == STR_UNLABELEDMODEL) return -1;
|
||||
|
||||
// Limit maximum label length, TODO... Truncate UTF8 Properly
|
||||
lbl = lbl.substr(0, LABEL_LENGTH);
|
||||
removeYAMLChars(lbl);
|
||||
lbl = lbl.substr(0, LABEL_LENGTH);
|
||||
if (lbl.size() == 0) return -1;
|
||||
|
||||
// Add a new label if it doesn't already exist in the list
|
||||
|
||||
Reference in New Issue
Block a user