tooltips fix
This commit is contained in:
@@ -21,9 +21,9 @@ const ONE_LINE_HEIGHT = 16
|
||||
export(Color) var color setget set_color
|
||||
|
||||
# Vector2 defining the offset from the cursor
|
||||
export(Vector2) var offset_from_cursor_action1 = Vector2(5,5)
|
||||
export(Vector2) var offset_from_cursor_action1 = Vector2(0,3)
|
||||
|
||||
export(Vector2) var offset_from_cursor_action2 = Vector2(5,-5)
|
||||
export(Vector2) var offset_from_cursor_action2 = Vector2(0,-2)
|
||||
|
||||
# Activates debug mode. If enabled, shows the label with a white background.
|
||||
export(bool) var debug_mode = false setget set_debug_mode
|
||||
@@ -180,14 +180,16 @@ func get_tooltip1_size():
|
||||
if not get_tree():
|
||||
# We're not in the tree anymore. Return
|
||||
return
|
||||
return Vector2(150,20);
|
||||
# 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():
|
||||
if not get_tree():
|
||||
# We're not in the tree anymore. Return
|
||||
return
|
||||
return $tooltip2/label.get_font("normal_font").get_string_size(current_target)
|
||||
return Vector2(150,20);
|
||||
#return $tooltip2/label.get_font("normal_font").get_string_size(current_target)
|
||||
|
||||
# Calculate the offset of the label depending on its position.
|
||||
#
|
||||
@@ -197,11 +199,11 @@ func get_tooltip2_size():
|
||||
# **Return**
|
||||
# The calculated offset
|
||||
func _offset(position: Vector2) -> Vector2:
|
||||
var center_offset_x = current_size.x / 2
|
||||
var offset_y = 5
|
||||
#var center_offset_x = current_size.x / 2
|
||||
#var offset_y = 5
|
||||
|
||||
position.x -= center_offset_x
|
||||
position.y += offset_y
|
||||
#position.x -= center_offset_x
|
||||
#position.y += offset_y
|
||||
|
||||
return position
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/theme.tres" type="Theme" id=4]
|
||||
|
||||
[node name="tooltipManager" type="Node2D"]
|
||||
position = Vector2( -1, -10 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="tooltip1" type="Node2D" parent="."]
|
||||
|
||||
@@ -122,11 +122,13 @@ func _exit_tree():
|
||||
func _input(event: InputEvent) -> void:
|
||||
if escoria.get_escoria().is_ready_for_inputs():
|
||||
if event is InputEventMouseMotion:
|
||||
_current_mouse_pos = get_global_mouse_position()
|
||||
#_current_mouse_pos = get_global_mouse_position()
|
||||
_current_mouse_pos = get_viewport().get_mouse_position()
|
||||
update_tooltip_following_mouse_position(tooltip_node)
|
||||
update_tooltip_following_mouse_position(tooltip2_node)
|
||||
|
||||
|
||||
|
||||
# https://github.com/godotengine/godot-demo-projects/blob/3.4-585455e/misc/joypads/joypads.gd
|
||||
# was informative in wiring up the gamepad properly.
|
||||
|
||||
@@ -385,6 +387,7 @@ func set_tooltip_position(nodeId: String, tooltip: ESCRichTooltip, size: Vector2
|
||||
var mouse_position = calculateMousePosition(size)
|
||||
var corrected_position = correctPosition(tooltip, size, mouse_position, offset)
|
||||
tooltip.get_node(nodeId).position = corrected_position
|
||||
#tooltip.get_node(nodeId).position = mouse_position
|
||||
|
||||
|
||||
func calculateMousePosition(size: Vector2):
|
||||
@@ -392,7 +395,8 @@ func calculateMousePosition(size: Vector2):
|
||||
size.y / 2
|
||||
#escoria.logger.info(self, "_current_mouse_pos" + String(_current_mouse_pos.x) + " gameSize: " + escoria.game_size.x)
|
||||
|
||||
return _current_mouse_pos - size
|
||||
#return _current_mouse_pos - size
|
||||
return _current_mouse_pos
|
||||
|
||||
func correctPosition(tooltip: ESCRichTooltip, size: Vector2, mouse_position: Vector2, offset: Vector2):
|
||||
|
||||
|
||||
@@ -82,18 +82,18 @@ layer = 2
|
||||
mouse_filter = 2
|
||||
bbcode_text = "[center][color=#000000][/color][/center]"
|
||||
fit_content_height = true
|
||||
offset_from_cursor = Vector2( -5, -50 )
|
||||
offset_from_cursor = Vector2( 0, 20 )
|
||||
|
||||
[node name="tooltip2" parent="tooltip_layer" instance=ExtResource( 10 )]
|
||||
mouse_filter = 2
|
||||
bbcode_text = "[center][color=#000000][/color][/center]"
|
||||
fit_content_height = true
|
||||
offset_from_cursor = Vector2( -5, 50 )
|
||||
offset_from_cursor = Vector2( 0, -10 )
|
||||
|
||||
[node name="tooltip" parent="tooltip_layer" instance=ExtResource( 4 )]
|
||||
z_index = 10
|
||||
color = Color( 1, 1, 1, 1 )
|
||||
offset_from_cursor_action1 = Vector2( 0, 50 )
|
||||
offset_from_cursor_action2 = Vector2( 0, -50 )
|
||||
offset_from_cursor_action1 = Vector2( 0, 30 )
|
||||
offset_from_cursor_action2 = Vector2( 0, -20 )
|
||||
|
||||
[connection signal="pressed" from="CanvasLayer/ui/HBoxContainer/VBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
|
||||
|
||||
BIN
gymkhana/rooms/turno_cocina/despensa/assets/Background.xcf
Normal file
BIN
gymkhana/rooms/turno_cocina/despensa/assets/Background.xcf
Normal file
Binary file not shown.
@@ -204,7 +204,7 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_options_chooser.gd"
|
||||
}, {
|
||||
"base": "StateMachine",
|
||||
"base": "Node",
|
||||
"class": "ESCDialogPlayer",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/escoria-core/game/scenes/dialogs/esc_dialog_player.gd"
|
||||
@@ -344,7 +344,7 @@ _global_script_classes=[ {
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/escoria-core/game/esc_project_settings_manager.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"base": "Node",
|
||||
"class": "ESCResourceCache",
|
||||
"language": "GDScript",
|
||||
"path": "res://addons/escoria-core/game/core-scripts/esc_resource_cache.gd"
|
||||
|
||||
Reference in New Issue
Block a user