|
|
|
@ -31,68 +31,3 @@ function DJVUReader:getText(pageno)
|
|
|
|
|
return self.doc:getPageText(pageno)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
----------------------------------------------------
|
|
|
|
|
-- In djvulibre library, some coordinates starts from
|
|
|
|
|
-- lower left conner, i.e. y is upside down in kpv's
|
|
|
|
|
-- coordinate. So y0 should be taken with special care.
|
|
|
|
|
----------------------------------------------------
|
|
|
|
|
function DJVUReader:zoomedRectCoordTransform(x0, y0, x1, y1)
|
|
|
|
|
local x,y = self:screenOffset()
|
|
|
|
|
return
|
|
|
|
|
x0 * self.globalzoom + x,
|
|
|
|
|
self.cur_full_height - (y1 * self.globalzoom) + y,
|
|
|
|
|
(x1 - x0) * self.globalzoom,
|
|
|
|
|
(y1 - y0) * self.globalzoom
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- make sure at least part of the box can be seen in next/previous view
|
|
|
|
|
-- @FIXME only works in FIT_TO_CONTENT_WIDTH mode 21.04 2012 (houqp)
|
|
|
|
|
-- @TODO use zoomedRectCoordTransform in unireader, no need to overwrite
|
|
|
|
|
-- it in here.
|
|
|
|
|
function DJVUReader:_isBoxInNextView(box)
|
|
|
|
|
return self.cur_full_height - (box.y0 * self.globalzoom) > -self.offset_y + G_height
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function DJVUReader:_isBoxInPrevView(box)
|
|
|
|
|
return self.cur_full_height - (box.y1 * self.globalzoom) < -self.offset_y
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- y axel in djvulibre starts from bottom
|
|
|
|
|
function DJVUReader:_isEntireWordInScreenHeightRange(w)
|
|
|
|
|
return (w ~= nil) and
|
|
|
|
|
(self.cur_full_height - (w.y1 * self.globalzoom) >=
|
|
|
|
|
-self.offset_y) and
|
|
|
|
|
(self.cur_full_height - (w.y0 * self.globalzoom) <=
|
|
|
|
|
-self.offset_y + G_height)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- y axel in djvulibre starts from bottom
|
|
|
|
|
function DJVUReader:_isEntireLineInScreenHeightRange(l)
|
|
|
|
|
return (l ~= nil) and
|
|
|
|
|
(self.cur_full_height - (l.y1 * self.globalzoom) >=
|
|
|
|
|
-self.offset_y) and
|
|
|
|
|
(self.cur_full_height - (l.y0 * self.globalzoom) <=
|
|
|
|
|
-self.offset_y + G_height)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- y axel in djvulibre starts from bottom
|
|
|
|
|
function DJVUReader:_isWordInScreenRange(w)
|
|
|
|
|
if not w then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
is_entire_word_out_of_screen_height =
|
|
|
|
|
(self.cur_full_height - (w.y0 * self.globalzoom) <=
|
|
|
|
|
-self.offset_y)
|
|
|
|
|
or (self.cur_full_height - (w.y1 * self.globalzoom) >=
|
|
|
|
|
-self.offset_y + G_height)
|
|
|
|
|
|
|
|
|
|
is_entire_word_out_of_screen_width =
|
|
|
|
|
(w.x0 * self.globalzoom >= -self.offset_x + G_width
|
|
|
|
|
or w.x1 * self.globalzoom <= -self.offset_x)
|
|
|
|
|
|
|
|
|
|
return (not is_entire_word_out_of_screen_height) and
|
|
|
|
|
(not is_entire_word_out_of_screen_width)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|