Skip to content

Commit

Permalink
manipulator: Make 'edit' menu recognize mouse clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
lethosor committed May 16, 2015
1 parent c984403 commit 79d6bc1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion manipulator/gui/batch_ops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ function batch_ops:onInput(keys)
self:callback(self.options[self.sel_idx][2])()
elseif keys.CURSOR_UP or keys.CURSOR_DOWN then
self.sel_idx = scroll_index(self.sel_idx, keys.CURSOR_UP and -1 or 1, 1, #self.options)
elseif keys._MOUSE_L then
local mx = gps.mouse_x
local my = gps.mouse_y
local startx = self.frame_inset + 1
local starty = self.frame_inset + 3
if my >= starty and my < starty + #self.options then
local sel_idx = my - starty + 1
if mx >= startx and mx < startx + #self.options[sel_idx][1] then
self.sel_idx = sel_idx
self:onInput{SELECT = true}
end
end
end
end

Expand Down Expand Up @@ -154,7 +166,7 @@ function name_editor:onRenderBody(p)
local entry = self.entry
draw_names(self.units)
p:seek(0, 2):string('Custom ' .. self.name_desc .. ':')
p:newline(2)
p:newline()
if #entry > max_width then
entry = entry:sub(-max_width)
p:seek(-1):string('<', COLOR_LIGHTCYAN)
Expand Down

0 comments on commit 79d6bc1

Please sign in to comment.