1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

When switching projects and the curve tool is active, clear it

Instead of applying it. This also fixes a crash when the curve tool is active and the current project closes
This commit is contained in:
Emmanouil Papadeas 2024-06-01 12:59:22 +03:00
parent e1a53ed905
commit 2afb087b7a

View file

@ -10,7 +10,7 @@ var _last_mouse_position := Vector2.INF ## The last position of the mouse
func _init() -> void:
Global.project_about_to_switch.connect(_draw_shape) # To prevent tool from remaining active
Global.project_about_to_switch.connect(_clear) # To prevent tool from remaining active
_drawer.color_op = Drawer.ColorOp.new()
update_indicator()
@ -174,10 +174,14 @@ func _draw_shape() -> void:
v.y = y
if Geometry2D.is_point_in_polygon(v, points):
draw_tool(v)
_clear()
commit_undo()
func _clear() -> void:
_curve.clear_points()
_drawing = false
_editing_out_control_point = false
commit_undo()
## Get the [member _curve]'s baked points, and draw lines between them using [method _fill_gap].