Text under frames and TimelineSeconds color change on different themes

This commit is contained in:
OverloadedOrama 2019-12-24 04:37:17 +02:00
parent bfd64a6b84
commit 1f2d8406c2
6 changed files with 17 additions and 8 deletions

View file

@ -410,8 +410,11 @@ func frame_changed(value : int) -> void:
canvas.generate_layer_panels()
#Make all frame buttons unpressed
for c in canvases:
var text_color := Color.white
if theme_type == "Gold" || theme_type == "Light":
text_color = Color.black
c.frame_button.get_node("FrameButton").pressed = false
c.frame_button.get_node("FrameID").add_color_override("font_color", Color.white)
c.frame_button.get_node("FrameID").add_color_override("font_color", text_color)
#Make only the current frame button pressed
canvas.frame_button.get_node("FrameButton").pressed = true
canvas.frame_button.get_node("FrameID").add_color_override("font_color", Color("#3c5d75"))

View file

@ -93,6 +93,9 @@ func change_theme(ID : int) -> void:
var disabled_file_name = button.texture_disabled.resource_path.get_file()
button.texture_disabled = load("res://Assets/Graphics/%s Themes/%s/%s" % [Global.theme_type, button_category, disabled_file_name])
# Make sure the frame text gets updated
Global.current_frame = Global.current_frame
func _on_GridWidthValue_value_changed(value : float) -> void:
Global.grid_width = value

View file

@ -15,6 +15,9 @@ func _process(delta : float) -> void:
#Code taken and modified from Godot's source code
func _draw() -> void:
var color := Color.white
if Global.theme_type == "Gold" || Global.theme_type == "Light":
color = Color.black
var transform := Transform2D()
var ruler_transform := Transform2D()
var major_subdivide := Transform2D()
@ -43,12 +46,12 @@ func _draw() -> void:
for i in range(ceil(first.x), last.x):
var position : Vector2 = (transform * ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(i, 0))
if i % (major_subdivision * minor_subdivision) == 0:
draw_line(Vector2(position.x + RULER_WIDTH, 0), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white)
draw_line(Vector2(position.x + RULER_WIDTH, 0), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), color)
var val = (ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(i, 0)).x / 100
val = stepify(val, 0.01)
draw_string(font, Vector2(position.x + RULER_WIDTH + 2, font.get_height() - 6), "%ss" % str(val))
draw_string(font, Vector2(position.x + RULER_WIDTH + 2, font.get_height() - 6), "%ss" % str(val), color)
else:
if i % minor_subdivision == 0:
draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.33), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white)
draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.33), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), color)
else:
draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.66), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white)
draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.66), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), color)