Merge pull request #6920 from Marmare314/layer-drag-bug

reset layer dragging status if no buttons were pressed
This commit is contained in:
Robert Müller 2023-07-26 09:01:38 +00:00 committed by GitHub
commit 22bd19be06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3582,6 +3582,7 @@ void CEditor::RenderLayers(CUIRect LayersBox)
bool MoveGroup = false; bool MoveGroup = false;
bool StartDragLayer = false; bool StartDragLayer = false;
bool StartDragGroup = false; bool StartDragGroup = false;
bool AnyButtonActive = false;
std::vector<int> vButtonsPerGroup; std::vector<int> vButtonsPerGroup;
vButtonsPerGroup.reserve(m_Map.m_vpGroups.size()); vButtonsPerGroup.reserve(m_Map.m_vpGroups.size());
@ -3683,6 +3684,8 @@ void CEditor::RenderLayers(CUIRect LayersBox)
if(int Result = DoButton_DraggableEx(&m_Map.m_vpGroups[g], aBuf, g == m_SelectedGroup, &Slot, &Clicked, &Abrupted, if(int Result = DoButton_DraggableEx(&m_Map.m_vpGroups[g], aBuf, g == m_SelectedGroup, &Slot, &Clicked, &Abrupted,
BUTTON_CONTEXT, m_Map.m_vpGroups[g]->m_Collapse ? "Select group. Shift click to select all layers. Double click to expand." : "Select group. Shift click to select all layers. Double click to collapse.", IGraphics::CORNER_R)) BUTTON_CONTEXT, m_Map.m_vpGroups[g]->m_Collapse ? "Select group. Shift click to select all layers. Double click to expand." : "Select group. Shift click to select all layers. Double click to collapse.", IGraphics::CORNER_R))
{ {
AnyButtonActive = true;
if(s_Operation == OP_NONE) if(s_Operation == OP_NONE)
{ {
s_InitialMouseY = UI()->MouseY(); s_InitialMouseY = UI()->MouseY();
@ -3833,6 +3836,8 @@ void CEditor::RenderLayers(CUIRect LayersBox)
if(int Result = DoButton_DraggableEx(m_Map.m_vpGroups[g]->m_vpLayers[i], aBuf, Checked, &Button, &Clicked, &Abrupted, if(int Result = DoButton_DraggableEx(m_Map.m_vpGroups[g]->m_vpLayers[i], aBuf, Checked, &Button, &Clicked, &Abrupted,
BUTTON_CONTEXT, "Select layer. Shift click to select multiple.", IGraphics::CORNER_R)) BUTTON_CONTEXT, "Select layer. Shift click to select multiple.", IGraphics::CORNER_R))
{ {
AnyButtonActive = true;
if(s_Operation == OP_NONE) if(s_Operation == OP_NONE)
{ {
s_InitialMouseY = UI()->MouseY(); s_InitialMouseY = UI()->MouseY();
@ -4099,6 +4104,9 @@ void CEditor::RenderLayers(CUIRect LayersBox)
} }
s_ScrollRegion.End(); s_ScrollRegion.End();
if(!AnyButtonActive)
s_Operation = OP_NONE;
} }
bool CEditor::SelectLayerByTile() bool CEditor::SelectLayerByTile()