mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-26 05:14:21 +00:00
Fix text width being calculated incorrectly in certain situations
This commit is contained in:
parent
3265575d1e
commit
838ac1c85c
@ -389,27 +389,23 @@ function newobject:SetText(t)
|
|||||||
v.x = drawx
|
v.x = drawx
|
||||||
v.y = drawy
|
v.y = drawy
|
||||||
else
|
else
|
||||||
if k ~= 1 then
|
if string.byte(text) == 10 then
|
||||||
if string.byte(text) == 10 then
|
twidth = 0
|
||||||
twidth = 0
|
drawx = 0
|
||||||
drawx = 0
|
width = 0
|
||||||
width = 0
|
drawy = drawy + largestheight
|
||||||
drawy = drawy + largestheight
|
largestheight = 0
|
||||||
largestheight = 0
|
text = ""
|
||||||
text = ""
|
if lastwidth < textwidth then
|
||||||
if lastwidth < textwidth then
|
lastwidth = textwidth
|
||||||
lastwidth = textwidth
|
|
||||||
end
|
|
||||||
if largestwidth < textwidth then
|
|
||||||
largestwidth = textwidth
|
|
||||||
end
|
|
||||||
textwidth = 0
|
|
||||||
else
|
|
||||||
drawx = drawx + prevtextwidth
|
|
||||||
textwidth = textwidth + width
|
|
||||||
end
|
end
|
||||||
|
if largestwidth < textwidth then
|
||||||
|
largestwidth = textwidth
|
||||||
|
end
|
||||||
|
textwidth = 0
|
||||||
else
|
else
|
||||||
initialwidth = width
|
drawx = drawx + prevtextwidth
|
||||||
|
textwidth = textwidth + width
|
||||||
end
|
end
|
||||||
prevtextwidth = width
|
prevtextwidth = width
|
||||||
prevtextheight = height
|
prevtextheight = height
|
||||||
@ -424,7 +420,7 @@ function newobject:SetText(t)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if textwidth < largestwidth then
|
if textwidth < largestwidth then
|
||||||
textwidth = largestwidth + initialwidth
|
textwidth = largestwidth
|
||||||
end
|
end
|
||||||
|
|
||||||
if maxw > 0 then
|
if maxw > 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user