change effects animation calculation

This commit is contained in:
Eduardo Bart
2011-11-07 15:20:13 -02:00
parent 5b1b170165
commit ce67fd1733
11 changed files with 47 additions and 38 deletions

View File

@@ -8,33 +8,36 @@ function scheduleEvent(func, delay)
eventId = eventId + 1
local id = eventId
local function proxyFunc()
if eventsTable[id] then
func()
eventsTable[id] = nil
end
if eventsTable[id] then
func()
eventsTable[id] = nil
end
end
eventsTable[id] = proxyFunc
orig.scheduleEvent(proxyFunc, delay)
return id
end
-- FIXME: the event function can be collected
-- and the dispatcher would call an invalid function, generating an warning
function removeEvent(id)
if id and eventsTable[id] then
eventsTable[id] = nil
return true
end
end
-- fix original addEvent
function addEvent(func)
eventId = eventId + 1
local id = eventId
local function proxyFunc()
if eventsTable[id] then
func()
eventsTable[id] = nil
end
eventId = eventId + 1
local id = eventId
local function proxyFunc()
if eventsTable[id] then
func()
eventsTable[id] = nil
end
eventsTable[id] = proxyFunc
orig.addEvent(proxyFunc)
return id
end
eventsTable[id] = proxyFunc
orig.addEvent(proxyFunc)
return id
end

View File

@@ -2,8 +2,7 @@ CenterLabel < Label
font: verdana-11px-rounded
height: 16
align: center
anchors.top: parent.verticalCenter
anchors.bottom: parent.verticalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right