Skip to content

Commit

Permalink
reset layer dragging status if no buttons were pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Marmare314 committed Jul 26, 2023
1 parent 11a2088 commit be86166
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/game/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3582,6 +3582,7 @@ void CEditor::RenderLayers(CUIRect LayersBox)
bool MoveGroup = false;
bool StartDragLayer = false;
bool StartDragGroup = false;
bool AnyButtonActive = false;
std::vector<int> vButtonsPerGroup;

vButtonsPerGroup.reserve(m_Map.m_vpGroups.size());
Expand Down Expand Up @@ -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,
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)
{
s_InitialMouseY = UI()->MouseY();
Expand Down Expand Up @@ -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,
BUTTON_CONTEXT, "Select layer. Shift click to select multiple.", IGraphics::CORNER_R))
{
AnyButtonActive = true;

if(s_Operation == OP_NONE)
{
s_InitialMouseY = UI()->MouseY();
Expand Down Expand Up @@ -4099,6 +4104,9 @@ void CEditor::RenderLayers(CUIRect LayersBox)
}

s_ScrollRegion.End();

if(!AnyButtonActive)
s_Operation = OP_NONE;
}

bool CEditor::SelectLayerByTile()
Expand Down

0 comments on commit be86166

Please sign in to comment.