added UniReader:screenOffset and use it

pull/2/merge
Dobrica Pavlinusic 12 years ago
parent 4d49e9f28b
commit 96958c62ca

@ -37,13 +37,7 @@ end
-- coordinate. So y0 should be taken with special care.
----------------------------------------------------
function DJVUReader:zoomedRectCoordTransform(x0, y0, x1, y1)
local x = self.dest_x
local y = self.dest_y
if self.offset_x < 0 or self.offset_y < 0 then
x = x + self.offset_x
y = y + self.offset_y
end
print("# zoomedRectCoordTransform x="..x.." y="..y.." dest="..self.dest_x..","..self.dest_y.." offset="..self.offset_x..","..self.offset_y);
local x,y = self:screenOffset()
return
x0 * self.globalzoom + x,
self.cur_full_height - (y1 * self.globalzoom) + y,

@ -118,19 +118,26 @@ end
-- highlight support
----------------------------------------------------
function UniReader:screenOffset()
local x = self.dest_x
local y = self.dest_y
if self.offset_x < 0 then
x = x + self.offset_x
end
if self.offset_y < 0 then
y = y + self.offset_y
end
print("# screenOffset "..x..","..y)
return x,y
end
----------------------------------------------------
-- Given coordinates of four corners in original page
-- size and return coordinate of upper left conner in
-- zoomed page size with width and height.
----------------------------------------------------
function UniReader:zoomedRectCoordTransform(x0, y0, x1, y1)
local x = self.dest_x
local y = self.dest_y
if self.offset_x < 0 or self.offset_y < 0 then
x = x + self.offset_x
y = y + self.offset_y
end
print("# zoomedRectCoordTransform x="..x.." y="..y.." dest="..self.dest_x..","..self.dest_y.." offset="..self.offset_x..","..self.offset_y);
local x,y = self:screenOffset()
return
x0 * self.globalzoom + x,
y0 * self.globalzoom + y,

Loading…
Cancel
Save