Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow floating point for Horizontal and Vertical Rulers #800

Merged
merged 4 commits into from
Jan 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/UI/Canvas/Rulers/HorizontalRuler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/UI/Canvas/Rulers/VerticalRuler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down