1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-15 13:14:49 +00:00
opus/sys/apis/ui/components/SlideOut.lua

53 lines
955 B
Lua
Raw Normal View History

2019-02-06 04:03:57 +00:00
local class = require('class')
local UI = require('ui')
--[[-- SlideOut --]]--
UI.SlideOut = class(UI.Window)
UI.SlideOut.defaults = {
UIElement = 'SlideOut',
pageType = 'modal',
}
2019-02-09 00:21:20 +00:00
function UI.SlideOut:layout()
UI.Window.layout(self)
if not self.canvas then
self.canvas = self:addLayer()
else
self.canvas:resize(self.width, self.height)
end
2019-02-06 04:03:57 +00:00
end
function UI.SlideOut:enable()
end
function UI.SlideOut:show(...)
self:addTransition('expandUp')
self.canvas:raise()
self.canvas:setVisible(true)
UI.Window.enable(self, ...)
self:draw()
self:capture(self)
self:focusFirst()
end
function UI.SlideOut:disable()
self.canvas:setVisible(false)
UI.Window.disable(self)
end
function UI.SlideOut:hide()
self:disable()
self:release(self)
self:refocus()
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