Why don’t we have these for Juce::Rectangle? I didn’t yet write the code for setting the various points. JUCE doesn’t have those either.
SetBottom for example actually changes the size of the rectangle. I need functions that only change position based on the various 9 points top/bottom/center * left/right/mid. I need these functions to do various rectangle justification inside AND outside of a square.
juce::Justification only works based on placing a rectangle inside another rectangle. With the system of Rectangle::setSomethingSomthing(Rectangle::getSomethingSomething()) we can achieve all possible inside and outside justification.
Here are the GET functions needed
template <typename T> static juce::Point<T> getTopLeft(juce::Rectangle<T> bounds)
{
return bounds.getTopLeft();
}
template <typename T> static juce::Point<T> getTopRight(juce::Rectangle<T> bounds)
{
return bounds.getTopRight();
}
//MISSING FROM JUCE
template <typename T> static juce::Point<T> getTopCenter(juce::Rectangle<T> bounds)
{
int x = bounds.getX() + bounds.getWidth() / T(2);
int y = bounds.getY();
return { x,y };
}
//MISSING FROM JUCE
template <typename T> static juce::Point<T> getMidLeft(juce::Rectangle<T> bounds)
{
int x = bounds.getX();
int y = bounds.getY() + bounds.getHeight() / T(2);
return { x,y };
}
template <typename T> static juce::Point<T> getMidCenter(juce::Rectangle<T> bounds)
{
return bounds.getCentre();
}
//MISSING FROM JUCE
template <typename T> static juce::Point<T> getMidRight(juce::Rectangle<T> bounds)
{
int x = bounds.getX() + bounds.getWidth();
int y = bounds.getY() + bounds.getHeight() / T(2);
return { x,y };
}
template <typename T> static juce::Point<T> getBottomLeft(juce::Rectangle<T> bounds)
{
return bounds.getBottomLeft();
}
//MISSING FROM JUCE
template <typename T> static juce::Point<T> getBottomCenter(juce::Rectangle<T> bounds)
{
int x = bounds.getX() + bounds.getWidth() / T(2);
int y = bounds.getY() + bounds.getHeight();
return { x,y };
}
template <typename T> static juce::Point<T> getBottomRight(juce::Rectangle<T> bounds)
{
return bounds.getBottomRight();
}








