2019-11-30 00:41:34 +02:00
|
|
|
extends BaseButton
|
2019-09-25 22:59:48 +03:00
|
|
|
|
2020-05-01 20:47:10 +03:00
|
|
|
|
2020-07-09 20:22:17 +08:00
|
|
|
var brush := Brushes.Brush.new()
|
2020-05-01 20:47:10 +03:00
|
|
|
|
2019-09-25 22:59:48 +03:00
|
|
|
|
|
|
|
func _on_BrushButton_pressed() -> void:
|
2020-01-28 00:19:55 +02:00
|
|
|
# Delete the brush on middle mouse press
|
|
|
|
if Input.is_action_just_released("middle_mouse"):
|
|
|
|
_on_DeleteButton_pressed()
|
2020-06-05 17:21:35 +03:00
|
|
|
else:
|
2020-07-09 20:22:17 +08:00
|
|
|
Global.brushes_popup.select_brush(brush)
|
2019-11-11 15:55:28 +02:00
|
|
|
|
2020-05-01 20:47:10 +03:00
|
|
|
|
2019-11-11 15:55:28 +02:00
|
|
|
func _on_DeleteButton_pressed() -> void:
|
2020-07-09 20:22:17 +08:00
|
|
|
if brush.type != Brushes.CUSTOM:
|
2020-06-05 17:21:35 +03:00
|
|
|
return
|
|
|
|
|
2020-07-09 20:22:17 +08:00
|
|
|
Global.brushes_popup.remove_brush(self)
|
2019-11-11 15:55:28 +02:00
|
|
|
|
2020-05-01 20:47:10 +03:00
|
|
|
|
2019-11-11 15:55:28 +02:00
|
|
|
func _on_BrushButton_mouse_entered() -> void:
|
2020-07-09 20:22:17 +08:00
|
|
|
if brush.type == Brushes.CUSTOM:
|
2019-11-11 15:55:28 +02:00
|
|
|
$DeleteButton.visible = true
|
|
|
|
|
2020-05-01 20:47:10 +03:00
|
|
|
|
2019-11-11 15:55:28 +02:00
|
|
|
func _on_BrushButton_mouse_exited() -> void:
|
2020-07-09 20:22:17 +08:00
|
|
|
if brush.type == Brushes.CUSTOM:
|
2019-11-11 15:55:28 +02:00
|
|
|
$DeleteButton.visible = false
|