fix rich tooltip showing with empty action texts
This commit is contained in:
@@ -102,11 +102,11 @@ func set_target_object(target: Object, needs_second_target: bool = false) -> voi
|
|||||||
current_target_object = target
|
current_target_object = target
|
||||||
waiting_for_target2 = needs_second_target
|
waiting_for_target2 = needs_second_target
|
||||||
if _room_is_ready:
|
if _room_is_ready:
|
||||||
update_tooltip_text()
|
|
||||||
if(target == null):
|
if(target == null):
|
||||||
hide()
|
hide()
|
||||||
return
|
return
|
||||||
show()
|
# show()
|
||||||
|
update_tooltip_text()
|
||||||
|
|
||||||
|
|
||||||
# Set the first target of the label.
|
# Set the first target of the label.
|
||||||
@@ -118,11 +118,11 @@ func set_target(target: String, needs_second_target: bool = false) -> void:
|
|||||||
current_target = target
|
current_target = target
|
||||||
waiting_for_target2 = needs_second_target
|
waiting_for_target2 = needs_second_target
|
||||||
if _room_is_ready:
|
if _room_is_ready:
|
||||||
update_tooltip_text()
|
|
||||||
if(target == ""):
|
if(target == ""):
|
||||||
hide()
|
hide()
|
||||||
return
|
return
|
||||||
show()
|
update_tooltip_text()
|
||||||
|
# show()
|
||||||
|
|
||||||
|
|
||||||
# Set the second target of the label
|
# Set the second target of the label
|
||||||
@@ -132,26 +132,22 @@ func set_target(target: String, needs_second_target: bool = false) -> void:
|
|||||||
func set_target2(target2: String) -> void:
|
func set_target2(target2: String) -> void:
|
||||||
current_target2 = target2
|
current_target2 = target2
|
||||||
if _room_is_ready:
|
if _room_is_ready:
|
||||||
update_tooltip_text()
|
|
||||||
if(target2 == ""):
|
if(target2 == ""):
|
||||||
hide()
|
hide()
|
||||||
return
|
return
|
||||||
show()
|
update_tooltip_text()
|
||||||
|
# show()
|
||||||
|
|
||||||
|
|
||||||
# Update the tooltip text.
|
# Update the tooltip text.
|
||||||
func update_tooltip_text():
|
func update_tooltip_text():
|
||||||
if(current_target_object == null):
|
if(current_target_object == null):
|
||||||
return
|
return
|
||||||
hide()
|
|
||||||
if(current_target_object.action1_text != ""):
|
$tooltip1.visible = current_target_object.action1_text != "";
|
||||||
$tooltip1.visible = true;
|
|
||||||
|
|
||||||
$tooltip1/label.text = current_target_object.action1_text
|
$tooltip1/label.text = current_target_object.action1_text
|
||||||
|
|
||||||
if(current_target_object.action2_text != ""):
|
$tooltip2.visible = current_target_object.action2_text != "";
|
||||||
$tooltip2.visible = true;
|
|
||||||
|
|
||||||
$tooltip2/label.text = current_target_object.action2_text
|
$tooltip2/label.text = current_target_object.action2_text
|
||||||
|
|
||||||
|
|
||||||
@@ -167,7 +163,7 @@ func get_tooltip1_size():
|
|||||||
if not get_tree():
|
if not get_tree():
|
||||||
# We're not in the tree anymore. Return
|
# We're not in the tree anymore. Return
|
||||||
return
|
return
|
||||||
escoria.logger.info(self, "get_string_size: " + String($tooltip1/label.get_font("normal_font").get_string_size(current_target)))
|
# escoria.logger.info(self, "get_string_size: " + String($tooltip1/label.get_font("normal_font").get_string_size(current_target)))
|
||||||
return $tooltip1/label.get_font("normal_font").get_string_size(current_target)
|
return $tooltip1/label.get_font("normal_font").get_string_size(current_target)
|
||||||
|
|
||||||
func get_tooltip2_size():
|
func get_tooltip2_size():
|
||||||
@@ -237,9 +233,10 @@ func tooltip_distance_to_edge_right(position: Vector2):
|
|||||||
return escoria.game_size.x - position.x
|
return escoria.game_size.x - position.x
|
||||||
|
|
||||||
func show():
|
func show():
|
||||||
if _room_is_ready:
|
escoria.logger.info(self, "show")
|
||||||
$tooltip1.visible = true;
|
# if _room_is_ready:
|
||||||
$tooltip2.visible = true;
|
# $tooltip1.visible = true;
|
||||||
|
# $tooltip2.visible = true;
|
||||||
#$icon.visible = true;
|
#$icon.visible = true;
|
||||||
#$label.visible = true;
|
#$label.visible = true;
|
||||||
#$background.visible = true;
|
#$background.visible = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user