mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-07 12:00:05 -05:00
Fix issue with constellation labels and selection, closes #2382
This commit is contained in:
@@ -237,6 +237,10 @@ void LabelsComponent::render(const RenderData& data,
|
||||
glm::vec4 textColor = glm::vec4(glm::vec3(_color), _opacity * fadeInVariable);
|
||||
|
||||
for (const speck::Labelset::Entry& e : _labelset.entries) {
|
||||
if (!e.isEnabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
glm::vec3 scaledPos(e.position);
|
||||
scaledPos *= scale;
|
||||
ghoul::fontrendering::FontRenderer::defaultProjectionRenderer().render(
|
||||
|
||||
@@ -139,12 +139,28 @@ void RenderableConstellationLines::selectionPropertyHasChanged() {
|
||||
{
|
||||
pair.second.isEnabled = true;
|
||||
}
|
||||
|
||||
if (_hasLabels) {
|
||||
for (speck::Labelset::Entry& e : _labels->labelSet().entries) {
|
||||
e.isEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Enable all constellations that are selected
|
||||
for (ConstellationKeyValuePair& pair : _renderingConstellationsMap)
|
||||
{
|
||||
pair.second.isEnabled = _selection.isSelected(pair.second.name);
|
||||
bool isSelected = _selection.isSelected(pair.second.name);
|
||||
pair.second.isEnabled = isSelected;
|
||||
|
||||
if (_hasLabels) {
|
||||
for (speck::Labelset::Entry& e : _labels->labelSet().entries) {
|
||||
if (constellationFullName(e.identifier) == pair.second.name) {
|
||||
e.isEnabled = isSelected;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,8 @@ protected:
|
||||
// Labels
|
||||
bool _hasLabels = false;
|
||||
properties::BoolProperty _drawLabels;
|
||||
// Everything related to the labels is handled by LabelsComponent
|
||||
std::unique_ptr<LabelsComponent> _labels;
|
||||
|
||||
private:
|
||||
// Map over the constellations names and their abbreviations
|
||||
@@ -103,9 +105,6 @@ private:
|
||||
|
||||
// The file containing constellation names and abbreviations
|
||||
properties::StringProperty _namesFilename;
|
||||
|
||||
// Everything related to the labels is handled by LabelsComponent
|
||||
std::unique_ptr<LabelsComponent> _labels;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -70,6 +70,7 @@ struct Labelset {
|
||||
glm::vec3 position = glm::vec3(0.f);
|
||||
std::string identifier;
|
||||
std::string text;
|
||||
bool isEnabled = true;
|
||||
};
|
||||
std::vector<Entry> entries;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user