fix aspect ratio code
This commit is contained in:
parent
c9082cd50d
commit
f4e7e2f62a
|
@ -397,28 +397,29 @@ void OnAreaResize(uiAreaHandler* handler, uiArea* area, int width, int height)
|
||||||
// top then bottom
|
// top then bottom
|
||||||
|
|
||||||
int widthreq;
|
int widthreq;
|
||||||
int possibleheight;
|
int startY = 0;
|
||||||
|
|
||||||
if (sizemode == 0) // even
|
if (sizemode == 0) // even
|
||||||
{
|
{
|
||||||
widthreq = (height * screenW) / (screenH*2);
|
widthreq = (height * screenW) / (screenH*2);
|
||||||
|
if (widthreq > width)
|
||||||
|
{
|
||||||
|
int newheight = (width * height) / widthreq;
|
||||||
|
startY = (height - newheight) / 2;
|
||||||
|
widthreq = width;
|
||||||
|
height = newheight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // emph. top/bottom
|
else // emph. top/bottom
|
||||||
{
|
{
|
||||||
widthreq = ((height - screenH) * screenW) / screenH;
|
widthreq = ((height - screenH) * screenW) / screenH;
|
||||||
}
|
if (widthreq > width)
|
||||||
|
{
|
||||||
int startY;
|
int newheight = ((width * (height - screenH)) / widthreq) + screenH;
|
||||||
if (widthreq > width)
|
startY = (height - newheight) / 2;
|
||||||
{
|
widthreq = width;
|
||||||
possibleheight = (width * height) / widthreq;
|
height = newheight;
|
||||||
startY = (height - possibleheight) / 2;
|
}
|
||||||
widthreq = width;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
possibleheight = height;
|
|
||||||
startY = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizemode == 2)
|
if (sizemode == 2)
|
||||||
|
|
Loading…
Reference in New Issue