From 53d062619e3b7fff2c3bca6f54434599181edc81 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Sat, 29 Feb 2020 01:55:01 +0200 Subject: [PATCH] Rectangle Selection works per layer again --- Scripts/SelectionRectangle.gd | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Scripts/SelectionRectangle.gd b/Scripts/SelectionRectangle.gd index 69656d7f8..6a922109f 100644 --- a/Scripts/SelectionRectangle.gd +++ b/Scripts/SelectionRectangle.gd @@ -23,7 +23,7 @@ func _process(delta : float) -> void: var mouse_pos_floored := mouse_pos.floor() var start_pos := polygon[0] var end_pos := polygon[2] - var current_layer_index: int = Global.canvas.current_layer_index + var current_layer_index : int = Global.current_layer var layer : Image = Global.canvas.layers[current_layer_index][0] if end_pos == start_pos: @@ -59,7 +59,7 @@ func _process(delta : float) -> void: layer.set_pixelv(curr_px, Color(0, 0, 0, 0)) else: # If part of selection is outside canvas orig_colors.append(Color(0, 0, 0, 0)) - Global.canvas.update_texture(Global.canvas.current_layer_index) + Global.canvas.update_texture(current_layer_index) tex.create_from_image(img, 0) update() @@ -90,7 +90,7 @@ func _process(delta : float) -> void: var px = polygon[0] + Global.selected_pixels[i] - Global.selected_pixels[0] if point_in_rectangle(px, Global.canvas.location - Vector2.ONE, Global.canvas.size): layer.set_pixelv(px, orig_colors[i]) - Global.canvas.update_texture(Global.canvas.current_layer_index) + Global.canvas.update_texture(current_layer_index) img.fill(Color(0, 0, 0, 0)) tex.create_from_image(img, 0) update() @@ -136,8 +136,6 @@ func _process(delta : float) -> void: layer.set_pixel(xx, yy, Color(0, 0, 0, 0)) Global.canvas.handle_redo("Draw") - - func _draw() -> void: if img.get_size() == polygon[2] - polygon[0]: draw_texture(tex, polygon[0], Color(1, 1, 1, 0.5))