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

Move tooltips in inventory and stores to not obstruct the list currently being watched

git-svn-id: http://svn.net-core.org/repos/t-engine4@4873 51575b47-30f0-44d4-a5cc-537603b46e54
parent 66cd0d04
No related branches found
No related tags found
No related merge requests found
......@@ -283,6 +283,9 @@ function _M:selectColumn(i, force, reverse)
end
function _M:display(x, y, nb_keyframes, screen_x, screen_y)
self.last_display_x = screen_x
self.last_display_y = screen_y
local bx, by = x, y
if self.sel then
local item = self.list[self.sel]
......
......@@ -37,7 +37,11 @@ function _M:init(title, actor, filter, action, on_select)
-- Add tooltips
self.on_select = function(item)
if item.last_display_x and item.object then
game:tooltipDisplayAtMap(item.last_display_x, item.last_display_y, item.object:getDesc({do_color=true}, self.actor:getInven(item.object:wornInven())))
local x = nil
if self.focus_ui and self.focus_ui.ui == self.c_inven then
x = self.c_inven._last_ox - game.tooltip.max
end
game:tooltipDisplayAtMap(x or item.last_display_x, item.last_display_y, item.object:getDesc({do_color=true}, self.actor:getInven(item.object:wornInven())))
elseif item.last_display_x and item.data and item.data.desc then
game:tooltipDisplayAtMap(item.last_display_x, item.last_display_y, item.data.desc, {up=true})
end
......
......@@ -87,7 +87,13 @@ function _M:init(title, store_inven, actor_inven, store_filter, actor_filter, ac
-- Add tooltips
self.on_select = function(item)
if item.last_display_x and item.object then
game:tooltipDisplayAtMap(item.last_display_x, item.last_display_y, item.object:getDesc({do_color=true}, game.player:getInven(item.object:wornInven())))
local x = nil
if self.focus_ui and self.focus_ui.ui == self.c_store then
x = self.c_store._last_ox + self.c_store.w
elseif self.focus_ui and self.focus_ui.ui == self.c_inven then
x = self.c_inven._last_ox - game.tooltip.max
end
game:tooltipDisplayAtMap(x or item.last_display_x, item.last_display_y, item.object:getDesc({do_color=true}, game.player:getInven(item.object:wornInven())))
end
end
self.key.any_key = function(sym)
......
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