From cf62a9b7224a09238edc74dfc17d59d17bcf2c5d Mon Sep 17 00:00:00 2001 From: Face <69168154+face-hh@users.noreply.github.com> Date: Wed, 10 Sep 2025 21:33:16 +0300 Subject: [PATCH] fix h-full for non-flex divs --- flumi/Scripts/B9/CSSParser.gd | 7 +++++-- flumi/Scripts/Engine/StyleManager.gd | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/flumi/Scripts/B9/CSSParser.gd b/flumi/Scripts/B9/CSSParser.gd index 7c0a2b4..ed1cd17 100644 --- a/flumi/Scripts/B9/CSSParser.gd +++ b/flumi/Scripts/B9/CSSParser.gd @@ -572,8 +572,11 @@ static func parse_utility_class_internal(rule: CSSRule, utility_name: String) -> val = val.substr(1, val.length() - 2) rule.properties["width"] = SizeUtils.parse_size(val) return - # Height, but h-full is temporarily disabled since it fucks with Yoga layout engine - if utility_name.begins_with("h-") and utility_name != "h-full": + # Height + if utility_name.begins_with("h-"): + # Skip h-full for flex containers as it conflicts with Yoga layout + if utility_name == "h-full" and rule.properties.has("display") and (rule.properties["display"] == "flex" or rule.properties["display"] == "inline-flex"): + return var val = utility_name.substr(2) if val.begins_with("[") and val.ends_with("]"): val = val.substr(1, val.length() - 2) diff --git a/flumi/Scripts/Engine/StyleManager.gd b/flumi/Scripts/Engine/StyleManager.gd index ef88718..18df48e 100644 --- a/flumi/Scripts/Engine/StyleManager.gd +++ b/flumi/Scripts/Engine/StyleManager.gd @@ -89,13 +89,18 @@ static func apply_element_styles(node: Control, element: HTMLParser.HTMLElement, if height == "100%": node.size_flags_vertical = Control.SIZE_EXPAND_FILL node.custom_minimum_size.y = 0 + if node is PanelContainer and node.get_child_count() > 0: + var vbox = node.get_child(0) + if vbox is VBoxContainer: + vbox.size_flags_vertical = Control.SIZE_EXPAND_FILL + node.set_meta("size_flags_set_by_style_manager", true) else: # For other percentages, convert to viewport-relative size var percent = float(height.replace("%", "")) / 100.0 var viewport_height = node.get_viewport().get_visible_rect().size.y if node.get_viewport() else 600 node.custom_minimum_size.y = viewport_height * percent - node.set_meta("size_flags_set_by_style_manager", true) - node.size_flags_vertical = Control.SIZE_SHRINK_BEGIN + node.set_meta("size_flags_set_by_style_manager", true) + node.size_flags_vertical = Control.SIZE_SHRINK_BEGIN else: node.custom_minimum_size.y = height node.size_flags_vertical = Control.SIZE_SHRINK_BEGIN