From fccfdfce3664f4568bd6eebeb16190646ec417c9 Mon Sep 17 00:00:00 2001 From: Nic Barker Date: Mon, 23 Jun 2025 10:56:46 +1000 Subject: [PATCH] [Core] Fix culling for scissor commands outside the window --- clay.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clay.h b/clay.h index 0d5b69f..991c2ec 100644 --- a/clay.h +++ b/clay.h @@ -2685,7 +2685,7 @@ void Clay__CalculateFinalLayout(void) { } if (root->clipElementId) { Clay_LayoutElementHashMapItem *clipHashMapItem = Clay__GetHashMapItem(root->clipElementId); - if (clipHashMapItem) { + if (clipHashMapItem && !Clay__ElementIsOffscreen(&clipHashMapItem->boundingBox)) { // Floating elements that are attached to scrolling contents won't be correctly positioned if external scroll handling is enabled, fix here if (context->externalScrollHandlingEnabled) { Clay_ClipElementConfig *clipConfig = Clay__FindElementConfigWithType(clipHashMapItem->layoutElement, CLAY__ELEMENT_CONFIG_TYPE_CLIP).clipElementConfig; @@ -2957,7 +2957,8 @@ void Clay__CalculateFinalLayout(void) { bool closeClipElement = false; Clay_ClipElementConfig *clipConfig = Clay__FindElementConfigWithType(currentElement, CLAY__ELEMENT_CONFIG_TYPE_CLIP).clipElementConfig; if (clipConfig) { - closeClipElement = true; + Clay_LayoutElementHashMapItem *currentElementData = Clay__GetHashMapItem(currentElement->id); + closeClipElement = !Clay__ElementIsOffscreen(¤tElementData->boundingBox); for (int32_t i = 0; i < context->scrollContainerDatas.length; i++) { Clay__ScrollContainerDataInternal *mapping = Clay__ScrollContainerDataInternalArray_Get(&context->scrollContainerDatas, i); if (mapping->layoutElement == currentElement) {