handle person shape aspect ratio
This commit is contained in:
parent
b1beddc9e2
commit
d5f2ed00d5
1 changed files with 7 additions and 0 deletions
|
|
@ -72,6 +72,13 @@ func (s shapePerson) GetDimensionsToFit(width, height, paddingX, paddingY float6
|
||||||
shoulderWidth := totalWidth * personShoulderWidthFactor / (1 - 2*personShoulderWidthFactor)
|
shoulderWidth := totalWidth * personShoulderWidthFactor / (1 - 2*personShoulderWidthFactor)
|
||||||
totalWidth += 2 * shoulderWidth
|
totalWidth += 2 * shoulderWidth
|
||||||
totalHeight := height + paddingY
|
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
|
return totalWidth, totalHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue