summaryrefslogtreecommitdiff
path: root/addons/escoria-ui-simplemouse/tooltip
diff options
context:
space:
mode:
Diffstat (limited to 'addons/escoria-ui-simplemouse/tooltip')
-rw-r--r--addons/escoria-ui-simplemouse/tooltip/target_tooltip.tscn11
-rw-r--r--addons/escoria-ui-simplemouse/tooltip/tooltip_target.gd28
-rw-r--r--addons/escoria-ui-simplemouse/tooltip/tooltip_target.gd.uid1
3 files changed, 40 insertions, 0 deletions
diff --git a/addons/escoria-ui-simplemouse/tooltip/target_tooltip.tscn b/addons/escoria-ui-simplemouse/tooltip/target_tooltip.tscn
new file mode 100644
index 0000000..9430ef1
--- /dev/null
+++ b/addons/escoria-ui-simplemouse/tooltip/target_tooltip.tscn
@@ -0,0 +1,11 @@
+[gd_scene load_steps=2 format=3 uid="uid://b3hru28v8y36i"]
+
+[ext_resource type="Script" uid="uid://cytpwmod6bdw6" path="res://addons/escoria-ui-simplemouse/tooltip/tooltip_target.gd" id="2"]
+
+[node name="tooltip" type="RichTextLabel"]
+bbcode_enabled = true
+text = "[center][color=#ffffff][/color][/center]"
+scroll_active = false
+script = ExtResource("2")
+color = Color(1, 1, 1, 1)
+offset_from_cursor = Vector2(0, 0)
diff --git a/addons/escoria-ui-simplemouse/tooltip/tooltip_target.gd b/addons/escoria-ui-simplemouse/tooltip/tooltip_target.gd
new file mode 100644
index 0000000..c975b30
--- /dev/null
+++ b/addons/escoria-ui-simplemouse/tooltip/tooltip_target.gd
@@ -0,0 +1,28 @@
+extends ESCTooltip
+
+
+signal tooltip_size_updated
+
+
+func update_tooltip_text():
+ # Need to update size of bbcode rect before updating the text itself otherwise on the
+ # first frame the text is wider than the default of 0 and ends up being really tall
+ # and setting the wrong vertical margin for the tooltip
+ update_size()
+
+ # We signal this here since the processing in this class happens AFTER input
+ # processing. We signal here to avoid "lagging" behind a frame since
+ # tooltips are presently dependent on the size of the bounding box around
+ # the rendered string.
+ tooltip_size_updated.emit()
+
+ text = "[center]"
+ text += "[color=#" + color.to_html(false) + "]"
+ text += current_target
+ text += "[/color]"
+ text += "[/center]"
+# push_align(RichTextLabel.ALIGN_CENTER)
+# push_color(color)
+# append_bbcode(current_target)
+# pop()
+# pop()
diff --git a/addons/escoria-ui-simplemouse/tooltip/tooltip_target.gd.uid b/addons/escoria-ui-simplemouse/tooltip/tooltip_target.gd.uid
new file mode 100644
index 0000000..a2c3b02
--- /dev/null
+++ b/addons/escoria-ui-simplemouse/tooltip/tooltip_target.gd.uid
@@ -0,0 +1 @@
+uid://cytpwmod6bdw6