From 95d88a8298142a996bf828734f7e986d2f99f9ab Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 12 Jan 2024 05:23:06 -0800 Subject: use editor state font for width calculations --- log_browser.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'log_browser.lua') diff --git a/log_browser.lua b/log_browser.lua index dabec2b..6e7e6db 100644 --- a/log_browser.lua +++ b/log_browser.lua @@ -94,14 +94,14 @@ function log_browser.draw(State, hide_cursor) love.graphics.line(xright,sectiony, xright,y+State.line_height) love.graphics.line(xleft,sectiony, xleft+50-2,sectiony) love.graphics.print(line.section_name, xleft+50,y) - love.graphics.line(xleft+50+App.width(line.section_name)+2,sectiony, xright,sectiony) + love.graphics.line(xleft+50+State.font:getWidth(line.section_name)+2,sectiony, xright,sectiony) else assert(line.section_end, "log line has a section name, but it's neither the start nor end of a section") local sectiony = y+State.line_height-Section_border_padding_vertical love.graphics.line(xleft,y, xleft,sectiony) love.graphics.line(xright,y, xright,sectiony) love.graphics.line(xleft,sectiony, xleft+50-2,sectiony) love.graphics.print(line.section_name, xleft+50,y) - love.graphics.line(xleft+50+App.width(line.section_name)+2,sectiony, xright,sectiony) + love.graphics.line(xleft+50+State.font:getWidth(line.section_name)+2,sectiony, xright,sectiony) end else if type(line.data) == 'string' then @@ -137,7 +137,7 @@ function render_stack_left_margin(State, line_index, line, y) love.graphics.print(line.section_stack[i].name, x+State.font_height+5, y+5, --[[vertically]] math.pi/2) end if y > App.screen.height-log_browser.height(State, line_index) then - love.graphics.print(line.section_stack[i].name, x+State.font_height+5, App.screen.height-App.width(line.section_stack[i].name)-5, --[[vertically]] math.pi/2) + love.graphics.print(line.section_stack[i].name, x+State.font_height+5, App.screen.height-State.font:getWidth(line.section_stack[i].name)-5, --[[vertically]] math.pi/2) end end return log_browser.left_margin(State, line) @@ -152,7 +152,7 @@ function render_stack_right_margin(State, line_index, line, y) love.graphics.print(line.section_stack[i].name, x, y+5, --[[vertically]] math.pi/2) end if y > App.screen.height-log_browser.height(State, line_index) then - love.graphics.print(line.section_stack[i].name, x, App.screen.height-App.width(line.section_stack[i].name)-5, --[[vertically]] math.pi/2) + love.graphics.print(line.section_stack[i].name, x, App.screen.height-State.font:getWidth(line.section_stack[i].name)-5, --[[vertically]] math.pi/2) end end return log_browser.right_margin(State, line) -- cgit 1.4.1-2-gfad0