From cf8dacf0f5e17ebbea27ec778fa2f81b4879994d Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Sun, 15 Dec 2024 18:37:21 +0200 Subject: [PATCH] Fix curve edit tangent points They are working properly now --- src/UI/Nodes/CurveEditor/CurveControlPoint.gd | 4 +--- src/UI/Nodes/CurveEditor/CurveTangentPoint.gd | 7 +++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/UI/Nodes/CurveEditor/CurveControlPoint.gd b/src/UI/Nodes/CurveEditor/CurveControlPoint.gd index 4ba12ee32..0bbcdc434 100644 --- a/src/UI/Nodes/CurveEditor/CurveControlPoint.gd +++ b/src/UI/Nodes/CurveEditor/CurveControlPoint.gd @@ -22,12 +22,10 @@ var right_slope: CurveEditTangentPoint func _ready() -> void: + gui_input.connect(_on_gui_input) custom_minimum_size = Vector2(8, 8) left_slope = CurveEditTangentPoint.new() right_slope = CurveEditTangentPoint.new() - gui_input.connect(_on_gui_input) - left_slope.gui_input.connect(_on_gui_input) - right_slope.gui_input.connect(_on_gui_input) add_child(left_slope) add_child(right_slope) diff --git a/src/UI/Nodes/CurveEditor/CurveTangentPoint.gd b/src/UI/Nodes/CurveEditor/CurveTangentPoint.gd index 16e7b44ef..99816addd 100644 --- a/src/UI/Nodes/CurveEditor/CurveTangentPoint.gd +++ b/src/UI/Nodes/CurveEditor/CurveTangentPoint.gd @@ -6,7 +6,7 @@ extends Control const OFFSET := -Vector2(0, 0) -@export var distance: float +@export var distance := 30 var moving = false @onready var parent := get_parent() as CurveEditControlPoint @@ -14,7 +14,10 @@ var moving = false func _ready() -> void: + gui_input.connect(_on_gui_input) custom_minimum_size = Vector2(8, 8) + if get_index() == 0: + distance = -distance func _draw() -> void: @@ -26,7 +29,7 @@ func _draw() -> void: draw_circle(Vector2(3.0, 3.0), 3.0, color) -func _on_ControlPoint_gui_input(event: InputEvent) -> void: +func _on_gui_input(event: InputEvent) -> void: if event is InputEventMouseButton: if event.button_index == MOUSE_BUTTON_LEFT: if event.pressed: