Skip to content

Commit

Permalink
Decouple planner buttons using extra ID
Browse files Browse the repository at this point in the history
  • Loading branch information
dodomorandi committed Apr 27, 2020
1 parent 8c1a495 commit e559ef0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions data/pigui/modules/system-view-ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ local function showDvLine(leftIcon, resetIcon, rightIcon, key, Formatter, leftTo
end
end
end
local press = ui.coloredSelectedIconButton(leftIcon, mainButtonSize, false, mainButtonFramePadding, svColor.BUTTON_BACK, svColor.BUTTON_INK, leftTooltip)
local press = ui.coloredSelectedIconButton(leftIcon, mainButtonSize, false, mainButtonFramePadding, svColor.BUTTON_BACK, svColor.BUTTON_INK, leftTooltip, nil, key)
if press or (key ~= "factor" and ui.isItemActive()) then
systemView:TransferPlannerAdd(key, -10)
end
wheel()
ui.sameLine()
if ui.coloredSelectedIconButton(resetIcon, mainButtonSize, false, mainButtonFramePadding, svColor.BUTTON_BACK, svColor.BUTTON_INK, resetTooltip) then
if ui.coloredSelectedIconButton(resetIcon, mainButtonSize, false, mainButtonFramePadding, svColor.BUTTON_BACK, svColor.BUTTON_INK, resetTooltip, nil, key) then
systemView:TransferPlannerReset(key)
end
wheel()
ui.sameLine()
press = ui.coloredSelectedIconButton(rightIcon, mainButtonSize, false, mainButtonFramePadding, svColor.BUTTON_BACK, svColor.BUTTON_INK, rightTooltip)
press = ui.coloredSelectedIconButton(rightIcon, mainButtonSize, false, mainButtonFramePadding, svColor.BUTTON_BACK, svColor.BUTTON_INK, rightTooltip, nil, key)
if press or (key ~= "factor" and ui.isItemActive()) then
systemView:TransferPlannerAdd(key, 10)
end
Expand Down
4 changes: 2 additions & 2 deletions data/pigui/pigui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ ui.coloredSelectedButton = function(label, thesize, is_selected, bg_color, toolt
end
return res
end
ui.coloredSelectedIconButton = function(icon, thesize, is_selected, frame_padding, bg_color, fg_color, tooltip, img_size)
ui.coloredSelectedIconButton = function(icon, thesize, is_selected, frame_padding, bg_color, fg_color, tooltip, img_size, extraID)
if is_selected then
pigui.PushStyleColor("Button", bg_color)
pigui.PushStyleColor("ButtonHovered", bg_color:tint(0.1))
Expand All @@ -824,7 +824,7 @@ ui.coloredSelectedIconButton = function(icon, thesize, is_selected, frame_paddin
pigui.PushStyleColor("ButtonActive", bg_color:shade(0.2))
end
local uv0,uv1 = get_icon_tex_coords(icon)
pigui.PushID(tooltip)
pigui.PushID(tooltip .. (extraID or ""))
local res = pigui.ButtonImageSized(ui.icons_texture, thesize, img_size or Vector2(0,0), uv0, uv1, frame_padding, ui.theme.colors.lightBlueBackground, fg_color)
pigui.PopID()
pigui.PopStyleColor(3)
Expand Down

0 comments on commit e559ef0

Please sign in to comment.