Fix duplicate layers in popup layer context

Clear layers from context before adding any layer, preventing layers from being kept in the vector until only a single layer is selected. Fixes #4978.
This commit is contained in:
Corantin H 2023-12-27 23:11:52 +01:00
parent 15e6e5eeab
commit 83540ade5c

View file

@ -4072,6 +4072,9 @@ void CEditor::RenderLayers(CUIRect LayersBox)
}
else if(Result == 2)
{
s_LayerPopupContext.m_vpLayers.clear();
s_LayerPopupContext.m_vLayerIndices.clear();
if(!IsLayerSelected)
{
SelectLayer(i, g);
@ -4099,11 +4102,6 @@ void CEditor::RenderLayers(CUIRect LayersBox)
s_LayerPopupContext.m_vLayerIndices.clear();
}
}
else
{
s_LayerPopupContext.m_vpLayers.clear();
s_LayerPopupContext.m_vLayerIndices.clear();
}
UI()->DoPopupMenu(&s_LayerPopupContext, UI()->MouseX(), UI()->MouseY(), 120, 270, &s_LayerPopupContext, PopupLayer);
}