mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Fix split-screen UI wrong positioning on window resize
In vertical split at window heights below 1080, ComputeTileScale's min-scale clamp (>= 1.0) prevented the SWF from scaling down to fit, cropping the bottom and causing repositionHud to shift HUD elements downward. Chat and Tooltips additionally applied an offset from ComputeSplitContentOffset that only produced correct values at the 1920x1080 design resolution. Override the scale for vertical split so the SWF fits the full window height when it is shorter than the movie. Remove the broken content offset from Chat and Tooltips -- the tile crop already positions the content correctly.
This commit is contained in:
parent
28614b922f
commit
da7b6a77c8
|
|
@ -143,13 +143,17 @@ void UIComponent_Chat::render(S32 width, S32 height, C4JRender::eViewportType vi
|
||||||
|
|
||||||
F32 scale;
|
F32 scale;
|
||||||
ComputeTileScale(tileWidth, tileHeight, m_movieWidth, m_movieHeight, needsYTile, scale, tileYStart);
|
ComputeTileScale(tileWidth, tileHeight, m_movieWidth, m_movieHeight, needsYTile, scale, tileYStart);
|
||||||
IggyPlayerSetDisplaySize( getMovie(), (S32)(m_movieWidth * scale), (S32)(m_movieHeight * scale) );
|
|
||||||
|
|
||||||
S32 contentOffX, contentOffY;
|
// For vertical split, scale down to fit the full SWF height when the
|
||||||
ComputeSplitContentOffset(viewport, m_movieWidth, m_movieHeight, scale, tileWidth, tileHeight, tileYStart, contentOffX, contentOffY);
|
// window is shorter than the movie (same fix as HUD).
|
||||||
xPos += contentOffX;
|
if(!needsYTile && m_movieHeight > 0)
|
||||||
yPos += contentOffY;
|
{
|
||||||
ui.setupRenderPosition(xPos, yPos);
|
F32 scaleH = (F32)tileHeight / (F32)m_movieHeight;
|
||||||
|
if(scaleH < scale)
|
||||||
|
scale = scaleH;
|
||||||
|
}
|
||||||
|
|
||||||
|
IggyPlayerSetDisplaySize( getMovie(), (S32)(m_movieWidth * scale), (S32)(m_movieHeight * scale) );
|
||||||
|
|
||||||
IggyPlayerDrawTilesStart ( getMovie() );
|
IggyPlayerDrawTilesStart ( getMovie() );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -247,13 +247,17 @@ void UIComponent_Tooltips::render(S32 width, S32 height, C4JRender::eViewportTyp
|
||||||
|
|
||||||
F32 scale;
|
F32 scale;
|
||||||
ComputeTileScale(tileWidth, tileHeight, m_movieWidth, m_movieHeight, needsYTile, scale, tileYStart);
|
ComputeTileScale(tileWidth, tileHeight, m_movieWidth, m_movieHeight, needsYTile, scale, tileYStart);
|
||||||
IggyPlayerSetDisplaySize( getMovie(), (S32)(m_movieWidth * scale), (S32)(m_movieHeight * scale) );
|
|
||||||
|
|
||||||
S32 contentOffX, contentOffY;
|
// For vertical split, scale down to fit the full SWF height when the
|
||||||
ComputeSplitContentOffset(viewport, m_movieWidth, m_movieHeight, scale, tileWidth, tileHeight, tileYStart, contentOffX, contentOffY);
|
// window is shorter than the movie (same fix as HUD).
|
||||||
xPos += contentOffX;
|
if(!needsYTile && m_movieHeight > 0)
|
||||||
yPos += contentOffY;
|
{
|
||||||
ui.setupRenderPosition(xPos, yPos);
|
F32 scaleH = (F32)tileHeight / (F32)m_movieHeight;
|
||||||
|
if(scaleH < scale)
|
||||||
|
scale = scaleH;
|
||||||
|
}
|
||||||
|
|
||||||
|
IggyPlayerSetDisplaySize( getMovie(), (S32)(m_movieWidth * scale), (S32)(m_movieHeight * scale) );
|
||||||
|
|
||||||
IggyPlayerDrawTilesStart ( getMovie() );
|
IggyPlayerDrawTilesStart ( getMovie() );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -718,7 +718,21 @@ void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewpor
|
||||||
F32 scale;
|
F32 scale;
|
||||||
ComputeTileScale(tileWidth, tileHeight, m_movieWidth, m_movieHeight, needsYTile, scale, tileYStart);
|
ComputeTileScale(tileWidth, tileHeight, m_movieWidth, m_movieHeight, needsYTile, scale, tileYStart);
|
||||||
|
|
||||||
IggyPlayerSetDisplaySize( getMovie(), static_cast<S32>(m_movieWidth * scale), static_cast<S32>(m_movieHeight * scale) );
|
// For vertical split, if the window is shorter than the SWF movie,
|
||||||
|
// scale the movie down to fit the full height instead of cropping.
|
||||||
|
// ComputeTileScale clamps scale >= 1.0 (needed for quadrant mode),
|
||||||
|
// but in vertical split the tile covers the full screen height and
|
||||||
|
// cropping the bottom pushes RepositionHud's ActionScript to shift
|
||||||
|
// elements down. Scaling down keeps visibleH == movieHeight in SWF
|
||||||
|
// space, so ActionScript sees the full height and applies no offset.
|
||||||
|
if(!needsYTile && m_movieHeight > 0)
|
||||||
|
{
|
||||||
|
F32 scaleH = (F32)tileHeight / (F32)m_movieHeight;
|
||||||
|
if(scaleH < scale)
|
||||||
|
scale = scaleH;
|
||||||
|
}
|
||||||
|
|
||||||
|
IggyPlayerSetDisplaySize( getMovie(), (S32)(m_movieWidth * scale), (S32)(m_movieHeight * scale) );
|
||||||
|
|
||||||
repositionHud(tileWidth, tileHeight, scale);
|
repositionHud(tileWidth, tileHeight, scale);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue