From d4daac442b805eb1a4b3e1fb3edd993359eae31a Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 19 May 2022 22:07:12 -0700 Subject: clicking now moves the cursor even on long, wrapped lines --- main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index d058e53..0cd5274 100644 --- a/main.lua +++ b/main.lua @@ -12,6 +12,7 @@ require 'icons' -- a text is a table with: -- mode = 'text' -- string data +-- screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line -- a drawing is a table with: -- mode = 'drawing' -- a (y) coord in pixels (updated while painting screen), @@ -126,7 +127,6 @@ function love.draw() y = y + Drawing.pixels(line.h) + 10 -- padding else line.y = y ---? y = Text.draw(line, 100, line_index, Cursor_line, Cursor_pos) y = Text.draw(line, Line_width, line_index, Cursor_line, Cursor_pos) y = y + math.floor(15*Zoom) -- text height end @@ -145,7 +145,7 @@ function love.mousepressed(x,y, mouse_button) for line_index,line in ipairs(Lines) do if line.mode == 'text' then if Text.in_line(line, x,y) then - Text.move_cursor(line_index, line, x) + Text.move_cursor(line_index, line, x, y) end elseif line.mode == 'drawing' then if Drawing.in_drawing(line, x, y) then -- cgit 1.4.1-2-gfad0