1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-06 04:00:08 +00:00

Fix for broken screen coord conversion in plugin windows.

This commit is contained in:
jules 2013-07-29 16:31:03 +01:00
parent aafa12fd81
commit fc21a145cf
4 changed files with 41 additions and 14 deletions

View file

@ -59,6 +59,12 @@ public:
static Point<int> screenPosToLocalPos (Component& comp, Point<int> pos)
{
if (ComponentPeer* const peer = comp.getPeer())
{
pos = peer->globalToLocal (pos);
return comp.getLocalPoint (&peer->getComponent(), Component::ComponentHelpers::unscaledScreenPosToScaled (pos));
}
return comp.getLocalPoint (nullptr, Component::ComponentHelpers::unscaledScreenPosToScaled (pos));
}
@ -66,9 +72,8 @@ public:
{
if (ComponentPeer* const peer = getPeer())
{
Point<int> relativePos (Component::ComponentHelpers::unscaledScreenPosToScaled (peer->globalToLocal (screenPos)));
Component& comp = peer->getComponent();
Point<int> relativePos (Component::ComponentHelpers::convertFromParentSpace (comp,
Component::ComponentHelpers::unscaledScreenPosToScaled (screenPos)));
// (the contains() call is needed to test for overlapping desktop windows)
if (comp.contains (relativePos))