fix font color and button cascading from prev commit
This commit is contained in:
@@ -21,13 +21,21 @@ static func parse_size(val):
|
|||||||
static func apply_element_styles(node: Control, element: HTMLParser.HTMLElement, parser: HTMLParser) -> Control:
|
static func apply_element_styles(node: Control, element: HTMLParser.HTMLElement, parser: HTMLParser) -> Control:
|
||||||
var styles = parser.get_element_styles_with_inheritance(element, "", [])
|
var styles = parser.get_element_styles_with_inheritance(element, "", [])
|
||||||
var label = null
|
var label = null
|
||||||
|
var target = null
|
||||||
|
|
||||||
if not (node is FlexContainer):
|
if not (node is FlexContainer):
|
||||||
label = node if node is RichTextLabel else node.get_node_or_null("RichTextLabel")
|
target = node if node is RichTextLabel else node.get_node_or_null("RichTextLabel")
|
||||||
|
label = target
|
||||||
|
# Also check for Button nodes
|
||||||
|
if not target and node is HTMLButton:
|
||||||
|
var button_node = node.get_node_or_null("ButtonNode")
|
||||||
|
if button_node:
|
||||||
|
target = button_node
|
||||||
|
|
||||||
if label and styles.has("font-family") and styles["font-family"] not in ["sans-serif", "serif", "monospace"]:
|
# Unified font applying for label and button
|
||||||
|
if target and styles.has("font-family") and styles["font-family"] not in ["sans-serif", "serif", "monospace"]:
|
||||||
var main_node = Engine.get_main_loop().current_scene
|
var main_node = Engine.get_main_loop().current_scene
|
||||||
main_node.register_font_dependent_element(label, styles, element, parser)
|
main_node.register_font_dependent_element(target, styles, element, parser)
|
||||||
|
|
||||||
var width = null
|
var width = null
|
||||||
var height = null
|
var height = null
|
||||||
|
|||||||
Reference in New Issue
Block a user