1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 17:49:47 +00:00
Pixelorama/src/UI/BrushButton.gd
Kinwailo 4a668f71f5
Refactoring tools (#281)
* Refactoring tools

* Remove unused code

* Fixed some inferring errors and added translations

* Attempt to fix some Script Errors found in the CI workflow

* Fix bucket crash.

* Fix static type convert.

Co-authored-by: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com>
2020-07-09 15:22:17 +03:00

30 lines
622 B
GDScript

extends BaseButton
var brush := Brushes.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 != Brushes.CUSTOM:
return
Global.brushes_popup.remove_brush(self)
func _on_BrushButton_mouse_entered() -> void:
if brush.type == Brushes.CUSTOM:
$DeleteButton.visible = true
func _on_BrushButton_mouse_exited() -> void:
if brush.type == Brushes.CUSTOM:
$DeleteButton.visible = false