From 44dd0649fdad7a07bed0e0f9effa021dbc42d543 Mon Sep 17 00:00:00 2001 From: attila Date: Fri, 16 Sep 2022 11:23:17 +0200 Subject: [PATCH] Grid: Fix layout for very small items Until this commit Items with a size of 1 could be rounded to bounds with a size of 0 or 2 due to floating point errors, leading to slightly too large or disappearing items. The new approach preserves the size of items. --- modules/juce_gui_basics/layout/juce_Grid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/juce_gui_basics/layout/juce_Grid.cpp b/modules/juce_gui_basics/layout/juce_Grid.cpp index aa143a3506..b012520d5f 100644 --- a/modules/juce_gui_basics/layout/juce_Grid.cpp +++ b/modules/juce_gui_basics/layout/juce_Grid.cpp @@ -1047,7 +1047,7 @@ void Grid::performLayout (Rectangle targetArea) + targetArea.toFloat().getPosition(); if (auto* c = item->associatedComponent) - c->setBounds (item->currentBounds.toNearestIntEdges()); + c->setBounds (item->currentBounds.getSmallestIntegerContainer()); } }