From 92545f9deb569ce8b0f1e33cc624f312e755f9fe Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 10 Nov 2017 11:23:24 +0000 Subject: [PATCH] Convert mouse coordinate to correct Component space when dragging SidePanel --- modules/juce_gui_basics/layout/juce_SidePanel.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/juce_gui_basics/layout/juce_SidePanel.cpp b/modules/juce_gui_basics/layout/juce_SidePanel.cpp index cc09b804f8..c2b3d07207 100644 --- a/modules/juce_gui_basics/layout/juce_SidePanel.cpp +++ b/modules/juce_gui_basics/layout/juce_SidePanel.cpp @@ -133,7 +133,14 @@ void SidePanel::mouseDrag (const MouseEvent& e) { if (shouldResize) { - auto currentMouseDragX = static_cast (e.position.x); + Point convertedPoint; + + if (getParentComponent() == nullptr) + convertedPoint = e.eventComponent->localPointToGlobal (e.getPosition()); + else + convertedPoint = getParentComponent()->getLocalPoint (e.eventComponent, e.getPosition()); + + auto currentMouseDragX = convertedPoint.x; if (isOnLeft) {