1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 09:39:48 +00:00
Pixelorama/src/UI/BrushButton.gd

29 lines
672 B
GDScript3
Raw Normal View History

extends BaseButton
var brush = Global.brushes_popup.Brush.new()
func _on_BrushButton_pressed() -> void:
# Delete the brush on middle mouse press
if Input.is_action_just_released("middle_mouse"):
_on_DeleteButton_pressed()
else:
Global.brushes_popup.select_brush(brush)
func _on_DeleteButton_pressed() -> void:
if brush.type != Global.brushes_popup.CUSTOM:
return
Global.brushes_popup.remove_brush(self)
func _on_BrushButton_mouse_entered() -> void:
if brush.type == Global.brushes_popup.CUSTOM:
$DeleteButton.visible = true
func _on_BrushButton_mouse_exited() -> void:
if brush.type == Global.brushes_popup.CUSTOM:
$DeleteButton.visible = false