|
|
@ -173,10 +173,16 @@ function ReaderLink:isXpointerCoherent(a_xpointer)
|
|
|
|
local re_link_xpointer, re_a_xpointer = self.ui.document:getLinkFromPosition({x = screen_x, y = screen_y}) -- luacheck: no unused
|
|
|
|
local re_link_xpointer, re_a_xpointer = self.ui.document:getLinkFromPosition({x = screen_x, y = screen_y}) -- luacheck: no unused
|
|
|
|
-- We should get the same a_xpointer. If not, crengine has messed up
|
|
|
|
-- We should get the same a_xpointer. If not, crengine has messed up
|
|
|
|
-- and we should not trust this xpointer to get back to this link.
|
|
|
|
-- and we should not trust this xpointer to get back to this link.
|
|
|
|
|
|
|
|
if re_a_xpointer ~= a_xpointer then
|
|
|
|
|
|
|
|
-- Try it again with screen_x+1 (in the rare cases where screen_x
|
|
|
|
|
|
|
|
-- fails, screen_x+1 usually works - probably something in crengine,
|
|
|
|
|
|
|
|
-- but easier to workaround here that way)
|
|
|
|
|
|
|
|
re_link_xpointer, re_a_xpointer = self.ui.document:getLinkFromPosition({x = screen_x+1, y = screen_y}) -- luacheck: no unused
|
|
|
|
if re_a_xpointer ~= a_xpointer then
|
|
|
|
if re_a_xpointer ~= a_xpointer then
|
|
|
|
logger.info("not coherent a_xpointer:", a_xpointer)
|
|
|
|
logger.info("not coherent a_xpointer:", a_xpointer)
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|