diff options
author | Pixel <pixel@nobis-crew.org> | 2009-12-15 14:09:53 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2009-12-15 14:09:53 -0800 |
commit | 6d93362ebb4def3109d194818b2ab5c0081805ad (patch) | |
tree | 0d1b4eda39058ec943d4d8378b8e67cd4a6bbf02 | |
parent | ee3cefaba5a2e5225ebbba855ecdcf1c668037de (diff) |
Fixing panning.
-rw-r--r-- | dalos.lua | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -33,8 +33,8 @@ dalosp.canvas = { findobj = function (self, x, y) local obj, ind - x = x + 0 - y = y + 0 + x = x - self.origin.x + y = y - self.origin.y for k, v in ipairs(self.objects) do if v.x <= x and (v.x + v.w) >= x and v.y <= y and (v.y + v.h) >= y then @@ -66,12 +66,11 @@ dalosp.canvas = { motion_cb = function (self, x, y, status) if self.stateful.panning then - print "Panning..." local ox, oy = self.ox, self.oy local dx, dy = x - ox, y - oy self:panning(dx, dy) self.ox, self.oy = x, y - elseif iup.isbutton1(status) then + elseif self.stateful.leftbutton then if self.stateful.leftclk and not self.stateful.linking then self.stateful.linking = self.stateful.leftclk end local linking = self.stateful.linking if linking then @@ -79,7 +78,7 @@ dalosp.canvas = { else -- start selection square ? end - elseif iup.isbutton3(status) then + elseif self.stateful.rghtbutton then if self.stateful.rghtclk and not self.stateful.moving then self.stateful.moving = self.stateful.rghtclk end local moving = self.stateful.moving if moving then @@ -97,7 +96,7 @@ dalosp.canvas = { if button == iup.BUTTON1 or not button then if pressed == 1 then self.stateful.leftbutton = true - if self.stateful.rghtclk then + if self.stateful.rghtbutton then self.stateful.panning = true else self.stateful.leftclk = self:findobj(x,y) @@ -118,7 +117,7 @@ dalosp.canvas = { if button == iup.BUTTON3 or not button then if pressed == 1 then self.stateful.rghtbutton = true - if self.stateful.leftclk then + if self.stateful.leftbutton then self.stateful.panning = true else self.stateful.rghtclk = self:findobj(x, y) |