From c64ed958c85dd6e4aa0a2c33357bdea73bab7310 Mon Sep 17 00:00:00 2001 From: Ricardo Subtil Date: Sat, 21 Jan 2023 18:27:47 +0000 Subject: [PATCH] Fix bugs --- addons/controller_icons/ControllerIcons.gd | 2 +- addons/controller_icons/example/IconRemapper.tscn | 1 + addons/controller_icons/example/IconTest.tscn | 3 ++- addons/controller_icons/objects/TextureRect.gd | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/controller_icons/ControllerIcons.gd b/addons/controller_icons/ControllerIcons.gd index 4932390..3322a3c 100644 --- a/addons/controller_icons/ControllerIcons.gd +++ b/addons/controller_icons/ControllerIcons.gd @@ -87,7 +87,7 @@ func refresh(): # All it takes is to signal icons to refresh paths emit_signal("input_type_changed", _last_input_type) -func parse_path(path: String, input_type: int = _last_input_type) -> Texture: +func parse_path(path: String, input_type = _last_input_type) -> Texture: if typeof(input_type) == TYPE_NIL: return null var root_paths := _expand_path(path, input_type) diff --git a/addons/controller_icons/example/IconRemapper.tscn b/addons/controller_icons/example/IconRemapper.tscn index 618795a..1a59915 100644 --- a/addons/controller_icons/example/IconRemapper.tscn +++ b/addons/controller_icons/example/IconRemapper.tscn @@ -24,6 +24,7 @@ [node name="Control" type="Control"] layout_mode = 3 +anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 offset_left = 100.0 diff --git a/addons/controller_icons/example/IconTest.tscn b/addons/controller_icons/example/IconTest.tscn index 97c10e7..4c37e8f 100644 --- a/addons/controller_icons/example/IconTest.tscn +++ b/addons/controller_icons/example/IconTest.tscn @@ -18,6 +18,7 @@ grow_horizontal = 2 grow_vertical = 2 [node name="ControllerButton" type="Button" parent="."] +layout_mode = 0 offset_left = 282.0 offset_top = 44.0 offset_right = 469.0 @@ -31,7 +32,6 @@ path = "ui_left" position = Vector2(359, 229) texture = ExtResource("3") script = ExtResource("4_yv7se") -path = "ui_up" [node name="ControllerSprite3D" type="Sprite3D" parent="."] texture = ExtResource("5") @@ -40,6 +40,7 @@ path = "ui_right" [node name="ControllerTextureRect" type="TextureRect" parent="."] custom_minimum_size = Vector2(40, 40) +layout_mode = 0 offset_left = 675.0 offset_top = 106.0 offset_right = 775.0 diff --git a/addons/controller_icons/objects/TextureRect.gd b/addons/controller_icons/objects/TextureRect.gd index 6005b76..c3a5ed3 100644 --- a/addons/controller_icons/objects/TextureRect.gd +++ b/addons/controller_icons/objects/TextureRect.gd @@ -26,9 +26,9 @@ class_name ControllerTextureRect max_width = _max_width if is_inside_tree(): if max_width < 0: - ignore_texture_size = false + expand_mode = TextureRect.EXPAND_KEEP_SIZE else: - ignore_texture_size = true + expand_mode = TextureRect.EXPAND_IGNORE_SIZE custom_minimum_size.x = max_width if texture: custom_minimum_size.y = texture.get_height() * max_width / texture.get_width()