mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Grid: Ensure that items with absolute sizes will maintain correctly rounded dimensions
Prior to this commit all Grid calculations were carried out using floating point numbers. The dimensions of all items would then be rounded with the same function to calculate the integer dimensions used for Component layout. This resulted in layout solutions where the width or height of items with dimensions specified using the absolute Px quantity could differ from the correctly rounded value of these values. This commit ensures that the width and height of these items are always correct and their cumulative error in size is distributed among items with fractional dimensions.
This commit is contained in:
parent
73459411ba
commit
a6761f9eb8
3 changed files with 1084 additions and 898 deletions
|
|
@ -4,6 +4,35 @@ JUCE breaking changes
|
|||
develop
|
||||
=======
|
||||
|
||||
Change
|
||||
------
|
||||
The Grid layout algorithm has been slightly altered to provide more consistent
|
||||
behaviour. The new approach guarantees that dimensions specified using the
|
||||
absolute Px quantity will always be correctly rounded when applied to the
|
||||
integer dimensions of Components.
|
||||
|
||||
Possible Issues
|
||||
---------------
|
||||
Components laid out using Grid can observe a size or position change of +/- 1px
|
||||
along each dimension compared with the result of the previous algorithm.
|
||||
|
||||
Workaround
|
||||
----------
|
||||
If the Grid based graphical layout is sensitive to changes of +/- 1px, then the
|
||||
UI layout code may have to be adjusted to the new algorithm.
|
||||
|
||||
Rationale
|
||||
---------
|
||||
The old Grid layout algorithm could exhibit surprising and difficult to control
|
||||
single pixel artifacts, where an item with a specified absolute size of
|
||||
e.g. 100px could end up with a layout size of 101px. The new approach
|
||||
guarantees that such items will have a layout size exactly as specified, and
|
||||
this new behaviour is also in line with CSS behaviour in browsers. The new
|
||||
approach makes necessary corrections easier as adding 1px to the size of an
|
||||
item with absolute dimensions is guaranteed to translate into an observable 1px
|
||||
increase in the layout size.
|
||||
|
||||
|
||||
Change
|
||||
------
|
||||
The k91_4 and k90_4 VST3 layouts are now mapped to the canonical JUCE 9.1.4 and
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -216,10 +216,7 @@ public:
|
|||
|
||||
private:
|
||||
//==============================================================================
|
||||
struct SizeCalculation;
|
||||
struct PlacementHelpers;
|
||||
struct AutoPlacement;
|
||||
struct BoxAlignment;
|
||||
struct Helpers;
|
||||
};
|
||||
|
||||
constexpr Grid::Px operator"" _px (long double px) { return Grid::Px { px }; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue