refactoring UI
This commit was merged in pull request #26.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
@tool
|
||||
extends Control
|
||||
extends Button
|
||||
|
||||
class_name IconButton
|
||||
|
||||
signal on_pressed
|
||||
|
||||
@export var data: String
|
||||
@export var image: Texture:
|
||||
@@ -12,12 +11,22 @@ signal on_pressed
|
||||
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_gui_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
on_pressed.emit()
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user