mirror of https://github.com/kepler155c/opus
fix slideout
This commit is contained in:
parent
743959c1fa
commit
0830e46fb8
|
@ -870,7 +870,9 @@ end
|
||||||
|
|
||||||
function UI.Window:addLayer(bg, fg)
|
function UI.Window:addLayer(bg, fg)
|
||||||
local canvas = self:getCanvas()
|
local canvas = self:getCanvas()
|
||||||
return canvas:addLayer(self, bg, fg)
|
canvas = canvas:addLayer(self, bg, fg)
|
||||||
|
canvas:clear(bg or self.backgroundColor, fg or self.textColor)
|
||||||
|
return canvas
|
||||||
end
|
end
|
||||||
|
|
||||||
function UI.Window:addTransition(effect, args)
|
function UI.Window:addTransition(effect, args)
|
||||||
|
@ -2377,13 +2379,33 @@ function UI.SlideOut:show()
|
||||||
self:focusFirst()
|
self:focusFirst()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function UI.SlideOut:disable()
|
||||||
|
self.canvas:setVisible(false)
|
||||||
|
self.enabled = false
|
||||||
|
if self.children then
|
||||||
|
for _,child in pairs(self.children) do
|
||||||
|
child:disable()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function UI.SlideOut:hide()
|
function UI.SlideOut:hide()
|
||||||
self:disable()
|
self:disable()
|
||||||
self.canvas:setVisible(false)
|
|
||||||
self:release(self)
|
self:release(self)
|
||||||
self:refocus()
|
self:refocus()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function UI.SlideOut:eventHandler(event)
|
||||||
|
if event.type == 'slide_show' then
|
||||||
|
self:show()
|
||||||
|
return true
|
||||||
|
|
||||||
|
elseif event.type == 'slide_hide' then
|
||||||
|
self:hide()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--[[-- Notification --]]--
|
--[[-- Notification --]]--
|
||||||
UI.Notification = class(UI.Window)
|
UI.Notification = class(UI.Window)
|
||||||
UI.Notification.defaults = {
|
UI.Notification.defaults = {
|
||||||
|
|
|
@ -252,7 +252,7 @@ end
|
||||||
function Util.filter(it, f)
|
function Util.filter(it, f)
|
||||||
local ot = { }
|
local ot = { }
|
||||||
for k,v in pairs(it) do
|
for k,v in pairs(it) do
|
||||||
if f(k, v) then
|
if f(v) then
|
||||||
ot[k] = v
|
ot[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -458,9 +458,9 @@ end
|
||||||
--[[ String functions ]] --
|
--[[ String functions ]] --
|
||||||
function Util.toBytes(n)
|
function Util.toBytes(n)
|
||||||
if n >= 1000000 or n <= -1000000 then
|
if n >= 1000000 or n <= -1000000 then
|
||||||
return string.format('%sM', Util.round(n/1000000, 1))
|
return string.format('%sM', math.floor(n/1000000 * 10) / 10)
|
||||||
elseif n >= 1000 or n <= -1000 then
|
elseif n >= 1000 or n <= -1000 then
|
||||||
return string.format('%sK', Util.round(n/1000, 1))
|
return string.format('%sK', math.floor(n/1000 * 10) / 10)
|
||||||
end
|
end
|
||||||
return tostring(n)
|
return tostring(n)
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,7 +53,7 @@ local function loadApplications()
|
||||||
end
|
end
|
||||||
|
|
||||||
Util.each(applications, function(v, k) v.key = k end)
|
Util.each(applications, function(v, k) v.key = k end)
|
||||||
applications = Util.filter(applications, function(_, a)
|
applications = Util.filter(applications, function(a)
|
||||||
if a.disabled then
|
if a.disabled then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue