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

Fixed scrolling in the levelup dialog

git-svn-id: http://svn.net-core.org/repos/t-engine4@5768 51575b47-30f0-44d4-a5cc-537603b46e54
parent f066561a
No related branches found
No related tags found
No related merge requests found
......@@ -890,7 +890,7 @@ function _M:onUseTalent(item, inc)
self:learnType(item.type, inc)
item.shown = (self.actor.__hidden_talent_types[item.type] == nil and self.actor:knowTalentType(item.type)) or (self.actor.__hidden_talent_types[item.type] ~= nil and not self.actor.__hidden_talent_types[item.type])
local t = (item.isgeneric==0 and self.c_gtree or self.c_ctree)
if not inc then t:onExpand(item, inc) end
item.shown = not item.shown t:onExpand(item, inc)
t:redrawAllItems()
elseif item.talent then
self:learnTalent(item.talent, inc)
......
......@@ -224,6 +224,11 @@ function _M:moveSel(i, j)
end
end
for i = 1, #self.mousezones do
local mz = self.mousezones[i]
if mz.item == match then self.last_mz = mz break end
end
if self.scrollbar and self.last_input_was_keyboard then
local pos = 0
for i = 1, #self.tree do
......@@ -232,9 +237,11 @@ function _M:moveSel(i, j)
-- we've reached selected row
if self.sel_i == i then
-- check if it was visible if not go scroll over there
print("<====", pos, tree.h, self.scrollbar.pos, self.scrollbar.max, self.h)
if pos - tree.h < self.scrollbar.pos then self.scrollbar.pos = util.minBound(pos - tree.h, 0, self.scrollbar.max)
elseif pos > self.scrollbar.pos + self.h then self.scrollbar.pos = util.minBound(pos - self.h, 0, self.scrollbar.max)
end
print("====>", pos, tree.h, self.scrollbar.pos, self.scrollbar.max, self.h)
break
end
end
......
......@@ -427,10 +427,13 @@ static int particles_emit(lua_State *L)
lua_pushnumber(L, l->generator_ref);
lua_rawget(L, -2);
if (lua_isnil(L, -1)) { printf("Particle emitter error %x (%d) is nil\n", (int)l, l->generator_ref); }
else if (lua_pcall(L, 0, 1, 0))
{
printf("Particle emitter error %x (%d): %s\n", (int)l, l->generator_ref, lua_tostring(L, -1));
lua_pop(L, 1);
else {
lua_pushnumber(L, i);
if (lua_pcall(L, 1, 1, 0))
{
printf("Particle emitter error %x (%d): %s\n", (int)l, l->generator_ref, lua_tostring(L, -1));
lua_pop(L, 1);
}
}
if (!lua_isnil(L, -1))
{
......
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