summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2010-01-05 10:14:38 -0800
committerPixel <pixel@nobis-crew.org>2010-01-05 10:14:38 -0800
commit69836d15333d9d48aecf3e0aef139c7eacf59214 (patch)
tree1f2e74e7e3264dc9eeae712c5e589c6825869a10
parent80bf27f647f587a5175f7b68bfe7dd4a7da17f5c (diff)
Somehow fixed the zoom. Still not optimal though.
-rw-r--r--dalos-framebuffer.lua8
1 files changed, 2 insertions, 6 deletions
diff --git a/dalos-framebuffer.lua b/dalos-framebuffer.lua
index f2dd01d..27e183c 100644
--- a/dalos-framebuffer.lua
+++ b/dalos-framebuffer.lua
@@ -245,8 +245,7 @@ Flip Y axis: %b
img2canvas = function (self, ix, iy)
local cfg = self.cfg
- local cx, cy
- return math.floor((ix + cfg.x) * cfg.zoom), math.floor((iy + cfg.y) * cfg.zoom)
+ return math.floor(ix * cfg.zoom + cfg.x), math.floor(iy * cfg.zoom + cfg.y)
end,
canvas2img = function (self, cx, cy)
@@ -255,7 +254,6 @@ Flip Y axis: %b
end,
scroll_cb = function (self, op, posx, posy)
- print "Scroll called."
self:resize_cb(self.width, self.height)
end,
@@ -265,15 +263,13 @@ Flip Y axis: %b
self.obj:apply_config { zoom = self.obj.extra.zoom + (delta / 10) }
local nx, ny = self:img2canvas(ox, oy)
local dx, dy = ox - nx, oy - ny
--- dtable({opx = opx, opy = opy, dx = dx, dy = dy, nx = opx - dx, ny = opy - dy}, "params")
--- self.posx, self.posy = opx - dx, opy - dy
+ self.posx, self.posy = -opx - dx, -opy - dy
self:resize_cb(self.width, self.height)
end,
motion_cb = function (self, x, y)
local ox, oy = self:canvas2img(x, y)
local nx, ny = self:img2canvas(ox, oy)
--- dtable({x = x, y = y, ox = ox, oy = oy, nx = nx, ny = ny}, "params")
end,
create = function (d, tab, settings)