mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Merge pull request #7740 from Robyt3/UI-Mouse-Clamp
Fix mouse being outside of UI screen on right and bottom edges
This commit is contained in:
commit
ee2dd0ac1c
|
@ -179,8 +179,8 @@ void CUI::OnCursorMove(float X, float Y)
|
|||
{
|
||||
if(!CheckMouseLock())
|
||||
{
|
||||
m_UpdatedMousePos.x = clamp(m_UpdatedMousePos.x + X, 0.0f, (float)Graphics()->WindowWidth());
|
||||
m_UpdatedMousePos.y = clamp(m_UpdatedMousePos.y + Y, 0.0f, (float)Graphics()->WindowHeight());
|
||||
m_UpdatedMousePos.x = clamp(m_UpdatedMousePos.x + X, 0.0f, Graphics()->WindowWidth() - 1.0f);
|
||||
m_UpdatedMousePos.y = clamp(m_UpdatedMousePos.y + Y, 0.0f, Graphics()->WindowHeight() - 1.0f);
|
||||
}
|
||||
|
||||
m_UpdatedMouseDelta += vec2(X, Y);
|
||||
|
|
|
@ -2978,7 +2978,7 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
}
|
||||
|
||||
static void *s_pEditorID = (void *)&s_pEditorID;
|
||||
const bool Inside = !m_GuiActive || UI()->MouseInside(&View);
|
||||
const bool Inside = UI()->MouseInside(&View);
|
||||
|
||||
// fetch mouse position
|
||||
float wx = UI()->MouseWorldX();
|
||||
|
@ -8164,7 +8164,7 @@ void CEditor::Render()
|
|||
m_PopupEventWasActivated = true;
|
||||
}
|
||||
|
||||
if(m_Dialog == DIALOG_NONE && !UI()->IsPopupHovered() && (!m_GuiActive || UI()->MouseInside(&View)))
|
||||
if(m_Dialog == DIALOG_NONE && !UI()->IsPopupHovered() && UI()->MouseInside(&View))
|
||||
{
|
||||
// handle zoom hotkeys
|
||||
if(Input()->KeyPress(KEY_KP_MINUS))
|
||||
|
@ -8472,8 +8472,8 @@ void CEditor::HandleCursorMovement()
|
|||
|
||||
if(!UI()->CheckMouseLock())
|
||||
{
|
||||
s_MouseX = clamp<float>(s_MouseX + MouseRelX, 0.0f, Graphics()->WindowWidth());
|
||||
s_MouseY = clamp<float>(s_MouseY + MouseRelY, 0.0f, Graphics()->WindowHeight());
|
||||
s_MouseX = clamp(s_MouseX + MouseRelX, 0.0f, Graphics()->WindowWidth() - 1.0f);
|
||||
s_MouseY = clamp(s_MouseY + MouseRelY, 0.0f, Graphics()->WindowHeight() - 1.0f);
|
||||
}
|
||||
|
||||
// update positions for ui, but only update ui when rendering
|
||||
|
|
Loading…
Reference in a new issue