fix: clamp blob radii at half min dimension
This commit is contained in:
parent
f77ba920ea
commit
45d7cdf02c
2 changed files with 8 additions and 6 deletions
|
|
@ -157,11 +157,12 @@ void BlobRect::setBottomRightRadius(qreal r) {
|
|||
}
|
||||
|
||||
void BlobRect::cornerRadii(float out[4]) const {
|
||||
const auto base = static_cast<float>(m_radius);
|
||||
out[0] = m_topRightRadius >= 0 ? static_cast<float>(m_topRightRadius) : base;
|
||||
out[1] = m_bottomRightRadius >= 0 ? static_cast<float>(m_bottomRightRadius) : base;
|
||||
out[2] = m_bottomLeftRadius >= 0 ? static_cast<float>(m_bottomLeftRadius) : base;
|
||||
out[3] = m_topLeftRadius >= 0 ? static_cast<float>(m_topLeftRadius) : base;
|
||||
const auto maxR = static_cast<float>(std::min(width(), height())) * 0.5f;
|
||||
const auto base = std::min(static_cast<float>(m_radius), maxR);
|
||||
out[0] = std::min(m_topRightRadius >= 0 ? static_cast<float>(m_topRightRadius) : base, maxR);
|
||||
out[1] = std::min(m_bottomRightRadius >= 0 ? static_cast<float>(m_bottomRightRadius) : base, maxR);
|
||||
out[2] = std::min(m_bottomLeftRadius >= 0 ? static_cast<float>(m_bottomLeftRadius) : base, maxR);
|
||||
out[3] = std::min(m_topLeftRadius >= 0 ? static_cast<float>(m_topLeftRadius) : base, maxR);
|
||||
}
|
||||
|
||||
bool BlobRect::isExcluded(const BlobShape* other) const {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,8 @@ void BlobShape::updateCenteredDeformMatrix() {
|
|||
}
|
||||
|
||||
void BlobShape::cornerRadii(float out[4]) const {
|
||||
const auto r = static_cast<float>(m_radius);
|
||||
const auto maxR = static_cast<float>(std::min(width(), height())) * 0.5f;
|
||||
const auto r = std::min(static_cast<float>(m_radius), maxR);
|
||||
out[0] = r;
|
||||
out[1] = r;
|
||||
out[2] = r;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue