Skip to content

Commit

Permalink
Fixes to some regressions (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
MewPurPur authored May 29, 2024
1 parent 684793c commit d3a3a77
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
5 changes: 3 additions & 2 deletions src/ui_elements/pathdata_field.gd
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ func sync(new_value: String) -> void:
add_move_button.pressed.connect(add_move_button.queue_free)
# Rebuild the path commands.
commands_container.custom_minimum_size.y = cmd_count * COMMAND_HEIGHT
activate_hovered(-1)
if hovered_idx >= attribute.get_command_count():
activate_hovered(-1)
var mm := InputEventMouseMotion.new()
mm.position = get_viewport().get_mouse_position()
Input.parse_input_event(mm)
Expand Down Expand Up @@ -435,7 +436,7 @@ func setup_path_command_controls(idx: int) -> Control:
field.tooltip_text = property_name
field.value_changed.connect(update_value.bind(property_name, idx))
field.focus_entered.connect(activate_focused.bind(idx))
field.focus_exited.connect(check_focused)
field.focus_exited.connect(check_focused, CONNECT_DEFERRED)
container.add_child(field)
field.position.y = 2
fields[0].position.x = 25
Expand Down
32 changes: 19 additions & 13 deletions src/ui_parts/tag_frame.gd
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,25 @@ func _gui_input(event: InputEvent) -> void:
HandlerGUI.popup_under_pos.bind(popup_pos, viewport), Indications.SelectionContext.TAG_EDITOR), popup_pos, viewport)
accept_event()

func _on_mouse_entered() -> void:
var tag_icon_size: Vector2 = tag.icon.get_size()
var half_bar_width := title_bar.size.x / 2
var title_width := code_font.get_string_size(tag.name,
HORIZONTAL_ALIGNMENT_LEFT, 180, 12).x
# Add button.
var title_button := Button.new()
title_button.focus_mode = Control.FOCUS_NONE
title_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
title_button.mouse_filter = Control.MOUSE_FILTER_PASS
title_button.theme_type_variation = "FlatButton"
title_button.position = title_bar.position +\
Vector2(half_bar_width - title_width / 2 - tag_icon_size.x - 2, 3)
title_button.size = Vector2(title_width + 28, 20)
title_bar.add_child(title_button)
title_button.gui_input.connect(_on_title_button_gui_input.bind(title_button))
title_button.pressed.connect(_on_title_button_pressed)
mouse_exited.connect(title_button.queue_free)

func _on_mouse_exited() -> void:
Indications.remove_hovered(tid)
determine_selection_highlight()
Expand Down Expand Up @@ -222,7 +241,6 @@ func _draw() -> void:
drop_sb.draw(surface, Rect2(Vector2.ZERO, get_size()))

func _on_title_bar_draw() -> void:
# Decorate the title bar.
var tag_icon_size: Vector2 = tag.icon.get_size()
var half_bar_width := title_bar.size.x / 2
var title_width := code_font.get_string_size(tag.name,
Expand All @@ -231,18 +249,6 @@ func _on_title_bar_draw() -> void:
tag.name, HORIZONTAL_ALIGNMENT_LEFT, 180, 12)
tag.icon.draw_rect(title_bar_ci, Rect2(Vector2(half_bar_width - title_width / 2 -\
tag_icon_size.x, 4).round(), tag_icon_size), false)
# Add the button.
var title_button := Button.new()
title_button.focus_mode = Control.FOCUS_NONE
title_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
title_button.mouse_filter = Control.MOUSE_FILTER_PASS
title_button.theme_type_variation = "FlatButton"
title_button.position = title_bar.position +\
Vector2(half_bar_width - title_width / 2 - tag_icon_size.x - 2, 3)
title_button.size = Vector2(title_width + 28, 20)
title_bar.add_child(title_button)
title_button.gui_input.connect(_on_title_button_gui_input.bind(title_button))
title_button.pressed.connect(_on_title_button_pressed)

# Block dragging from starting when pressing the title button.
func _on_title_button_gui_input(event: InputEvent, title_button: Button) -> void:
Expand Down
1 change: 1 addition & 0 deletions src/ui_parts/tag_frame.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 8

[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
[connection signal="draw" from="TitleBar" to="." method="_on_title_bar_draw"]
2 changes: 1 addition & 1 deletion visual/icons/foreign_logos/PatreonLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d3a3a77

Please sign in to comment.