From 5113963f644bdc43acf7602e05e76f55640e4d46 Mon Sep 17 00:00:00 2001 From: Variable <77773850+Variable-ind@users.noreply.github.com> Date: Sun, 1 Jan 2023 23:04:15 +0500 Subject: [PATCH] Allow floating point for Horizontal and Vertical Rulers (#800) * Allow floating point for HRuler * Allow floating point for VRuler * Formatting * Format again Co-authored-by: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> --- src/UI/Canvas/Rulers/HorizontalRuler.gd | 4 +++- src/UI/Canvas/Rulers/VerticalRuler.gd | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/UI/Canvas/Rulers/HorizontalRuler.gd b/src/UI/Canvas/Rulers/HorizontalRuler.gd index 9f6480898..7c6e6297e 100644 --- a/src/UI/Canvas/Rulers/HorizontalRuler.gd +++ b/src/UI/Canvas/Rulers/HorizontalRuler.gd @@ -76,7 +76,9 @@ func _draw() -> void: ) var val = (ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(j, 0)).x draw_string( - font, Vector2(position.x + RULER_WIDTH + 2, font.get_height() - 4), str(int(val)) + font, + Vector2(position.x + RULER_WIDTH + 2, font.get_height() - 4), + str(stepify(val, 0.1)) ) else: if j % minor_subdivision == 0: diff --git a/src/UI/Canvas/Rulers/VerticalRuler.gd b/src/UI/Canvas/Rulers/VerticalRuler.gd index 9a1a57965..8cd12064c 100644 --- a/src/UI/Canvas/Rulers/VerticalRuler.gd +++ b/src/UI/Canvas/Rulers/VerticalRuler.gd @@ -73,7 +73,7 @@ func _draw() -> void: var text_xform = Transform2D(-PI / 2, Vector2(font.get_height() - 4, position.y - 2)) draw_set_transform_matrix(get_transform() * text_xform) var val = (ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(0, j)).y - draw_string(font, Vector2(), str(int(val))) + draw_string(font, Vector2(), str(stepify(val, 0.1))) draw_set_transform_matrix(get_transform()) else: if j % minor_subdivision == 0: