mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-03 16:16:18 +00:00 
			
		
		
		
	[Core] Fix a bug with the implementation of clip .childOffset
This commit is contained in:
		
							parent
							
								
									ea8288158e
								
							
						
					
					
						commit
						90b45f059c
					
				
							
								
								
									
										10
									
								
								clay.h
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								clay.h
									
									
									
									
									
								
							| 
						 | 
					@ -2690,12 +2690,7 @@ void Clay__CalculateFinalLayout(void) {
 | 
				
			||||||
                        if (mapping->layoutElement == currentElement) {
 | 
					                        if (mapping->layoutElement == currentElement) {
 | 
				
			||||||
                            scrollContainerData = mapping;
 | 
					                            scrollContainerData = mapping;
 | 
				
			||||||
                            mapping->boundingBox = currentElementBoundingBox;
 | 
					                            mapping->boundingBox = currentElementBoundingBox;
 | 
				
			||||||
                            if (clipConfig->horizontal) {
 | 
					                            scrollOffset = clipConfig->childOffset;
 | 
				
			||||||
                                scrollOffset.x = mapping->scrollPosition.x;
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                            if (clipConfig->vertical) {
 | 
					 | 
				
			||||||
                                scrollOffset.y = mapping->scrollPosition.y;
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                            if (context->externalScrollHandlingEnabled) {
 | 
					                            if (context->externalScrollHandlingEnabled) {
 | 
				
			||||||
                                scrollOffset = CLAY__INIT(Clay_Vector2) CLAY__DEFAULT_STRUCT;
 | 
					                                scrollOffset = CLAY__INIT(Clay_Vector2) CLAY__DEFAULT_STRUCT;
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
| 
						 | 
					@ -2917,8 +2912,7 @@ void Clay__CalculateFinalLayout(void) {
 | 
				
			||||||
                    for (int32_t i = 0; i < context->scrollContainerDatas.length; i++) {
 | 
					                    for (int32_t i = 0; i < context->scrollContainerDatas.length; i++) {
 | 
				
			||||||
                        Clay__ScrollContainerDataInternal *mapping = Clay__ScrollContainerDataInternalArray_Get(&context->scrollContainerDatas, i);
 | 
					                        Clay__ScrollContainerDataInternal *mapping = Clay__ScrollContainerDataInternalArray_Get(&context->scrollContainerDatas, i);
 | 
				
			||||||
                        if (mapping->layoutElement == currentElement) {
 | 
					                        if (mapping->layoutElement == currentElement) {
 | 
				
			||||||
                            if (clipConfig->horizontal) { scrollOffset.x = mapping->scrollPosition.x; }
 | 
					                            scrollOffset = clipConfig->childOffset;
 | 
				
			||||||
                            if (clipConfig->vertical) { scrollOffset.y = mapping->scrollPosition.y; }
 | 
					 | 
				
			||||||
                            if (context->externalScrollHandlingEnabled) {
 | 
					                            if (context->externalScrollHandlingEnabled) {
 | 
				
			||||||
                                scrollOffset = CLAY__INIT(Clay_Vector2) CLAY__DEFAULT_STRUCT;
 | 
					                                scrollOffset = CLAY__INIT(Clay_Vector2) CLAY__DEFAULT_STRUCT;
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -127,7 +127,7 @@ Clay_RenderCommandArray CreateLayout(void) {
 | 
				
			||||||
                    .attachTo = CLAY_ATTACH_TO_ELEMENT_WITH_ID,
 | 
					                    .attachTo = CLAY_ATTACH_TO_ELEMENT_WITH_ID,
 | 
				
			||||||
                    .offset = { .y = -(scrollData.scrollPosition->y / scrollData.contentDimensions.height) * scrollData.scrollContainerDimensions.height },
 | 
					                    .offset = { .y = -(scrollData.scrollPosition->y / scrollData.contentDimensions.height) * scrollData.scrollContainerDimensions.height },
 | 
				
			||||||
                    .zIndex = 1,
 | 
					                    .zIndex = 1,
 | 
				
			||||||
                    .parentId = 55,
 | 
					                    .parentId = Clay_GetElementId(CLAY_STRING("MainContent")).id,
 | 
				
			||||||
                    .attachPoints = { .element = CLAY_ATTACH_POINT_RIGHT_TOP, .parent = CLAY_ATTACH_POINT_RIGHT_TOP }
 | 
					                    .attachPoints = { .element = CLAY_ATTACH_POINT_RIGHT_TOP, .parent = CLAY_ATTACH_POINT_RIGHT_TOP }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }) {
 | 
					            }) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue