From 69836d15333d9d48aecf3e0aef139c7eacf59214 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 5 Jan 2010 10:14:38 -0800 Subject: Somehow fixed the zoom. Still not optimal though. --- dalos-framebuffer.lua | 8 ++------ 1 file 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) -- cgit v1.2.3