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

Make the vertical ruler show its values vertically

This commit is contained in:
Michael Alexsander 2019-12-19 19:23:08 -03:00
parent 80f7a0ca13
commit 7d1b72aa58

View file

@ -46,8 +46,11 @@ func _draw() -> void:
var position : Vector2 = (transform * ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(0, i))
if i % (major_subdivision * minor_subdivision) == 0:
draw_line(Vector2(0, position.y), Vector2(RULER_WIDTH, position.y), Color.white)
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, i)).y
draw_string(font, Vector2(0, position.y - 2), str(int(val)))
draw_string(font, Vector2(), str(int(val)))
draw_set_transform_matrix(get_transform())
else:
if i % minor_subdivision == 0:
draw_line(Vector2(RULER_WIDTH * 0.33, position.y), Vector2(RULER_WIDTH, position.y), Color.white)