From d5f2ed00d58d804f0abfe7e16c2d89d75e227be6 Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Mon, 23 Jan 2023 20:20:42 -0800 Subject: [PATCH] handle person shape aspect ratio --- lib/shape/shape_person.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/shape/shape_person.go b/lib/shape/shape_person.go index e92ddab53..e177135c8 100644 --- a/lib/shape/shape_person.go +++ b/lib/shape/shape_person.go @@ -72,6 +72,13 @@ func (s shapePerson) GetDimensionsToFit(width, height, paddingX, paddingY float6 shoulderWidth := totalWidth * personShoulderWidthFactor / (1 - 2*personShoulderWidthFactor) totalWidth += 2 * shoulderWidth totalHeight := height + paddingY + + // prevent the shape's aspect ratio from becoming too extreme + if totalWidth > 1.5*totalHeight { + totalHeight = totalWidth / 1.5 + } else if totalHeight > 1.5*totalWidth { + totalWidth = totalHeight / 1.5 + } return totalWidth, totalHeight }