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

Clear polygon select tool when switching projects

This commit is contained in:
Emmanouil Papadeas 2024-06-01 16:03:39 +03:00
parent 006be19464
commit b7a77a2ceb
2 changed files with 13 additions and 5 deletions

View file

@ -10,7 +10,8 @@ var _last_mouse_position := Vector2.INF ## The last position of the mouse
func _init() -> void:
Global.project_about_to_switch.connect(_clear) # To prevent tool from remaining active
# To prevent tool from remaining active when switching projects
Global.project_about_to_switch.connect(_clear)
_drawer.color_op = Drawer.ColorOp.new()
update_indicator()
@ -182,6 +183,7 @@ func _clear() -> void:
_curve.clear_points()
_drawing = false
_editing_out_control_point = false
Global.canvas.previews.queue_redraw()
## Get the [member _curve]'s baked points, and draw lines between them using [method _fill_gap].

View file

@ -5,6 +5,11 @@ var _draw_points: Array[Vector2i] = []
var _ready_to_apply := false
func _init() -> void:
# To prevent tool from remaining active when switching projects
Global.project_about_to_switch.connect(_clear)
func _input(event: InputEvent) -> void:
if _move:
return
@ -20,10 +25,7 @@ func _input(event: InputEvent) -> void:
apply_selection(Vector2i.ZERO) # Argument doesn't matter
else:
if event.is_action_pressed("transformation_cancel") and _ongoing_selection:
_ongoing_selection = false
_draw_points.clear()
_ready_to_apply = false
Global.canvas.previews.queue_redraw()
_clear()
func draw_start(pos: Vector2i) -> void:
@ -139,6 +141,10 @@ func apply_selection(pos: Vector2i) -> void:
Global.canvas.selection.clear_selection()
Global.canvas.selection.commit_undo("Select", undo_data)
_clear()
func _clear() -> void:
_ongoing_selection = false
_draw_points.clear()
_ready_to_apply = false