|
|
|
@@ -237,19 +237,43 @@ struct Component::ComponentHelpers |
|
|
|
template <typename PointOrRect>
|
|
|
|
static PointOrRect convertFromParentSpace (const Component& comp, PointOrRect pointInParentSpace)
|
|
|
|
{
|
|
|
|
if (comp.affineTransform == nullptr)
|
|
|
|
return pointInParentSpace - comp.getPosition();
|
|
|
|
if (comp.affineTransform != nullptr)
|
|
|
|
pointInParentSpace = pointInParentSpace.transformedBy (comp.affineTransform->inverted());
|
|
|
|
|
|
|
|
return pointInParentSpace.transformedBy (comp.affineTransform->inverted()) - comp.getPosition();
|
|
|
|
if (comp.isOnDesktop())
|
|
|
|
{
|
|
|
|
if (ComponentPeer* peer = comp.getPeer())
|
|
|
|
pointInParentSpace = unscaledScreenPosToScaled (peer->globalToLocal (scaledScreenPosToUnscaled (pointInParentSpace)));
|
|
|
|
else
|
|
|
|
jassertfalse;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pointInParentSpace -= comp.getPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
return pointInParentSpace;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename PointOrRect>
|
|
|
|
static PointOrRect convertToParentSpace (const Component& comp, PointOrRect pointInLocalSpace)
|
|
|
|
{
|
|
|
|
if (comp.affineTransform == nullptr)
|
|
|
|
return pointInLocalSpace + comp.getPosition();
|
|
|
|
if (comp.isOnDesktop())
|
|
|
|
{
|
|
|
|
if (ComponentPeer* peer = comp.getPeer())
|
|
|
|
pointInLocalSpace = unscaledScreenPosToScaled (peer->localToGlobal (scaledScreenPosToUnscaled (pointInLocalSpace)));
|
|
|
|
else
|
|
|
|
jassertfalse;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pointInLocalSpace += comp.getPosition();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (comp.affineTransform != nullptr)
|
|
|
|
pointInLocalSpace = pointInLocalSpace.transformedBy (*comp.affineTransform);
|
|
|
|
|
|
|
|
return (pointInLocalSpace + comp.getPosition()).transformedBy (*comp.affineTransform);
|
|
|
|
return pointInLocalSpace;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename PointOrRect>
|
|
|
|
|