Files
tgcc/core/main_scene_ui/icon_button.gd
2026-06-01 09:03:31 +00:00

33 lines
712 B
GDScript

@tool
extends Button
class_name IconButton
@export var data: String
@export var image: Texture:
set(value):
image = value
if is_inside_tree() and has_node("%Texture"):
$%Texture.texture = image
@onready var mini_texture: TextureRect = $%MiniTexture
func _ready():
if image != null and has_node("%Texture"):
$%Texture.texture = image
func _on_mouse_entered() -> void:
if TweenFX.is_playing(self, TweenFX.Animations.BREATHE):
return
TweenFX.breathe(self, 1)
func _on_mouse_exited() -> void:
TweenFX.stop(self, TweenFX.Animations.BREATHE)
scale = Vector2(1, 1)
func _on_pressed() -> void:
if TweenFX.is_playing(self, TweenFX.Animations.PRESS_ROTATE):
return
TweenFX.press_rotate(self)