Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple planner buttons #4868

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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