Browse Source

Fix for ComponentMovementWatcher with top-level windows.

tags/2021-05-28
jules 12 years ago
parent
commit
a228a3859b
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      modules/juce_gui_basics/layout/juce_ComponentMovementWatcher.cpp

+ 9
- 3
modules/juce_gui_basics/layout/juce_ComponentMovementWatcher.cpp View File

@@ -79,10 +79,16 @@ void ComponentMovementWatcher::componentMovedOrResized (Component&, bool wasMove
{ {
if (wasMoved) if (wasMoved)
{ {
const Point<int> pos (component->getTopLevelComponent()->getLocalPoint (component, Point<int>()));
Point<int> newPos;
Component* const top = component->getTopLevelComponent();
wasMoved = lastBounds.getPosition() != pos;
lastBounds.setPosition (pos);
if (top != component)
newPos = top->getLocalPoint (component, Point<int>());
else
newPos = top->getPosition();
wasMoved = lastBounds.getPosition() != newPos;
lastBounds.setPosition (newPos);
} }
wasResized = (lastBounds.getWidth() != component->getWidth() || lastBounds.getHeight() != component->getHeight()); wasResized = (lastBounds.getWidth() != component->getWidth() || lastBounds.getHeight() != component->getHeight());


Loading…
Cancel
Save