From f37a8cb6eea74a134f06e936ee6e3d23bb2c635d Mon Sep 17 00:00:00 2001 From: rainlizard <15337628+rainlizard@users.noreply.github.com> Date: Wed, 1 May 2024 12:11:26 +1000 Subject: [PATCH] fixed button img --- Scenes/GenericGridItem.gd | 15 +++++++++------ Scenes/PickSlabWindow.gd | 1 - 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Scenes/GenericGridItem.gd b/Scenes/GenericGridItem.gd index c5331446..c5b01863 100644 --- a/Scenes/GenericGridItem.gd +++ b/Scenes/GenericGridItem.gd @@ -33,12 +33,15 @@ func _on_GenericGridItem_mouse_exited(): func _on_GenericGridItem_gui_input(event): if event is InputEventMouseButton: - if event.pressed and event.button_index == BUTTON_LEFT: - if img_pressed: - $TextureRect.texture = img_pressed - emit_signal("pressed") - else: - $TextureRect.texture = img_normal + if event.button_index == BUTTON_LEFT: + if event.pressed == true: + if img_pressed: + $TextureRect.texture = img_pressed + emit_signal("pressed") + for i in 20: + yield(get_tree(),'idle_frame') + _on_GenericGridItem_mouse_exited() + func set_image_normal(setVal): $TextureRect.texture = setVal diff --git a/Scenes/PickSlabWindow.gd b/Scenes/PickSlabWindow.gd index 107f892f..401a73df 100644 --- a/Scenes/PickSlabWindow.gd +++ b/Scenes/PickSlabWindow.gd @@ -138,7 +138,6 @@ func custom_slab_add_new_button(): id.connect("mouse_entered", self, "_on_hovered_over_item", [id]) id.connect("mouse_exited", self, "_on_hovered_none") id.connect("pressed",self,"_on_pressed_add_new_custom_slab") - #id.connect('gui_input',self,"_on_slab_portrait_gui_input",[id]) id.rect_min_size = Vector2(grid_item_size.x * grid_window_scale, grid_item_size.y * grid_window_scale) var tabID = tabs[Slabs.TAB_CUSTOM][GRIDCON_PATH]