mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-22 21:43:13 +00:00
Started working on UndoRedo. Currently works with basic drawing/erasing/bucket filling as well as the rectangle selection tool, custom brushes and copying/pasting. May not work with multiple layers and frames and it does not work with the rest of the tools and buttons. Also does not work when pressing both mouse buttons at the same time, or when the cursor is outside the canvas when drawing.
21 lines
No EOL
823 B
GDScript
21 lines
No EOL
823 B
GDScript
extends Button
|
|
|
|
var brush_type = Global.BRUSH_TYPES.PIXEL
|
|
var custom_brush_index := -1
|
|
|
|
func _on_BrushButton_pressed() -> void:
|
|
if Input.is_action_just_released("left_mouse"):
|
|
Global.current_left_brush_type = brush_type
|
|
Global.left_brush_indicator.get_parent().remove_child(Global.left_brush_indicator)
|
|
add_child(Global.left_brush_indicator)
|
|
if custom_brush_index > -1:
|
|
Global.custom_left_brush_index = custom_brush_index
|
|
Global.update_left_custom_brush()
|
|
|
|
elif Input.is_action_just_released("right_mouse"):
|
|
Global.current_right_brush_type = brush_type
|
|
Global.right_brush_indicator.get_parent().remove_child(Global.right_brush_indicator)
|
|
add_child(Global.right_brush_indicator)
|
|
if custom_brush_index > -1:
|
|
Global.custom_right_brush_index = custom_brush_index
|
|
Global.update_right_custom_brush() |