mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-03 16:16:18 +00:00 
			
		
		
		
	Add an epsilon to compression comparison to prevent degenerate loop
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 a new issue