mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fix height and margin of sound and image popups
The height of the sound popup was too small, as it was not updated when the "Readd" button was added. The additional `2.0f` margin at the top of the popups is removed, as all popup menus already have default `5.0f` margins on all sides. The height of the image popup for external images was not including this margin to begin with, so it was slightly too small but is correct now. The height of the image popup for embedded images is adjusted to no longer include this margin. Pass `nullptr` instead of calculating unused `CUIRect` values.
This commit is contained in:
parent
abf795d9da
commit
40dbb1b992
|
@ -3816,7 +3816,6 @@ int CEditor::PopupImage(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
static int s_RemoveButton = 0;
|
||||
|
||||
CUIRect Slot;
|
||||
View.HSplitTop(2.0f, &Slot, &View);
|
||||
View.HSplitTop(12.0f, &Slot, &View);
|
||||
CEditorImage *pImg = pEditor->m_Map.m_vpImages[pEditor->m_SelectedImage];
|
||||
|
||||
|
@ -3828,7 +3827,7 @@ int CEditor::PopupImage(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pImg->m_External = 0;
|
||||
return 1;
|
||||
}
|
||||
View.HSplitTop(5.0f, &Slot, &View);
|
||||
View.HSplitTop(5.0f, nullptr, &View);
|
||||
View.HSplitTop(12.0f, &Slot, &View);
|
||||
}
|
||||
else if(IsVanillaImage(pImg->m_aName))
|
||||
|
@ -3838,7 +3837,7 @@ int CEditor::PopupImage(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pImg->m_External = 1;
|
||||
return 1;
|
||||
}
|
||||
View.HSplitTop(5.0f, &Slot, &View);
|
||||
View.HSplitTop(5.0f, nullptr, &View);
|
||||
View.HSplitTop(12.0f, &Slot, &View);
|
||||
}
|
||||
|
||||
|
@ -3852,7 +3851,7 @@ int CEditor::PopupImage(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
return 1;
|
||||
}
|
||||
|
||||
View.HSplitTop(5.0f, &Slot, &View);
|
||||
View.HSplitTop(5.0f, nullptr, &View);
|
||||
View.HSplitTop(12.0f, &Slot, &View);
|
||||
if(pEditor->DoButton_MenuItem(&s_ReplaceButton, "Replace", 0, &Slot, 0, "Replaces the image with a new one"))
|
||||
{
|
||||
|
@ -3860,7 +3859,7 @@ int CEditor::PopupImage(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
return 1;
|
||||
}
|
||||
|
||||
View.HSplitTop(5.0f, &Slot, &View);
|
||||
View.HSplitTop(5.0f, nullptr, &View);
|
||||
View.HSplitTop(12.0f, &Slot, &View);
|
||||
if(pEditor->DoButton_MenuItem(&s_RemoveButton, "Remove", 0, &Slot, 0, "Removes the image from the map"))
|
||||
{
|
||||
|
@ -3881,7 +3880,6 @@ int CEditor::PopupSound(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
static int s_RemoveButton = 0;
|
||||
|
||||
CUIRect Slot;
|
||||
View.HSplitTop(2.0f, &Slot, &View);
|
||||
View.HSplitTop(12.0f, &Slot, &View);
|
||||
CEditorSound *pSound = pEditor->m_Map.m_vpSounds[pEditor->m_SelectedSound];
|
||||
|
||||
|
@ -3893,7 +3891,7 @@ int CEditor::PopupSound(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
return 1;
|
||||
}
|
||||
|
||||
View.HSplitTop(5.0f, &Slot, &View);
|
||||
View.HSplitTop(5.0f, nullptr, &View);
|
||||
View.HSplitTop(12.0f, &Slot, &View);
|
||||
if(pEditor->DoButton_MenuItem(&s_ReplaceButton, "Replace", 0, &Slot, 0, "Replaces the sound with a new one"))
|
||||
{
|
||||
|
@ -3901,7 +3899,7 @@ int CEditor::PopupSound(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
return 1;
|
||||
}
|
||||
|
||||
View.HSplitTop(5.0f, &Slot, &View);
|
||||
View.HSplitTop(5.0f, nullptr, &View);
|
||||
View.HSplitTop(12.0f, &Slot, &View);
|
||||
if(pEditor->DoButton_MenuItem(&s_RemoveButton, "Remove", 0, &Slot, 0, "Removes the sound from the map"))
|
||||
{
|
||||
|
@ -4095,7 +4093,7 @@ void CEditor::RenderImagesList(CUIRect ToolBox)
|
|||
if(pImg->m_External || IsVanillaImage(pImg->m_aName))
|
||||
Height = 73;
|
||||
else
|
||||
Height = 60;
|
||||
Height = 56;
|
||||
UiInvokePopupMenu(&s_PopupImageID, 0, UI()->MouseX(), UI()->MouseY(), 120, Height, PopupImage);
|
||||
}
|
||||
}
|
||||
|
@ -4213,7 +4211,7 @@ void CEditor::RenderSounds(CUIRect ToolBox)
|
|||
|
||||
static int s_PopupSoundID = 0;
|
||||
if(Result == 2)
|
||||
UiInvokePopupMenu(&s_PopupSoundID, 0, UI()->MouseX(), UI()->MouseY(), 120, 43, PopupSound);
|
||||
UiInvokePopupMenu(&s_PopupSoundID, 0, UI()->MouseX(), UI()->MouseY(), 120, 56, PopupSound);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue