Components in JUCE can have a sub-pixel position/size when transformed meaning their position and or size may not always be exact integers.
In the example you gave, you’re calculating a juce::Rectangle<int> object with the first line, setting the Component’s bounds, and then scaling the Component which results in a non-integer size.
You could simply scale the rectangle before setting it as the Component’s bounds:
void MainComponent::resized()
{
auto rectArea = getLocalBounds().removeFromBottom(50).reduced(10).toFloat();
rectArea = rectArea.transformedBy(juce::AffineTransform::scale(0.73f, 0.73f));
rect.setBounds(rectArea.toNearestIntEdges());
rect.setCentrePosition(rectArea.getCentre().roundToInt());
}
If I know I’m going to be using floats somewhere in my layout, I usually find it best to use floats from the start and to only convert to an integer at the very last step.
