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

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>
This commit is contained in:
Variable 2023-01-01 23:04:15 +05:00 committed by GitHub
parent cbeef73fac
commit 5113963f64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -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:

View file

@ -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: