patch bubbles

This commit is contained in:
cheykrym 2025-12-11 23:41:12 +03:00
parent 73bd36e428
commit 1903e86a02

View File

@ -791,14 +791,23 @@ private struct MessageBubbleShape: Shape {
let horizontalSpan = max(0, rect.width - 2 * radius) let horizontalSpan = max(0, rect.width - 2 * radius)
let hornsEnabled = horizontalSpan > (2 * hornWidth + 2 * hornSpacing) let hornsEnabled = horizontalSpan > 0.5
let legsEnabled = horizontalSpan > (2 * legWidth + 2 * legSpacing) let legsEnabled = horizontalSpan > 0.5
let effectiveHornWidth = hornsEnabled ? min(hornWidth, horizontalSpan / 4) : 0 func clampedFeatureWidth(targetWidth: CGFloat) -> CGFloat {
let effectiveLegWidth = legsEnabled ? min(legWidth, horizontalSpan / 4) : 0 guard horizontalSpan > 0 else { return 0 }
let preferredWidth = max(horizontalSpan * 0.25, targetWidth)
return min(preferredWidth, min(targetWidth, horizontalSpan / 2))
}
let effectiveHornSpacing = hornsEnabled ? min(hornSpacing, (horizontalSpan - effectiveHornWidth * 2) / 2) : 0 let effectiveHornWidth = hornsEnabled ? clampedFeatureWidth(targetWidth: hornWidth) : 0
let effectiveLegSpacing = legsEnabled ? min(legSpacing, (horizontalSpan - effectiveLegWidth * 2) / 2) : 0 let effectiveLegWidth = legsEnabled ? clampedFeatureWidth(targetWidth: legWidth) : 0
let hornSpacingCandidate = max(horizontalSpan - effectiveHornWidth * 2, 0) / 2
let legSpacingCandidate = max(horizontalSpan - effectiveLegWidth * 2, 0) / 2
let effectiveHornSpacing = hornsEnabled ? min(hornSpacing, hornSpacingCandidate) : 0
let effectiveLegSpacing = legsEnabled ? min(legSpacing, legSpacingCandidate) : 0
let leftHornStart = left + radius + effectiveHornSpacing let leftHornStart = left + radius + effectiveHornSpacing
let rightHornStart = right - radius - effectiveHornSpacing - effectiveHornWidth let rightHornStart = right - radius - effectiveHornSpacing - effectiveHornWidth