Browse Source

Convert mouse coordinate to correct Component space when dragging SidePanel

tags/2021-05-28
ed 8 years ago
parent
commit
92545f9deb
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      modules/juce_gui_basics/layout/juce_SidePanel.cpp

+ 8
- 1
modules/juce_gui_basics/layout/juce_SidePanel.cpp View File

@@ -133,7 +133,14 @@ void SidePanel::mouseDrag (const MouseEvent& e)
{
if (shouldResize)
{
auto currentMouseDragX = static_cast<int> (e.position.x);
Point<int> convertedPoint;
if (getParentComponent() == nullptr)
convertedPoint = e.eventComponent->localPointToGlobal (e.getPosition());
else
convertedPoint = getParentComponent()->getLocalPoint (e.eventComponent, e.getPosition());
auto currentMouseDragX = convertedPoint.x;
if (isOnLeft)
{


Loading…
Cancel
Save