diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp index a6dc9d8..c57ea2f 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp +++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp @@ -194,18 +194,23 @@ bool LayerStyleContainer::dropStyle(const QString& styleName) return true; } -float LayerStyleContainer::boundingBoxAffectValue() { +float LayerStyleContainer::boundingBoxAffectValue() const { float maxLineWidth = 0; - auto strokeStyle = styles[StrokeElementLayerStyle::displayName()]; - if (strokeStyle != nullptr) { - auto strokeElementLayerStyle = dynamic_cast(strokeStyle.get()); - if (strokeElementLayerStyle != nullptr) { - auto leftStyleStroke = strokeElementLayerStyle->strokePair.first; - auto rightStyleStroke = strokeElementLayerStyle->strokePair.second; - if (leftStyleStroke != nullptr) { + const auto strokeStyle = styles.at(StrokeElementLayerStyle::displayName()); + if (strokeStyle != nullptr) + { + if (const auto strokeElementLayerStyle = + std::dynamic_pointer_cast(strokeStyle); + strokeElementLayerStyle != nullptr) + { + const auto& leftStyleStroke = strokeElementLayerStyle->strokePair.first; + const auto& rightStyleStroke = strokeElementLayerStyle->strokePair.second; + if (leftStyleStroke != nullptr) + { maxLineWidth = std::max(maxLineWidth, leftStyleStroke->halfWidth); } - if (rightStyleStroke != nullptr) { + if (rightStyleStroke != nullptr) + { maxLineWidth = std::max(maxLineWidth, rightStyleStroke->halfWidth); } } diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.h b/ArchitectureColoredPainting/src/Editor/LayerStyle.h index 780b207..6db22d6 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerStyle.h +++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.h @@ -65,7 +65,7 @@ public: std::unique_ptr makeUnusedStyle(const QString& styleName) const; bool useStyle(const std::shared_ptr& style); bool dropStyle(const QString& styleName); - float boundingBoxAffectValue(); + float boundingBoxAffectValue() const; size_t getHash() const; /**