Fixed crash that occured when trying to delete contents of a selection that were outside the canvas' borders

This commit is contained in:
OverloadedOrama 2020-01-07 17:20:25 +02:00
parent ff3b5e321b
commit db29c1af67
2 changed files with 4 additions and 3 deletions

View file

@ -133,7 +133,8 @@ func _process(delta : float) -> void:
Global.canvas.handle_undo("Draw")
for xx in range(start_pos.x, end_pos.x):
for yy in range(start_pos.y, end_pos.y):
layer.set_pixel(xx, yy, Color(0, 0, 0, 0))
if point_in_rectangle(Vector2(xx, yy), Global.canvas.location - Vector2.ONE, Global.canvas.location + Global.canvas.size):
layer.set_pixel(xx, yy, Color(0, 0, 0, 0))
Global.canvas.handle_redo("Draw")