Skip to content
Snippets Groups Projects
Commit 9e711139 authored by DarkGod's avatar DarkGod
Browse files

fixed mouse drag

parent 7932993d
No related branches found
No related tags found
No related merge requests found
......@@ -92,6 +92,7 @@ function _M:delegate(button, mx, my, xrel, yrel, bx, by, event, name, extra)
my = my - oy
if event == "button" then self:receiveMouse(button, mx, my, true, name, extra)
elseif event == "button-down" then self:receiveMouse(button, mx, my, false, name, extra)
elseif event == "motion" then self:receiveMouseMotion(button, mx, my, xrel, yrel, name, extra)
end
end
......
......@@ -317,6 +317,7 @@ function _M:generate()
self:updateTitle(self.title)
self.mouse:allowDownEvent(true)
if self.absolute then
self.mouse:registerZone(0, 0, gamew, gameh, function(button, x, y, xrel, yrel, bx, by, event) self:mouseEvent(button, x, y, xrel, yrel, bx - self.display_x, by - self.display_y, event) end)
else
......
......@@ -34,6 +34,7 @@ function _M:init(t)
self.never_clean = t.never_clean
self.allow_popup = t.allow_popup
self.allow_login = t.allow_login
if self.allow_login == nil then self.allow_login = true end
if self.allow_login and self.url:find("^http://te4%.org/") and profile.auth then
local param = "_te4ah="..profile.auth.hash.."&_te4ad="..profile.auth.drupid
......@@ -80,14 +81,15 @@ function _M:generate()
end
self.loading_icon = self:getUITexture("ui/waiter/loading.png")
self.mouse:allowDownEvent(true)
self.mouse:registerZone(0, 0, self.w, self.h, function(button, x, y, xrel, yrel, bx, by, event)
if not self.view then return end
if event == "button" then
if button == "wheelup" then self.scroll_inertia = math.min(self.scroll_inertia, 0) - 5
elseif button == "wheeldown" then self.scroll_inertia = math.max(self.scroll_inertia, 0) + 5
elseif button == "left" then self.view:injectMouseButton(false, 1) self.view:injectMouseButton(true, 1)
elseif button == "middle" then self.view:injectMouseButton(false, 2) self.view:injectMouseButton(true, 2)
elseif button == "right" then self.view:injectMouseButton(false, 3) self.view:injectMouseButton(true, 3)
elseif button == "left" then self.view:injectMouseButton(true, 1)
elseif button == "middle" then self.view:injectMouseButton(true, 2)
elseif button == "right" then self.view:injectMouseButton(true, 3)
end
elseif event == "button-down" then
if button == "wheelup" then self.scroll_inertia = math.min(self.scroll_inertia, 0) - 5
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment