Fixed selection type for text volumes

This commit is contained in:
enricoturri1966 2023-01-09 13:18:24 +01:00
parent ba730922e6
commit abf918e728

View file

@ -2159,8 +2159,7 @@ void Selection::update_type()
if (!m_valid) if (!m_valid)
m_type = Invalid; m_type = Invalid;
else else {
{
if (m_list.empty()) if (m_list.empty())
m_type = Empty; m_type = Empty;
else if (m_list.size() == 1) { else if (m_list.size() == 1) {
@ -2176,12 +2175,19 @@ void Selection::update_type()
unsigned int volumes_count = (unsigned int)model_object->volumes.size(); unsigned int volumes_count = (unsigned int)model_object->volumes.size();
unsigned int instances_count = (unsigned int)model_object->instances.size(); unsigned int instances_count = (unsigned int)model_object->instances.size();
if (volumes_count * instances_count == 1) { if (volumes_count * instances_count == 1) {
m_type = SingleFullObject; const ModelVolume* model_volume = model_object->volumes[first->volume_idx()];
// ensures the correct mode is selected if (model_volume->text_configuration.has_value()) { // text volume
m_mode = Instance; m_type = SingleVolume;
// ensures the correct mode is selected
m_mode = Volume;
}
else {
m_type = SingleFullObject;
// ensures the correct mode is selected
m_mode = Instance;
}
} }
else if (volumes_count == 1) // instances_count > 1 else if (volumes_count == 1) { // instances_count > 1
{
m_type = SingleFullInstance; m_type = SingleFullInstance;
// ensures the correct mode is selected // ensures the correct mode is selected
m_mode = Instance; m_mode = Instance;