5807: Fix minor issues with editor value selectors r=def- a=Robyt3

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
bors[bot] 2022-09-04 11:29:42 +00:00 committed by GitHub
commit d1fdb1f9eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -549,6 +549,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
{ {
s_pLastTextpID = pID; s_pLastTextpID = pID;
s_TextMode = true; s_TextMode = true;
m_LockMouse = false;
if(IsHex) if(IsHex)
str_format(s_aNumStr, sizeof(s_aNumStr), "%06X", Current); str_format(s_aNumStr, sizeof(s_aNumStr), "%06X", Current);
else else
@ -604,7 +605,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
else else
s_Value += m_MouseDeltaX; s_Value += m_MouseDeltaX;
if(absolute(s_Value) > Scale) if(absolute(s_Value) >= Scale)
{ {
int Count = (int)(s_Value / Scale); int Count = (int)(s_Value / Scale);
s_Value = fmod(s_Value, Scale); s_Value = fmod(s_Value, Scale);

View file

@ -473,7 +473,7 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View, void *pContext)
CProperty aProps[] = { CProperty aProps[] = {
{"Group", pEditor->m_SelectedGroup, PROPTYPE_INT_STEP, 0, (int)pEditor->m_Map.m_vpGroups.size() - 1}, {"Group", pEditor->m_SelectedGroup, PROPTYPE_INT_STEP, 0, (int)pEditor->m_Map.m_vpGroups.size() - 1},
{"Order", pEditor->m_vSelectedLayers[0], PROPTYPE_INT_STEP, 0, (int)pCurrentGroup->m_vpLayers.size()}, {"Order", pEditor->m_vSelectedLayers[0], PROPTYPE_INT_STEP, 0, (int)pCurrentGroup->m_vpLayers.size() - 1},
{"Detail", pCurrentLayer && pCurrentLayer->m_Flags & LAYERFLAG_DETAIL, PROPTYPE_BOOL, 0, 1}, {"Detail", pCurrentLayer && pCurrentLayer->m_Flags & LAYERFLAG_DETAIL, PROPTYPE_BOOL, 0, 1},
{nullptr}, {nullptr},
}; };
@ -955,7 +955,7 @@ int CEditor::PopupPoint(CEditor *pEditor, CUIRect View, void *pContext)
CProperty aProps[] = { CProperty aProps[] = {
{"Pos X", x, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Pos X", x, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Pos Y", y, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Pos Y", y, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Color", Color, PROPTYPE_COLOR, -1, (int)pEditor->m_Map.m_vpEnvelopes.size()}, {"Color", Color, PROPTYPE_COLOR, 0, 0},
{"Tex U", tu, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Tex U", tu, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Tex V", tv, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Tex V", tv, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{nullptr}, {nullptr},