Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor quirks in attribute fields #923

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui_parts/handles_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ handles_array: Array[Handle], handle_texture_array: Dictionary) -> void:
for idx in multiline.size():
multiline[idx] *= draw_zoom
var color_array := PackedColorArray()
color_array.resize(multiline.size() / 2)
color_array.resize(int(multiline.size() / 2.0))
color_array.fill(Color(color, TANGENT_ALPHA))
RenderingServer.canvas_item_add_multiline(surface, multiline,
color_array, TANGENT_WIDTH, true)
Expand Down
5 changes: 4 additions & 1 deletion src/ui_widgets/LineEditButton.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ var temp_button: Button

@export var text: String:
set(new_value):
# No equivalence check because of a certain potential situation.
# No early equivalence check because of a certain potential situation.
# For example, if you start with empty text and enter a value, but it's dismissed,
# the text would revert back to empty. There should be an update in that case.
var old_value := text
text = new_value
if active:
temp_line_edit.text = new_value
else:
queue_redraw()
if text != old_value:
text_changed.emit(text)

@export var font_color := Color.TRANSPARENT:
set(new_value):
Expand Down
8 changes: 4 additions & 4 deletions src/ui_widgets/color_field.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func _ready() -> void:
element.ancestor_attribute_changed.connect(_on_element_ancestor_attribute_changed)
text_submitted.connect(set_value.bind(true))
focus_entered.connect(reset_font_color)
text_changed.connect(_on_text_changed)
text_change_canceled.connect(sync_to_attribute)
pressed.connect(_on_pressed)
button_gui_input.connect(_on_button_gui_input)
# If URL is allowed, we need to always check if the gradient has changed.
if cached_allow_url:
SVG.changed.connect(_on_svg_changed)
Expand Down Expand Up @@ -123,10 +127,6 @@ func _draw() -> void:
draw_button_border("normal")


func _on_text_change_canceled() -> void:
sync(element.get_attribute_value(attribute_name, true))


func _on_color_picked(new_color: String, close_picker: bool) -> void:
set_value(new_color, close_picker)
if close_picker:
Expand Down
5 changes: 0 additions & 5 deletions src/ui_widgets/color_field.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ offset_right = 68.0
script = ExtResource("1_2pe1j")
button_visuals = false
mono_font_tooltip = true

[connection signal="button_gui_input" from="." to="." method="_on_button_gui_input"]
[connection signal="pressed" from="." to="." method="_on_pressed"]
[connection signal="text_change_canceled" from="." to="." method="_on_text_change_canceled"]
[connection signal="text_changed" from="." to="." method="_on_text_changed"]