mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-02 03:20:06 +00:00
BubbleComponent: Correctly convert screen coordinates for BubbleComponents that have a custom AffineTransforms
This commit is contained in:
parent
ea43a1f57d
commit
b85726a646
1 changed files with 3 additions and 4 deletions
|
|
@ -64,7 +64,7 @@ void BubbleComponent::setPosition (Component* componentToPointTo, int distanceFr
|
|||
if (Component* p = getParentComponent())
|
||||
target = p->getLocalArea (componentToPointTo, componentToPointTo->getLocalBounds());
|
||||
else
|
||||
target = componentToPointTo->getScreenBounds();
|
||||
target = componentToPointTo->getScreenBounds().transformedBy (getTransform().inverted());
|
||||
|
||||
setPosition (target, distanceFromTarget, arrowLength);
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ void BubbleComponent::setPosition (Rectangle<int> rectangleToPointTo,
|
|||
const int totalH = content.getHeight() + distanceFromTarget * 2;
|
||||
|
||||
const Rectangle<int> availableSpace (getParentComponent() != nullptr ? getParentComponent()->getLocalBounds()
|
||||
: getParentMonitorArea());
|
||||
: getParentMonitorArea().transformedBy (getTransform().inverted()));
|
||||
|
||||
int spaceAbove = ((allowablePlacements & above) != 0) ? jmax (0, rectangleToPointTo.getY() - availableSpace.getY()) : -1;
|
||||
int spaceBelow = ((allowablePlacements & below) != 0) ? jmax (0, availableSpace.getBottom() - rectangleToPointTo.getBottom()) : -1;
|
||||
|
|
@ -145,8 +145,7 @@ void BubbleComponent::setPosition (Rectangle<int> rectangleToPointTo,
|
|||
}
|
||||
}
|
||||
|
||||
auto origin = Point<int> (targetX - arrowTip.x, targetY - arrowTip.y).transformedBy (getTransform().inverted());
|
||||
setBounds (origin.getX(), origin.getY(), totalW, totalH);
|
||||
setBounds (targetX - arrowTip.x, targetY - arrowTip.y, totalW, totalH);
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue