Skip to content

Commit

Permalink
dismiss only if drag is active
Browse files Browse the repository at this point in the history
  • Loading branch information
alcomposer committed Sep 7, 2023
1 parent 17a6a50 commit 2221688
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/Dialogs/ListBoxObjectItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@ void ListBoxObjectItem::mouseDown(MouseEvent const& e)

void ListBoxObjectItem::mouseUp(MouseEvent const& e)
{
dismissMenu(false);
if (dragging)
dismissMenu(false);
}

void ListBoxObjectItem::mouseDrag(MouseEvent const& e)
{
if (e.getDistanceFromDragStart() < 5)
return;

dragging = true;

auto* dragContainer = ZoomableDragAndDropContainer::findParentDragContainerFor(this);

if (dragContainer->isDragAndDropActive())
Expand Down
2 changes: 2 additions & 0 deletions Source/Dialogs/ListBoxObjectItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ class ListBoxObjectItem : public juce::Component
ImageWithOffset dragImage;
bool mouseHover = false;

bool dragging = false;

std::function<void(bool shouldFade)> dismissMenu;
};

0 comments on commit 2221688

Please sign in to comment.