From 02d1900dc2f06b741ef73c456937a9ffbc69307e Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Sat, 14 Dec 2024 16:05:51 +0200 Subject: [PATCH] Make brush size in draw tools not affect the draw tiles mode We could change it again if we implement it in a non-confusing way --- src/Tools/BaseDraw.gd | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Tools/BaseDraw.gd b/src/Tools/BaseDraw.gd index aa2d2d8a3..22e1f6c39 100644 --- a/src/Tools/BaseDraw.gd +++ b/src/Tools/BaseDraw.gd @@ -212,8 +212,7 @@ func update_brush() -> void: $DensityValueSlider.visible = _brush.type not in IMAGE_BRUSHES $ColorInterpolation.visible = _brush.type in IMAGE_BRUSHES $RotationOptions.visible = _brush.type in IMAGE_BRUSHES - var canvas_indicators := Global.canvas.indicators - canvas_indicators.queue_redraw() + Global.canvas.indicators.queue_redraw() func update_random_image() -> void: @@ -378,6 +377,8 @@ func _prepare_tool() -> void: func _draw_tool(pos: Vector2) -> PackedVector2Array: if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn(): return PackedVector2Array() # empty fallback + if Tools.is_placing_tiles(): + return _compute_draw_tool_pixel(pos) match _brush.type: Brushes.PIXEL: return _compute_draw_tool_pixel(pos) @@ -428,9 +429,12 @@ func draw_fill_gap(start: Vector2i, end: Vector2i) -> void: ## Compute the array of coordinates that should be drawn func _compute_draw_tool_pixel(pos: Vector2) -> PackedVector2Array: + var brush_size := _brush_size_dynamics + if Tools.is_placing_tiles(): + brush_size = 1 var result := PackedVector2Array() - var start := pos - Vector2.ONE * (_brush_size_dynamics >> 1) - var end := start + Vector2.ONE * _brush_size_dynamics + var start := pos - Vector2.ONE * (brush_size >> 1) + var end := start + Vector2.ONE * brush_size for y in range(start.y, end.y): for x in range(start.x, end.x): result.append(Vector2(x, y))