From 91b21a52f541d8d2e50c83e33ee22d9bc9ffde46 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Thu, 19 Dec 2019 03:15:23 +0200 Subject: [PATCH] Angle between last drawn pixel and line is now appearing on the top when drawing a straight line Also straight lines work with LightenDarken now, and moved the Seconds Timeline a bit to the left --- Main.tscn | 3 +++ Scripts/Canvas.gd | 6 +++++- Scripts/TimelineSeconds.gd | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Main.tscn b/Main.tscn index 8e2dc54eb..abb28eecf 100644 --- a/Main.tscn +++ b/Main.tscn @@ -226,6 +226,7 @@ text = "[64×64]" align = 2 [node name="UI" type="HBoxContainer" parent="MenuAndUI"] +editor/display_folded = true margin_top = 28.0 margin_right = 1152.0 margin_bottom = 648.0 @@ -804,6 +805,7 @@ size_flags_horizontal = 3 size_flags_vertical = 3 [node name="ViewportAndRulers" type="VBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer"] +editor/display_folded = true margin_right = 704.0 margin_bottom = 478.0 size_flags_horizontal = 3 @@ -883,6 +885,7 @@ margin_right = 319.0 margin_bottom = 464.0 [node name="ViewportContainer2" type="ViewportContainer" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer"] +editor/display_folded = true visible = false margin_left = 345.0 margin_right = 686.0 diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index e8ad8c8e1..6bb590358 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -248,7 +248,7 @@ func _process(delta : float) -> void: Global.right_color_picker.color = pixel_color Global.update_right_custom_brush() - if Input.is_action_just_pressed("shift") and (["Pencil", "Eraser"].has(Global.current_left_tool) or ["Pencil", "Eraser"].has(Global.current_right_tool)): + if Input.is_action_just_pressed("shift") and (["Pencil", "Eraser", "LightenDarken"].has(Global.current_left_tool) or ["Pencil", "Eraser", "LightenDarken"].has(Global.current_right_tool)): line_2d = Line2D.new() line_2d.width = 0.5 line_2d.default_color = Color.darkgray @@ -262,6 +262,10 @@ func _process(delta : float) -> void: line_2d.queue_free() if is_making_line: line_2d.set_point_position(1, mouse_pos) + var angle := stepify(rad2deg(line_2d.points[1].angle_to_point(line_2d.points[0])), 0.01) + if angle < 0: + angle = 360 + angle + Global.cursor_position_label.text += " %s°" % str(angle) if is_making_selection != "None": #If we're making a selection diff --git a/Scripts/TimelineSeconds.gd b/Scripts/TimelineSeconds.gd index 3f1066d8f..b4880e72e 100644 --- a/Scripts/TimelineSeconds.gd +++ b/Scripts/TimelineSeconds.gd @@ -21,7 +21,7 @@ func _draw() -> void: var minor_subdivide := Transform2D() var fps = Global.control.fps var horizontal_scroll = get_parent().get_node("FrameAndButtonContainer").get_node("ScrollContainer").scroll_horizontal - var starting_pos := Vector2(26, 26) + var starting_pos := Vector2(10, 10) transform.x = Vector2(fps, fps) / 2.52 transform.origin = starting_pos - Vector2(horizontal_scroll, horizontal_scroll)