commit dcd0c7fe4ce9b1814e90b0dd86ba85dbf970083d
parent 470f5d66ae07e48b57a87125f798ca676b951a7c
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Wed, 28 Aug 2024 19:59:17 +0200
do not attempt to begin drag on an empty image
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/source/jucePluginEditorLib/patchmanager/griditemcontainer.cpp b/source/jucePluginEditorLib/patchmanager/griditemcontainer.cpp
@@ -31,6 +31,9 @@ namespace jucePluginEditorLib::patchManager
}
}
+ if(imageArea.isEmpty())
+ return {};
+
imageArea = imageArea.getIntersection (getLocalBounds());
_x = imageArea.getX();
_y = imageArea.getY();
@@ -88,10 +91,12 @@ namespace jucePluginEditorLib::patchManager
{
int x, y;
const auto dragImage = createSnapshotOfRows(rows, x, y);
-
- const auto p = juce::Point<int> (x, y) - _e.getEventRelativeTo (this).position.toInt();
- dragContainer->startDragging (dragDescription, &m_grid, dragImage, true, &p, &_e.source);
- m_isDragging = true;
+ if(dragImage.getImage().isValid())
+ {
+ const auto p = juce::Point<int> (x, y) - _e.getEventRelativeTo (this).position.toInt();
+ dragContainer->startDragging (dragDescription, &m_grid, dragImage, true, &p, &_e.source);
+ m_isDragging = true;
+ }
}
}
}