mirror of
https://github.com/nicbarker/clay.git
synced 2025-01-23 01:46:02 +00:00
Add an epsilon to compression comparison to prevent degenerate loop
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Waiting to run
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Failing after 13s
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Failing after 12s
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Waiting to run
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Failing after 13s
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Failing after 12s
This commit is contained in:
parent
bc9ef8b02d
commit
44fb89c8b6
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4
clay.h
4
clay.h
@ -2088,13 +2088,13 @@ void Clay__CompressChildrenAlongAxis(bool xAxis, float totalSizeToDistribute, Cl
|
|||||||
Clay__int32_tArray largestContainers = context->openClipElementStack;
|
Clay__int32_tArray largestContainers = context->openClipElementStack;
|
||||||
largestContainers.length = 0;
|
largestContainers.length = 0;
|
||||||
|
|
||||||
while (totalSizeToDistribute > 0) {
|
while (totalSizeToDistribute > 0.1) {
|
||||||
float largestSize = 0;
|
float largestSize = 0;
|
||||||
float targetSize = 0;
|
float targetSize = 0;
|
||||||
for (int32_t i = 0; i < resizableContainerBuffer.length; ++i) {
|
for (int32_t i = 0; i < resizableContainerBuffer.length; ++i) {
|
||||||
Clay_LayoutElement *childElement = Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_Get(&resizableContainerBuffer, i));
|
Clay_LayoutElement *childElement = Clay_LayoutElementArray_Get(&context->layoutElements, Clay__int32_tArray_Get(&resizableContainerBuffer, i));
|
||||||
float childSize = xAxis ? childElement->dimensions.width : childElement->dimensions.height;
|
float childSize = xAxis ? childElement->dimensions.width : childElement->dimensions.height;
|
||||||
if (childSize == largestSize) {
|
if ((childSize - largestSize) < 0.1 && (childSize - largestSize) > -0.1) {
|
||||||
Clay__int32_tArray_Add(&largestContainers, Clay__int32_tArray_Get(&resizableContainerBuffer, i));
|
Clay__int32_tArray_Add(&largestContainers, Clay__int32_tArray_Get(&resizableContainerBuffer, i));
|
||||||
} else if (childSize > largestSize) {
|
} else if (childSize > largestSize) {
|
||||||
targetSize = largestSize;
|
targetSize = largestSize;
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user