diff options
Diffstat (limited to 'text.lua')
-rw-r--r-- | text.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/text.lua b/text.lua index 1b78251..bd51971 100644 --- a/text.lua +++ b/text.lua @@ -181,14 +181,14 @@ function Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necess end function Text.scroll_up_while_cursor_on_screen() - local y = Screen_height - 15*Zoom -- for Cursor_line + local y = Screen_height - math.floor(15*Zoom) -- for Cursor_line while true do if Screen_top_line == 1 then break end - y = y - 15*Zoom + y = y - math.floor(15*Zoom) if Lines[Screen_top_line].mode == 'drawing' then y = y - Drawing.pixels(Lines[Screen_top_line].h) end - if y < 15*Zoom then + if y < math.floor(15*Zoom) then break end Screen_top_line = Screen_top_line - 1 @@ -197,7 +197,7 @@ end function Text.in_line(line, x,y) if line.y == nil then return false end -- outside current page - return x >= 16 and y >= line.y and y < line.y+15*Zoom + return x >= 16 and y >= line.y and y < line.y + math.floor(15*Zoom) end function Text.move_cursor(line_index, line, x) @@ -246,7 +246,7 @@ end function Text.cursor_x(line_data, cursor_pos) local line_before_cursor = line_data:sub(1, cursor_pos-1) local text_before_cursor = love.graphics.newText(love.graphics.getFont(), line_before_cursor) - return 25+text_before_cursor:getWidth()*Zoom + return 25 + math.floor(text_before_cursor:getWidth()*Zoom) end return Text |