mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-07 10:59:49 +00:00
Make the size of the text of rulers and guides be affected by the font size
This commit is contained in:
parent
bcbd0ea7da
commit
3ea0ef0b5a
|
@ -94,3 +94,9 @@ func get_font() -> Font:
|
||||||
if Global.control.theme.has_default_font():
|
if Global.control.theme.has_default_font():
|
||||||
return Global.control.theme.default_font
|
return Global.control.theme.default_font
|
||||||
return ThemeDB.fallback_font
|
return ThemeDB.fallback_font
|
||||||
|
|
||||||
|
|
||||||
|
func get_font_size() -> int:
|
||||||
|
if Global.control.theme.has_default_font_size():
|
||||||
|
return Global.control.theme.default_font_size
|
||||||
|
return ThemeDB.fallback_font_size
|
||||||
|
|
|
@ -124,7 +124,7 @@ func _draw() -> void:
|
||||||
string,
|
string,
|
||||||
HORIZONTAL_ALIGNMENT_LEFT,
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
-1,
|
-1,
|
||||||
16,
|
Themes.get_font_size(),
|
||||||
color
|
color
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -134,7 +134,7 @@ func _draw() -> void:
|
||||||
string,
|
string,
|
||||||
HORIZONTAL_ALIGNMENT_LEFT,
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
-1,
|
-1,
|
||||||
16,
|
Themes.get_font_size(),
|
||||||
color
|
color
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
@ -149,7 +149,13 @@ func _draw() -> void:
|
||||||
< intersection.distance_squared_to(viewport_poly[0])
|
< intersection.distance_squared_to(viewport_poly[0])
|
||||||
):
|
):
|
||||||
draw_string(
|
draw_string(
|
||||||
font, Vector2(x_offset, y_offset), string, HORIZONTAL_ALIGNMENT_LEFT, -1, 16, color
|
font,
|
||||||
|
Vector2(x_offset, y_offset),
|
||||||
|
string,
|
||||||
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
|
-1,
|
||||||
|
Themes.get_font_size(),
|
||||||
|
color
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
draw_string(
|
draw_string(
|
||||||
|
@ -158,7 +164,7 @@ func _draw() -> void:
|
||||||
string,
|
string,
|
||||||
HORIZONTAL_ALIGNMENT_LEFT,
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
-1,
|
-1,
|
||||||
16,
|
Themes.get_font_size(),
|
||||||
color
|
color
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
@ -179,7 +185,7 @@ func _draw() -> void:
|
||||||
string,
|
string,
|
||||||
HORIZONTAL_ALIGNMENT_LEFT,
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
-1,
|
-1,
|
||||||
16,
|
Themes.get_font_size(),
|
||||||
color
|
color
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -189,7 +195,7 @@ func _draw() -> void:
|
||||||
string,
|
string,
|
||||||
HORIZONTAL_ALIGNMENT_LEFT,
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
-1,
|
-1,
|
||||||
16,
|
Themes.get_font_size(),
|
||||||
color
|
color
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
@ -197,7 +203,13 @@ func _draw() -> void:
|
||||||
# If there's no intersection with a viewport edge, show string in top left corner
|
# If there's no intersection with a viewport edge, show string in top left corner
|
||||||
draw_set_transform(viewport_poly[0], Global.camera.rotation, Vector2(2.0, 2.0) / zoom)
|
draw_set_transform(viewport_poly[0], Global.camera.rotation, Vector2(2.0, 2.0) / zoom)
|
||||||
draw_string(
|
draw_string(
|
||||||
font, Vector2(x_offset, font_height), string, HORIZONTAL_ALIGNMENT_LEFT, -1, 16, color
|
font,
|
||||||
|
Vector2(x_offset, font_height),
|
||||||
|
string,
|
||||||
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
|
-1,
|
||||||
|
Themes.get_font_size(),
|
||||||
|
color
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,10 @@ func _draw() -> void:
|
||||||
draw_string(
|
draw_string(
|
||||||
font,
|
font,
|
||||||
Vector2(pos.x + RULER_WIDTH + 2, font.get_height() - 4),
|
Vector2(pos.x + RULER_WIDTH + 2, font.get_height() - 4),
|
||||||
str(snappedf(val, 0.1))
|
str(snappedf(val, 0.1)),
|
||||||
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
|
-1,
|
||||||
|
Themes.get_font_size()
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if j % minor_subdivision == 0:
|
if j % minor_subdivision == 0:
|
||||||
|
|
|
@ -86,7 +86,14 @@ func _draw() -> void:
|
||||||
var text_xform := Transform2D(-PI / 2, Vector2(font.get_height() - 4, pos.y - 2))
|
var text_xform := Transform2D(-PI / 2, Vector2(font.get_height() - 4, pos.y - 2))
|
||||||
draw_set_transform_matrix(get_transform() * text_xform)
|
draw_set_transform_matrix(get_transform() * text_xform)
|
||||||
var val := ((ruler_transform * major_subdivide * minor_subdivide) * Vector2(0, j)).y
|
var val := ((ruler_transform * major_subdivide * minor_subdivide) * Vector2(0, j)).y
|
||||||
draw_string(font, Vector2(), str(snappedf(val, 0.1)))
|
draw_string(
|
||||||
|
font,
|
||||||
|
Vector2(),
|
||||||
|
str(snappedf(val, 0.1)),
|
||||||
|
HORIZONTAL_ALIGNMENT_LEFT,
|
||||||
|
-1,
|
||||||
|
Themes.get_font_size()
|
||||||
|
)
|
||||||
draw_set_transform_matrix(get_transform())
|
draw_set_transform_matrix(get_transform())
|
||||||
else:
|
else:
|
||||||
if j % minor_subdivision == 0:
|
if j % minor_subdivision == 0:
|
||||||
|
|
Loading…
Reference in a new issue