Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] DocView:get_line_screen_position() returns inacurate x-coordinate #313

Open
SwissalpS opened this issue Jun 25, 2023 · 0 comments
Open

Comments

@SwissalpS
Copy link

to reproduce:

  • clone/checkout master at [38bd9b3] (latest as of this writing)
  • build it
  • add a plugin like this:
local DocView = require "core.docview"

local omr = DocView.on_mouse_released
function DocView:on_mouse_released(b, x, y)
  local line, col = self:resolve_screen_position(x, y)
  local x2, y2 = self:get_line_screen_position(line, col)
  print('x: ' .. x .. ' x2: ' .. x2)
  return true
end
  • launch lite from terminal
  • open a document
  • click in the middle of a line and read output
    x ~= x2
    a small diff can be expected from rounding and a bigger one
    can be expected when clicking out to the right of text.
    In my tests the diff was over 100 pixels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant