mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Renamed Rectangle::transformed to Rectangle::transformedBy, in order to match the method name in Point, and allow easier use of these classes in templates.
This commit is contained in:
parent
60a0087114
commit
072c27d7f4
7 changed files with 31 additions and 25 deletions
|
|
@ -274,12 +274,16 @@ namespace juce
|
|||
#ifdef DOXYGEN
|
||||
/** This macro can be used to wrap a function which has been deprecated. */
|
||||
#define JUCE_DEPRECATED(functionDef)
|
||||
#define JUCE_DEPRECATED_WITH_BODY(functionDef, body)
|
||||
#elif JUCE_MSVC && ! JUCE_NO_DEPRECATION_WARNINGS
|
||||
#define JUCE_DEPRECATED(functionDef) __declspec(deprecated) functionDef
|
||||
#define JUCE_DEPRECATED(functionDef) __declspec(deprecated) functionDef
|
||||
#define JUCE_DEPRECATED_WITH_BODY(functionDef, body) __declspec(deprecated) functionDef body
|
||||
#elif JUCE_GCC && ! JUCE_NO_DEPRECATION_WARNINGS
|
||||
#define JUCE_DEPRECATED(functionDef) functionDef __attribute__ ((deprecated))
|
||||
#define JUCE_DEPRECATED(functionDef) functionDef __attribute__ ((deprecated))
|
||||
#define JUCE_DEPRECATED_WITH_BODY(functionDef, body) functionDef __attribute__ ((deprecated)) body
|
||||
#else
|
||||
#define JUCE_DEPRECATED(functionDef) functionDef
|
||||
#define JUCE_DEPRECATED(functionDef) functionDef
|
||||
#define JUCE_DEPRECATED_WITH_BODY(functionDef, body) functionDef body
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ public:
|
|||
e.g. @code
|
||||
AffineTransform myTransform = AffineTransform::identity.rotated (.5f)
|
||||
.scaled (2.0f);
|
||||
|
||||
@endcode
|
||||
*/
|
||||
static const AffineTransform identity;
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ Rectangle<float> Path::getBounds() const noexcept
|
|||
|
||||
Rectangle<float> Path::getBoundsTransformed (const AffineTransform& transform) const noexcept
|
||||
{
|
||||
return getBounds().transformed (transform);
|
||||
return getBounds().transformedBy (transform);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -651,7 +651,7 @@ public:
|
|||
|
||||
This should only be used on floating point rectangles.
|
||||
*/
|
||||
Rectangle transformed (const AffineTransform& transform) const noexcept
|
||||
Rectangle transformedBy (const AffineTransform& transform) const noexcept
|
||||
{
|
||||
typedef typename TypeHelpers::SmallestFloatType<ValueType>::type FloatType;
|
||||
|
||||
|
|
@ -804,7 +804,8 @@ public:
|
|||
parseIntAfterSpace (toks[3]));
|
||||
}
|
||||
|
||||
typedef ValueType Type;
|
||||
// This has been renamed by transformedBy, in order to match the method names used in the Point class.
|
||||
JUCE_DEPRECATED_WITH_BODY (Rectangle transformed (const AffineTransform& t) const noexcept, { return transformedBy (t); })
|
||||
|
||||
private:
|
||||
friend class RectangleList;
|
||||
|
|
|
|||
|
|
@ -123,13 +123,13 @@ public:
|
|||
template <typename Type>
|
||||
Rectangle<Type> transformed (const Rectangle<Type>& r) const noexcept
|
||||
{
|
||||
return r.transformed (complexTransform);
|
||||
return r.transformedBy (complexTransform);
|
||||
}
|
||||
|
||||
Rectangle<int> deviceSpaceToUserSpace (const Rectangle<int>& r) const noexcept
|
||||
{
|
||||
return isOnlyTranslated ? r.translated (-xOffset, -yOffset)
|
||||
: r.transformed (complexTransform.inverted());
|
||||
: r.transformedBy (complexTransform.inverted());
|
||||
}
|
||||
|
||||
AffineTransform complexTransform;
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ struct Component::ComponentHelpers
|
|||
if (comp.affineTransform == nullptr)
|
||||
return areaInParentSpace - comp.getPosition();
|
||||
|
||||
return areaInParentSpace.toFloat().transformed (comp.affineTransform->inverted()).getSmallestIntegerContainer() - comp.getPosition();
|
||||
return areaInParentSpace.toFloat().transformedBy (comp.affineTransform->inverted()).getSmallestIntegerContainer() - comp.getPosition();
|
||||
}
|
||||
|
||||
static Point<int> convertToParentSpace (const Component& comp, Point<int> pointInLocalSpace)
|
||||
|
|
@ -229,7 +229,7 @@ struct Component::ComponentHelpers
|
|||
if (comp.affineTransform == nullptr)
|
||||
return areaInLocalSpace + comp.getPosition();
|
||||
|
||||
return (areaInLocalSpace + comp.getPosition()).transformed (*comp.affineTransform);
|
||||
return (areaInLocalSpace + comp.getPosition()).transformedBy (*comp.affineTransform);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
|
|
@ -257,6 +257,9 @@ struct Component::ComponentHelpers
|
|||
|
||||
if (source->isOnDesktop())
|
||||
{
|
||||
if (source->isTransformed())
|
||||
p = p.transformedBy (source->getTransform());
|
||||
|
||||
p = source->getPeer()->localToGlobal (p);
|
||||
source = nullptr;
|
||||
}
|
||||
|
|
@ -274,9 +277,16 @@ struct Component::ComponentHelpers
|
|||
const Component* const topLevelComp = target->getTopLevelComponent();
|
||||
|
||||
if (topLevelComp->isOnDesktop())
|
||||
{
|
||||
p = topLevelComp->getPeer()->globalToLocal (p);
|
||||
|
||||
if (topLevelComp->isTransformed())
|
||||
p = p.transformedBy (topLevelComp->getTransform().inverted());
|
||||
}
|
||||
else
|
||||
{
|
||||
p = convertFromParentSpace (*topLevelComp, p);
|
||||
}
|
||||
|
||||
if (topLevelComp == target)
|
||||
return p;
|
||||
|
|
@ -1792,7 +1802,7 @@ void Component::internalRepaintUnchecked (const Rectangle<int>& area, const bool
|
|||
CHECK_MESSAGE_MANAGER_IS_LOCKED
|
||||
|
||||
if (ComponentPeer* const peer = getPeer())
|
||||
peer->repaint (affineTransform != nullptr ? area.transformed (*affineTransform)
|
||||
peer->repaint (affineTransform != nullptr ? area.transformedBy (*affineTransform)
|
||||
: area);
|
||||
}
|
||||
else
|
||||
|
|
@ -2102,7 +2112,7 @@ Rectangle<int> Component::getLocalBounds() const noexcept
|
|||
Rectangle<int> Component::getBoundsInParent() const noexcept
|
||||
{
|
||||
return affineTransform == nullptr ? bounds
|
||||
: bounds.transformed (*affineTransform);
|
||||
: bounds.transformedBy (*affineTransform);
|
||||
}
|
||||
|
||||
void Component::getVisibleArea (RectangleList& result, const bool includeSiblings) const
|
||||
|
|
|
|||
|
|
@ -78,33 +78,25 @@ void ComponentPeer::updateBounds()
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
static Point<int> peerPositionToComp (ComponentPeer& peer, Point<int> pos)
|
||||
{
|
||||
if (peer.getComponent().isTransformed())
|
||||
return pos.transformedBy (peer.getComponent().getTransform().inverted());
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
void ComponentPeer::handleMouseEvent (const int touchIndex, const Point<int> positionWithinPeer,
|
||||
const ModifierKeys newMods, const int64 time)
|
||||
{
|
||||
if (MouseInputSource* mouse = Desktop::getInstance().getOrCreateMouseInputSource (touchIndex))
|
||||
mouse->handleEvent (*this, peerPositionToComp (*this, positionWithinPeer), time, newMods);
|
||||
mouse->handleEvent (*this, positionWithinPeer, time, newMods);
|
||||
}
|
||||
|
||||
void ComponentPeer::handleMouseWheel (const int touchIndex, const Point<int> positionWithinPeer,
|
||||
const int64 time, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (MouseInputSource* mouse = Desktop::getInstance().getOrCreateMouseInputSource (touchIndex))
|
||||
mouse->handleWheel (*this, peerPositionToComp (*this, positionWithinPeer), time, wheel);
|
||||
mouse->handleWheel (*this, positionWithinPeer, time, wheel);
|
||||
}
|
||||
|
||||
void ComponentPeer::handleMagnifyGesture (const int touchIndex, const Point<int> positionWithinPeer,
|
||||
const int64 time, const float scaleFactor)
|
||||
{
|
||||
if (MouseInputSource* mouse = Desktop::getInstance().getOrCreateMouseInputSource (touchIndex))
|
||||
mouse->handleMagnifyGesture (*this, peerPositionToComp (*this, positionWithinPeer), time, scaleFactor);
|
||||
mouse->handleMagnifyGesture (*this, positionWithinPeer, time, scaleFactor);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -292,7 +284,7 @@ void ComponentPeer::handleMovedOrResized()
|
|||
{
|
||||
const WeakReference<Component> deletionChecker (&component);
|
||||
|
||||
const Rectangle<int> newBounds (getBounds().transformed (component.getTransform().inverted()));
|
||||
const Rectangle<int> newBounds (getBounds().transformedBy (component.getTransform().inverted()));
|
||||
const bool wasMoved = (component.getPosition() != newBounds.getPosition());
|
||||
const bool wasResized = (component.getWidth() != newBounds.getWidth() || component.getHeight() != newBounds.getHeight());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue