diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-04-02 09:22:32 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-04-02 09:22:32 -0700 |
commit | 3547c18db6b9d508fb5c2399c124e33f4cc8c488 (patch) | |
tree | efec742d0c0a10017b1af35ae1a586077ee0cb05 /drawing.lua | |
parent | 3bdaf97baab7fd03c53a91ebd11bf359ab97a5d3 (diff) | |
parent | 29f1687f3c6a494eb67029acbeefbf11571bbe2c (diff) | |
download | text.love-3547c18db6b9d508fb5c2399c124e33f4cc8c488.tar.gz |
Merge lines.love
Diffstat (limited to 'drawing.lua')
-rw-r--r-- | drawing.lua | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drawing.lua b/drawing.lua index 99193c6..5af25fb 100644 --- a/drawing.lua +++ b/drawing.lua @@ -60,14 +60,13 @@ function Drawing.draw(State, line_index, y) if State.current_drawing_mode == 'name' and i == line.pending.target_point then -- create a faint red box for the name App.color(Current_name_background_color) - local name_text - -- TODO: avoid computing name width on every repaint + local name_width if p.name == '' then - name_text = State.em + name_width = App.width('m') else - name_text = App.newText(love.graphics.getFont(), p.name) + name_width = App.width(p.name) end - love.graphics.rectangle('fill', x,y, App.width(name_text), State.line_height) + love.graphics.rectangle('fill', x,y, name_width, State.line_height) end end end |