mirror of
https://github.com/dashr9230/SA-MP.git
synced 2026-10-10 03:33:04 +08:00
[saco] Match CDXUTIMEEditBox::RenderCandidateReadingWindow; retail has no bottom/top/right/left fitting
This commit is contained in:
@@ -7077,12 +7077,6 @@ void CDXUTIMEEditBox::RenderCandidateReadingWindow( IDirect3DDevice9* pd3dDevice
|
||||
}
|
||||
|
||||
// Now that we have the dimension, calculate the location for the candidate window.
|
||||
// We attempt to fit the window in this order:
|
||||
// bottom, top, right, left.
|
||||
|
||||
bool bHasPosition = false;
|
||||
|
||||
// Bottom
|
||||
SetRect( &rc, s_ptCompString.x + nXComp, s_ptCompString.y + m_rcText.bottom - m_rcText.top,
|
||||
s_ptCompString.x + nXComp + nWidthRequired, s_ptCompString.y + m_rcText.bottom - m_rcText.top + nHeightRequired );
|
||||
// if the right edge is cut off, move it left.
|
||||
@@ -7091,52 +7085,6 @@ void CDXUTIMEEditBox::RenderCandidateReadingWindow( IDirect3DDevice9* pd3dDevice
|
||||
rc.left -= rc.right - m_pDialog->GetWidth();
|
||||
rc.right = m_pDialog->GetWidth();
|
||||
}
|
||||
if( rc.bottom <= m_pDialog->GetHeight() )
|
||||
bHasPosition = true;
|
||||
|
||||
// Top
|
||||
if( !bHasPosition )
|
||||
{
|
||||
SetRect( &rc, s_ptCompString.x + nXComp, s_ptCompString.y - nHeightRequired,
|
||||
s_ptCompString.x + nXComp + nWidthRequired, s_ptCompString.y );
|
||||
// if the right edge is cut off, move it left.
|
||||
if( rc.right > m_pDialog->GetWidth() )
|
||||
{
|
||||
rc.left -= rc.right - m_pDialog->GetWidth();
|
||||
rc.right = m_pDialog->GetWidth();
|
||||
}
|
||||
if( rc.top >= 0 )
|
||||
bHasPosition = true;
|
||||
}
|
||||
|
||||
// Right
|
||||
if( !bHasPosition )
|
||||
{
|
||||
int nXCompTrail;
|
||||
s_CompString.CPtoX( s_nCompCaret, TRUE, &nXCompTrail );
|
||||
SetRect( &rc, s_ptCompString.x + nXCompTrail, 0,
|
||||
s_ptCompString.x + nXCompTrail + nWidthRequired, nHeightRequired );
|
||||
if( rc.right <= m_pDialog->GetWidth() )
|
||||
bHasPosition = true;
|
||||
}
|
||||
|
||||
// Left
|
||||
if( !bHasPosition )
|
||||
{
|
||||
SetRect( &rc, s_ptCompString.x + nXComp - nWidthRequired, 0,
|
||||
s_ptCompString.x + nXComp, nHeightRequired );
|
||||
if( rc.right >= 0 )
|
||||
bHasPosition = true;
|
||||
}
|
||||
|
||||
if( !bHasPosition )
|
||||
{
|
||||
// The dialog is too small for the candidate window.
|
||||
// Fall back to render at 0, 0. Some part of the window
|
||||
// will be cut off.
|
||||
rc.left = 0;
|
||||
rc.right = nWidthRequired;
|
||||
}
|
||||
|
||||
// If we are rendering the candidate window, save the position
|
||||
// so that mouse clicks are checked properly.
|
||||
|
||||
Reference in New Issue
Block a user