diff --git a/src/Tools/BaseDraw.gd b/src/Tools/BaseDraw.gd index c424f9619..3f74d2444 100644 --- a/src/Tools/BaseDraw.gd +++ b/src/Tools/BaseDraw.gd @@ -59,8 +59,9 @@ func _on_BrushType_pressed() -> void: if child is GridContainer: child.columns = columns Global.brushes_popup.popup(Rect2(pop_position, Vector2(size_x, size_y))) - Tools.flip_rotate.emit(_brush_flip_x, _brush_flip_y, _brush_rotate_90, _brush_rotate_180, _brush_rotate_270) - + Tools.flip_rotate.emit( + _brush_flip_x, _brush_flip_y, _brush_rotate_90, _brush_rotate_180, _brush_rotate_270 + ) func _on_Brush_selected(brush: Brushes.Brush) -> void: @@ -195,16 +196,16 @@ func update_mirror_brush() -> void: func update_brush_image_flip_and_rotate() -> void: - if _brush_flip_x == true: - _brush_image.flip_x() - if _brush_flip_y == true: - _brush_image.flip_y() - if _brush_rotate_90 == true: - _brush_image.rotate_90(CLOCKWISE) - if _brush_rotate_180 == true: - _brush_image.rotate_180() - if _brush_rotate_270 == true: - _brush_image.rotate_90(COUNTERCLOCKWISE) + if _brush_flip_x == true: + _brush_image.flip_x() + if _brush_flip_y == true: + _brush_image.flip_y() + if _brush_rotate_90 == true: + _brush_image.rotate_90(CLOCKWISE) + if _brush_rotate_180 == true: + _brush_image.rotate_180() + if _brush_rotate_270 == true: + _brush_image.rotate_90(COUNTERCLOCKWISE) func update_mask(can_skip := true) -> void: @@ -738,7 +739,6 @@ func _pick_color(pos: Vector2i) -> void: Tools.assign_color(color, button, false) - func _on_flip_x_toggled(button_pressed: bool) -> void: _brush_flip_x = button_pressed update_brush() diff --git a/src/UI/Buttons/BrushButton.gd b/src/UI/Buttons/BrushButton.gd index 6df3d4b7b..fe33b172c 100644 --- a/src/UI/Buttons/BrushButton.gd +++ b/src/UI/Buttons/BrushButton.gd @@ -2,6 +2,7 @@ extends BaseButton var brush = Global.brushes_popup.Brush.new() + func _ready() -> void: Tools.flip_rotate.connect(_flip_rotate_updated) @@ -30,11 +31,17 @@ func _on_BrushButton_mouse_exited() -> void: if brush.type == Global.brushes_popup.CUSTOM: $DeleteButton.visible = false -func _flip_rotate_updated(flip_x: bool, flip_y: bool, rotate_90: bool, rotate_180: bool,rotate_270: bool): + +func _flip_rotate_updated( + flip_x: bool, flip_y: bool, rotate_90: bool, rotate_180: bool,rotate_270: bool +): $BrushTexture.set_flip_h(flip_x) $BrushTexture.set_flip_v(flip_y) var _rotation = 0 - if rotate_90 ==true : _rotation += 90 - if rotate_180 ==true : _rotation += 180 - if rotate_270 ==true : _rotation += 270 + if rotate_90 == true: + _rotation += 90 + if rotate_180 == true: + _rotation += 180 + if rotate_270 == true: + _rotation += 270 $BrushTexture.rotation_degrees = _rotation