Skip to content
Snippets Groups Projects
Commit ef2db827 authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@2770 51575b47-30f0-44d4-a5cc-537603b46e54
parent 432313f6
No related branches found
No related tags found
No related merge requests found
......@@ -119,39 +119,39 @@ function _M:generate()
if button == "wheelup" and event == "button" then self.scroll = util.bound(self.scroll - 1, 1, self.max - self.max_display + 1)
elseif button == "wheeldown" and event == "button" then self.scroll = util.bound(self.scroll + 1, 1, self.max - self.max_display + 1) end
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(self.scroll + math.floor(by / self.fh), 1, self.max)
if (self.all_clicks or button == "left") and event == "button" then self:onUse(button) end
end)
self.key:addBinds{
ACCEPT = function() self:onUse() end,
MOVE_UP = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.boundWrap(self.sel - 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
end,
MOVE_DOWN = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.boundWrap(self.sel + 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
end,
}
self.key:addCommands{
_HOME = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = 1
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
end,
_END = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = self.max
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
end,
_PAGEUP = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(self.sel - self.max_display, 1, self.max)
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
end,
_PAGEDOWN = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(self.sel + self.max_display, 1, self.max)
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
end,
......@@ -159,7 +159,7 @@ function _M:generate()
end
function _M:select(i)
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(i, 1, #self.list)
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
end
......
......@@ -188,7 +188,7 @@ function _M:generate()
if button == "wheelup" and event == "button" then self.scroll = util.bound(self.scroll - 1, 1, self.max - self.max_display + 1)
elseif button == "wheeldown" and event == "button" then self.scroll = util.bound(self.scroll + 1, 1, self.max - self.max_display + 1) end
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(self.scroll + math.floor(by / self.fh), 1, self.max)
self:onSelect()
if (self.all_clicks or button == "left") and event == "button" then self:onUse(button, event) end
......@@ -196,35 +196,35 @@ function _M:generate()
self.key:addBinds{
ACCEPT = function() self:onUse("left", "key") end,
MOVE_UP = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.boundWrap(self.sel - 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect()
end,
MOVE_DOWN = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.boundWrap(self.sel + 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect()
end,
}
self.key:addCommands{
_HOME = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = 1
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
self:onSelect()
end,
_END = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = self.max
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
self:onSelect()
end,
_PAGEUP = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(self.sel - self.max_display, 1, self.max)
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
self:onSelect()
end,
_PAGEDOWN = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(self.sel + self.max_display, 1, self.max)
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
self:onSelect()
......
......@@ -203,7 +203,7 @@ function _M:generate()
if button == "wheelup" and event == "button" then self.scroll = util.bound(self.scroll - 1, 1, self.max - self.max_display + 1)
elseif button == "wheeldown" and event == "button" then self.scroll = util.bound(self.scroll + 1, 1, self.max - self.max_display + 1) end
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(self.scroll + math.floor(by / self.fh), 1, self.max)
if self.sel_by_col then
for i = 1, #self.sel_by_col do if bx > (self.sel_by_col[i-1] or 0) and bx <= self.sel_by_col[i] then
......@@ -221,11 +221,11 @@ function _M:generate()
self.key:addBinds{
ACCEPT = function() self:onUse("left") end,
MOVE_UP = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.boundWrap(self.sel - 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect()
end,
MOVE_DOWN = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.boundWrap(self.sel + 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect()
end,
}
......@@ -237,25 +237,25 @@ function _M:generate()
end
self.key:addCommands{
_HOME = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = 1
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
self:onSelect()
end,
_END = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = self.max
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
self:onSelect()
end,
_PAGEUP = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(self.sel - self.max_display, 1, self.max)
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
self:onSelect()
end,
_PAGEDOWN = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.bound(self.sel + self.max_display, 1, self.max)
self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
self:onSelect()
......
......@@ -85,7 +85,7 @@ function _M:generate()
item._stex = ss:glTexture()
self.mouse:registerZone(0, self.h, self.w, fh, function(button, x, y, xrel, yrel, bx, by, event)
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = i
self:onSelect()
if button == "left" and event == "button" then self:onUse() end
......@@ -98,11 +98,11 @@ function _M:generate()
self.key:addBinds{
ACCEPT = function() self:onUse() end,
MOVE_UP = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.boundWrap(self.sel - 1, 1, self.max) self:onSelect()
end,
MOVE_DOWN = function()
if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
self.sel = util.boundWrap(self.sel + 1, 1, self.max) self:onSelect()
end,
}
......
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