From 3c2eada43f664ab9163d2c88f65fb1d68ba8d13d Mon Sep 17 00:00:00 2001 From: "yang.yongquan" <3395816735@qq.com> Date: Sat, 18 Mar 2023 20:26:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=8E=B7=E5=BE=97?= =?UTF-8?q?=E7=BA=BF=E5=AE=BD=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Editor/LayerStyle.cpp | 19 +++++++++++++++++++ .../src/Editor/LayerStyle.h | 1 + 2 files changed, 20 insertions(+) diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp index 5be1b72..5115658 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp +++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.cpp @@ -197,6 +197,25 @@ bool LayerStyleContainer::dropStyle(const QString& styleName) return true; } +float LayerStyleContainer::boundingBoxAffectValue() { + 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) { + maxLineWidth = std::max(maxLineWidth, leftStyleStroke->halfWidth); + } + if (rightStyleStroke != nullptr) { + maxLineWidth = std::max(maxLineWidth, rightStyleStroke->halfWidth); + } + } + } + return maxLineWidth; +} + inline size_t LayerStyleContainer::getHash() const { return hash; diff --git a/ArchitectureColoredPainting/src/Editor/LayerStyle.h b/ArchitectureColoredPainting/src/Editor/LayerStyle.h index a310b6e..ed328bb 100644 --- a/ArchitectureColoredPainting/src/Editor/LayerStyle.h +++ b/ArchitectureColoredPainting/src/Editor/LayerStyle.h @@ -56,6 +56,7 @@ public: std::unique_ptr makeUnusedStyle(const QString& styleName) const; bool useStyle(const std::shared_ptr& style); bool dropStyle(const QString& styleName); + float boundingBoxAffectValue(); size_t getHash() const; /**