Commit 3d86911b5eaa9ea2e92960805a1d35aec0ba95ac

Authored by Ryan Yappert
1 parent f5a5e849

Now returns properly so a single hotkey can be modified multiple times.

Also brings `frames_colors` into a class property so it can be properly manipulated (e.g. adding new colors).
... ... @@ -129,6 +129,9 @@ local frames_colors = {
129 129 disabled = {0.65, 0.65, 0.65},
130 130 }
131 131
  132 +-- Store it so addons can play with it.
  133 +_M.frames_colors = frames_colors
  134 +
132 135 -- Displays the hotkeys, keybinds & cooldowns
133 136 function _M:display()
134 137 local a = self.actor
... ... @@ -167,7 +170,10 @@ function _M:display()
167 170 y = self.frames.h * row
168 171 self.dragclics[j] = {x,y,w,h}
169 172
170   - self:displayHotkey(page, i, x, y, ts)
  173 + local ind, hktable, cfake = self:displayHotkey(page, i, x, y, ts)
  174 +
  175 + self.items[#self.items+1] = hktable
  176 + self.clics[ind] = {x, y, w, h, fake=cfake}
171 177
172 178 if orient == "down" or orient == "up" then
173 179 col = col + 1
... ... @@ -280,8 +286,10 @@ function _M:displayHotkey(page, i, x, y, ts)
280 286 gtxt.fw, gtxt.fh = self.fontbig:size(txt)
281 287 end
282 288
283   - self.items[#self.items+1] = {i=i, x=x, y=y, e=display_entity or self.default_entity, color=color, angle=angle, key=key, gtxt=gtxt, frame=frame, pagesel=lpage==a.hotkey_page}
284   - self.clics[i] = {x,y,w,h}
  289 + --self.items[#self.items+1] = {i=i, x=x, y=y, e=display_entity or self.default_entity, color=color, angle=angle, key=key, gtxt=gtxt, frame=frame, pagesel=lpage==a.hotkey_page}
  290 + --self.clics[i] = {x,y,w,h}
  291 +
  292 + return i, {i=i, x=x, y=y, e=display_entity or self.default_entity, color=color, angle=angle, key=key, gtxt=gtxt, frame=frame, pagesel=lpage==a.hotkey_page}, nil
285 293 else
286 294 local i = i + (12 * (page - 1))
287 295 local angle = 0
... ... @@ -293,8 +301,9 @@ function _M:displayHotkey(page, i, x, y, ts)
293 301 local key = self.font:draw(ks, self.font:size(ks), colors.ANTIQUE_WHITE.r, colors.ANTIQUE_WHITE.g, colors.ANTIQUE_WHITE.b, true)[1]
294 302 self.font:setStyle("normal")
295 303
296   - self.items[#self.items+1] = {show_on_drag=true, i=i, x=x, y=y, e=nil, color=color, angle=angle, key=key, gtxt=nil, frame=frame}
297   - self.clics[i] = {x,y,w,h, fake=true}
  304 + --self.items[#self.items+1] = {show_on_drag=true, i=i, x=x, y=y, e=nil, color=color, angle=angle, key=key, gtxt=nil, frame=frame}
  305 + --self.clics[i] = {x,y,w,h, fake=true}
  306 + return i, {show_on_drag=true, i=i, x=x, y=y, e=nil, color=color, angle=angle, key=key, gtxt=nil, frame=frame}, true
298 307 end
299 308 end
300 309
... ... @@ -308,7 +317,7 @@ function _M:toScreen()
308 317 if not item.show_on_drag or (game.mouse and game.mouse.drag) and self.cur_sel then
309 318 local key = item.key
310 319 local gtxt = item.gtxt
311   - local frame = frames_colors[item.frame]
  320 + local frame = self.frames_colors[item.frame]
312 321 local pagesel = item.pagesel and 1 or 0.5
313 322
314 323 if item.e then item.e:toScreen(self.tiles, self.display_x + item.x + self.frames.fx, self.display_y + item.y + self.frames.fy, self.icon_w, self.icon_h) end
... ...