Canvas Line2D doesn't get freed and re-created

Make Line2D have the same position for both of its points so it's invisible when the user is not making a straight line
This commit is contained in:
OverloadedOrama 2020-01-15 22:31:02 +02:00
parent 7a3f3eb4f9
commit bac3fdcad6
2 changed files with 12 additions and 15 deletions

View file

@ -63,8 +63,7 @@ func _process(delta : float) -> void:
update()
# Makes line2d invisible
if is_instance_valid(Global.canvas.line_2d): # Checks to see if line_2d object still exists
Global.canvas.line_2d.default_color = Color(0, 0, 0, 0)
Global.canvas.line_2d.default_color = Color(0, 0, 0, 0)
else:
get_parent().get_parent().mouse_default_cursor_shape = Input.CURSOR_ARROW
@ -104,8 +103,7 @@ func _process(delta : float) -> void:
Global.canvas.handle_redo("Rectangle Select") # Redo
# Makes line2d visible
if is_instance_valid(Global.canvas.line_2d): # Checks to see if line_2d object still exists
Global.canvas.line_2d.default_color = Color.darkgray
Global.canvas.line_2d.default_color = Color.darkgray
if Global.selected_pixels.size() > 0:
# Handle copy