summaryrefslogtreecommitdiff
path: root/dalos.lua
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-12-15 14:09:53 -0800
committerPixel <pixel@nobis-crew.org>2009-12-15 14:09:53 -0800
commit6d93362ebb4def3109d194818b2ab5c0081805ad (patch)
tree0d1b4eda39058ec943d4d8378b8e67cd4a6bbf02 /dalos.lua
parentee3cefaba5a2e5225ebbba855ecdcf1c668037de (diff)
Fixing panning.
Diffstat (limited to 'dalos.lua')
-rw-r--r--dalos.lua13
1 files changed, 6 insertions, 7 deletions
diff --git a/dalos.lua b/dalos.lua
index b7f58a0..5f153bc 100644
--- a/dalos.lua
+++ b/dalos.lua
@@ -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)