Commit 07d26fcd2a9dc6b00f02766db2a7f8983192c1a0
1 parent
26d3cc54
Right click map menu can not go over the bottom of the screen
git-svn-id: http://svn.net-core.org/repos/t-engine4@5149 51575b47-30f0-44d4-a5cc-537603b46e54
Showing
1 changed file
with
3 additions
and
2 deletions
... | ... | @@ -36,7 +36,7 @@ function _M:init(mx, my, tmx, tmy, extra) |
36 | 36 | local w = self.font_bold:size(name) |
37 | 37 | engine.ui.Dialog.init(self, name, 1, 100, mx, my) |
38 | 38 | |
39 | - local list = List.new{width=math.max(w, self.max) + 10, nb_items=#self.list, list=self.list, fct=function(item) self:use(item) end, select=function(item) self:select(item) end} | |
39 | + local list = List.new{width=math.max(w, self.max) + 10, nb_items=math.min(15, #self.list), scrollbar=#self.list>15, list=self.list, fct=function(item) self:use(item) end, select=function(item) self:select(item) end} | |
40 | 40 | |
41 | 41 | self:loadUI{ |
42 | 42 | {left=0, top=0, ui=list}, |
... | ... | @@ -44,7 +44,8 @@ function _M:init(mx, my, tmx, tmy, extra) |
44 | 44 | |
45 | 45 | self:setupUI(true, true, function(w, h) |
46 | 46 | self.force_x = mx - w / 2 |
47 | - self.force_y = my - (self.h - self.ih + list.fh / 3) | |
47 | + self.force_y = my - self.h + (self.ih + list.fh / 3) | |
48 | + if self.force_y + h > game.h then self.force_y = game.h - h end | |
48 | 49 | end) |
49 | 50 | |
50 | 51 | self.mouse:reset() | ... | ... |
-
Please register or login to post a comment