mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 15:08:19 +00:00
fix scrolling triggering zoom
This commit is contained in:
parent
af29d8da99
commit
76f3dbfe64
|
@ -5899,26 +5899,6 @@ void CEditor::Render()
|
|||
}
|
||||
}
|
||||
|
||||
if(m_Dialog == DIALOG_NONE && UI()->MouseInside(&View))
|
||||
{
|
||||
// Determines in which direction to zoom.
|
||||
int Zoom = 0;
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
Zoom--;
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
Zoom++;
|
||||
|
||||
if(Zoom != 0)
|
||||
{
|
||||
float OldLevel = m_ZoomLevel;
|
||||
m_ZoomLevel = clamp(m_ZoomLevel + Zoom * 20, 50, 2000);
|
||||
if(g_Config.m_EdZoomTarget)
|
||||
ZoomMouseTarget((float)m_ZoomLevel / OldLevel);
|
||||
}
|
||||
}
|
||||
|
||||
m_ZoomLevel = clamp(m_ZoomLevel, 50, 2000);
|
||||
m_WorldZoom = m_ZoomLevel/100.0f;
|
||||
float Brightness = 0.25f;
|
||||
|
||||
if(m_GuiActive)
|
||||
|
@ -6109,6 +6089,27 @@ void CEditor::Render()
|
|||
|
||||
UiDoPopupMenu();
|
||||
|
||||
if(m_Dialog == DIALOG_NONE && !m_MouseInsidePopup && UI()->MouseInside(&View))
|
||||
{
|
||||
// Determines in which direction to zoom.
|
||||
int Zoom = 0;
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_UP))
|
||||
Zoom--;
|
||||
if(Input()->KeyPress(KEY_MOUSE_WHEEL_DOWN))
|
||||
Zoom++;
|
||||
|
||||
if(Zoom != 0)
|
||||
{
|
||||
float OldLevel = m_ZoomLevel;
|
||||
m_ZoomLevel = clamp(m_ZoomLevel + Zoom * 20, 50, 2000);
|
||||
if(g_Config.m_EdZoomTarget)
|
||||
ZoomMouseTarget((float)m_ZoomLevel / OldLevel);
|
||||
}
|
||||
}
|
||||
|
||||
m_ZoomLevel = clamp(m_ZoomLevel, 50, 2000);
|
||||
m_WorldZoom = m_ZoomLevel/100.0f;
|
||||
|
||||
if(m_GuiActive)
|
||||
RenderStatusbar(StatusBar);
|
||||
|
||||
|
@ -6147,6 +6148,8 @@ void CEditor::Render()
|
|||
Graphics()->QuadsEnd();
|
||||
Graphics()->WrapNormal();
|
||||
}
|
||||
|
||||
m_MouseInsidePopup = false;
|
||||
}
|
||||
|
||||
static int UndoStepsListdirCallback(const char *pName, int IsDir, int StorageType, void *pUser)
|
||||
|
|
|
@ -662,6 +662,7 @@ public:
|
|||
|
||||
m_PopupEventActivated = false;
|
||||
m_PopupEventWasActivated = false;
|
||||
m_MouseInsidePopup = false;
|
||||
|
||||
m_FileDialogStorageType = 0;
|
||||
m_pFileDialogTitle = 0;
|
||||
|
@ -818,6 +819,7 @@ public:
|
|||
int m_PopupEventType;
|
||||
int m_PopupEventActivated;
|
||||
int m_PopupEventWasActivated;
|
||||
bool m_MouseInsidePopup;
|
||||
bool m_LargeLayerWasWarned;
|
||||
bool m_PreventUnusedTilesWasWarned;
|
||||
int m_AllowPlaceUnusedTiles;
|
||||
|
|
|
@ -52,6 +52,9 @@ void CEditor::UiDoPopupMenu()
|
|||
bool Inside = UI()->MouseInside(&s_UiPopups[i].m_Rect);
|
||||
UI()->SetHotItem(&s_UiPopups[i].m_pId);
|
||||
|
||||
if(Inside)
|
||||
m_MouseInsidePopup = true;
|
||||
|
||||
if(UI()->ActiveItem() == &s_UiPopups[i].m_pId)
|
||||
{
|
||||
if(!UI()->MouseButton(0))
|
||||
|
|
Loading…
Reference in a new issue