fix flex size, fix hover

This commit is contained in:
Face
2025-09-06 12:30:48 +03:00
parent f007246b2a
commit 6f70032aab
6 changed files with 49 additions and 13 deletions

View File

@@ -121,7 +121,7 @@
<button id="create-invite-btn" style="warning-btn">Generate Invite Code</button>
</div>
<div style="flex flex-col gap-4 mx-auto">
<h3>Redeem Invite</h3>
<h3 style="text-center">Redeem Invite</h3>
<div style="flex gap-2">
<input id="invite-code-input" type="text" style="form-input" placeholder="Enter invite code" />
<button id="redeem-invite-btn" style="primary-btn">Redeem</button>

View File

@@ -9,7 +9,7 @@
[ext_resource type="PackedScene" uid="uid://sqhcxhcre081" path="res://Scenes/Tab.tscn" id="4_344ge"]
[ext_resource type="Texture2D" uid="uid://cu4hjoba6etf" path="res://Assets/Icons/rotate-cw.svg" id="5_344ge"]
[ext_resource type="Texture2D" uid="uid://cehbtwq6gq0cn" path="res://Assets/Icons/plus.svg" id="5_ynf5e"]
[ext_resource type="Script" uid="uid://nve723radqih" path="res://Scripts/SearchBar.gd" id="9_gt3je"]
[ext_resource type="Script" path="res://Scripts/SearchBar.gd" id="9_gt3je"]
[ext_resource type="Texture2D" uid="uid://cklatjc4m38dy" path="res://Assets/Icons/ellipsis-vertical.svg" id="10_6iyac"]
[ext_resource type="Theme" uid="uid://bn6rbmdy60lhr" path="res://Scenes/Styles/BrowserText.tres" id="11_ee4r6"]
[ext_resource type="Script" uid="uid://vjjhljlftlbk" path="res://Scripts/OptionButton.gd" id="11_gt3je"]

View File

@@ -159,11 +159,20 @@ func _resort() -> void:
_draw_debug_rect(Rect2(offset, rect_size), Color(1, 0, 0, 0.8))
# Update background panel if needed
BackgroundUtils.update_background_panel(self)
if not _is_inside_background_container():
BackgroundUtils.update_background_panel(self)
emit_signal("flex_resized")
func _is_inside_background_container() -> bool:
var current_parent = get_parent()
while current_parent:
if current_parent is PanelContainer:
if current_parent.has_meta("hover_stylebox") or current_parent.has_meta("normal_stylebox"):
return true
current_parent = current_parent.get_parent()
return false
func calculate_available_dimension(is_width: bool) -> float:
var percentage_key = "custom_css_width_percentage" if is_width else "custom_css_height_percentage"
var fill_key = "should_fill_horizontal" if is_width else "should_fill_vertical"
@@ -196,7 +205,7 @@ func calculate_custom_dimension(is_width: bool) -> float:
else:
return 0.0
elif has_meta(fill_key):
return get_parent_or_fallback_size(is_width)
return 0.0
else:
return 0.0

View File

@@ -32,7 +32,7 @@ static func fetch_cert_via_http(url: String) -> String:
static func initialize():
load_builtin_ca()
print("📋 Certificate Manager initialized with ", trusted_ca_certificates.size(), " trusted CAs")
print("Certificate Manager initialized with ", trusted_ca_certificates.size(), " trusted CAs")
static func load_builtin_ca():
var ca_file = FileAccess.open("res://Assets/gurted-ca.crt", FileAccess.READ)
@@ -42,8 +42,8 @@ static func load_builtin_ca():
if not ca_cert_pem.is_empty():
trusted_ca_certificates.append(ca_cert_pem)
print("Loaded built-in GURT CA certificate")
print("Loaded built-in GURT CA certificate")
else:
print("⚠️ Built-in CA certificate not yet configured")
print("Built-in CA certificate not yet configured")
else:
print("Could not load built-in CA certificate")
print("Could not load built-in CA certificate")

View File

@@ -325,15 +325,31 @@ static func apply_margin_wrapper(node: Control, styles: Dictionary) -> Control:
margin_container.name = "MarginWrapper_" + node.name
margin_container.set_meta("is_margin_wrapper", true)
var needs_fill = false
if node.has_meta("should_fill_horizontal"):
needs_fill = true
if node.get_child_count() > 0:
var vbox = node.get_child(0)
if vbox is VBoxContainer and vbox.get_child_count() > 0:
var flex_child = vbox.get_child(0)
if flex_child and flex_child.has_meta("should_fill_horizontal"):
needs_fill = true
if needs_fill:
margin_container.size_flags_horizontal = Control.SIZE_EXPAND_FILL
var has_explicit_width = styles.has("width")
var has_explicit_height = styles.has("height")
if has_explicit_width:
margin_container.size_flags_horizontal = node.size_flags_horizontal
else:
if has_explicit_width and not needs_fill:
margin_container.size_flags_horizontal = node.size_flags_horizontal
elif not needs_fill:
margin_container.size_flags_horizontal = node.size_flags_horizontal
node.size_flags_horizontal = Control.SIZE_EXPAND_FILL
if has_explicit_height:
margin_container.size_flags_vertical = node.size_flags_vertical
else:

View File

@@ -366,6 +366,7 @@ func render_content(html_bytes: PackedByteArray) -> void:
# ul/ol handle their own adding
if element.tag_name != "ul" and element.tag_name != "ol":
safe_add_child(target_container, element_node)
if contains_hyperlink(element):
if element_node is RichTextLabel:
@@ -456,16 +457,21 @@ func create_element_node(element: HTMLParser.HTMLElement, parser: HTMLParser, co
if element.tag_name == "div":
if BackgroundUtils.needs_background_wrapper(styles) or BackgroundUtils.needs_background_wrapper(hover_styles):
final_node = BackgroundUtils.create_panel_container_with_background(styles, hover_styles)
var flex_container = AUTO_SIZING_FLEX_CONTAINER.new()
flex_container.name = "Flex_" + element.tag_name
var vbox = final_node.get_child(0) as VBoxContainer
vbox.add_child(flex_container)
container_for_children = flex_container
FlexUtils.apply_flex_container_properties(flex_container, styles)
if flex_container.has_meta("should_fill_horizontal"):
final_node.set_meta("needs_size_expand_fill", true)
else:
final_node = AUTO_SIZING_FLEX_CONTAINER.new()
final_node.name = "Flex_" + element.tag_name
container_for_children = final_node
FlexUtils.apply_flex_container_properties(final_node, styles)
else:
final_node = AUTO_SIZING_FLEX_CONTAINER.new()
@@ -512,6 +518,11 @@ func create_element_node(element: HTMLParser.HTMLElement, parser: HTMLParser, co
# Applies background, size, etc. to the FlexContainer (top-level node)
final_node = StyleManager.apply_element_styles(final_node, element, parser)
if final_node and final_node.has_meta("needs_size_expand_fill"):
final_node.size_flags_horizontal = Control.SIZE_EXPAND_FILL
if final_node.get_child_count() > 0:
var vbox = final_node.get_child(0)
vbox.size_flags_horizontal = Control.SIZE_EXPAND_FILL
if is_grid_container:
var grid_container_node = final_node