1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-20 12:33:14 +00:00

Don't create guides if they have less than 2 points

This commit is contained in:
OverloadedOrama 2020-09-21 19:19:41 +03:00
parent 5814123ee8
commit 9617d18bc8
2 changed files with 6 additions and 0 deletions

View file

@ -66,6 +66,9 @@ func _on_HorizontalRuler_pressed() -> void:
guide.type = guide.Types.HORIZONTAL
guide.add_point(Vector2(-19999, Global.canvas.current_pixel.y))
guide.add_point(Vector2(19999, Global.canvas.current_pixel.y))
if guide.points.size() < 2:
guide.queue_free()
return
Global.canvas.add_child(guide)
Global.has_focus = false
update()

View file

@ -66,6 +66,9 @@ func _on_VerticalRuler_pressed() -> void:
guide.type = guide.Types.VERTICAL
guide.add_point(Vector2(Global.canvas.current_pixel.x, -19999))
guide.add_point(Vector2(Global.canvas.current_pixel.x, 19999))
if guide.points.size() < 2:
guide.queue_free()
return
Global.canvas.add_child(guide)
Global.has_focus = false
update()