Skip to content

Commit

Permalink
refactor: move and rearrange "edge buttons" in map views
Browse files Browse the repository at this point in the history
Move the edge buttons to the top-right of the display, so all icons
remain in a fixed location irrespective of how many buttons there are.
This makes it easier to learn muscle-memory.

Also, rearrange the icons so that all 3 map views have the same list of
buttons from the top down, with any map-specific buttons following the
"Info" button.

Finally, remove the superfluous edge button to switch between System Map
and System Overview - they already exist on the top button bar.
  • Loading branch information
mwerle committed Sep 30, 2024
1 parent d740e42 commit c666827
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
16 changes: 3 additions & 13 deletions data/pigui/modules/system-view-ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ end

function Windows.edgeButtons.Show()
local isOrrery = systemView:GetDisplayMode() == "Orrery"
-- view control buttons
if ui.mainMenuButton(icons.reset_view, luc.RESET_ORIENTATION_AND_ZOOM) then
systemView:SetVisibility("RESET_VIEW")
end
Expand All @@ -279,13 +278,9 @@ function Windows.edgeButtons.Show()
ui.mainMenuButton(icons.search_lens, luc.ZOOM)
systemView:SetZoomMode(ui.isItemActive())

if isOrrery and ui.mainMenuButton(icons.system_overview, luc.HUD_BUTTON_SWITCH_TO_SYSTEM_OVERVIEW) then
systemView:SetDisplayMode('Atlas')
end
if not isOrrery and ui.mainMenuButton(icons.system_map, luc.HUD_BUTTON_SWITCH_TO_SYSTEM_MAP) then
systemView:SetDisplayMode('Orrery')
end
ui.newLine()

drawWindowControlButton(Windows.objectInfo, icons.info, lc.OBJECT_INFO)
-- visibility control buttons
if isOrrery then
if ui.mainMenuButton(buttonState[ship_drawing].icon, lc.SHIPS_DISPLAY_MODE_TOGGLE, buttonState[ship_drawing].state) then
Expand All @@ -300,11 +295,6 @@ function Windows.edgeButtons.Show()
show_grid = nextShowGrid[show_grid]
systemView:SetVisibility(show_grid)
end
ui.newLine()
end

drawWindowControlButton(Windows.objectInfo, icons.info, lc.OBJECT_INFO)
if isOrrery then
drawWindowControlButton(Windows.orbitPlanner, icons.semi_major_axis, lc.ORBIT_PLANNER)
end
end
Expand Down Expand Up @@ -867,7 +857,7 @@ end

function systemViewLayout:onUpdateWindowPivots(w)
w.systemName.anchors = { ui.anchor.center, ui.anchor.top }
w.edgeButtons.anchors = { ui.anchor.right, ui.anchor.center }
w.edgeButtons.anchors = { ui.anchor.right, ui.anchor.top }
w.timeButtons.anchors = { ui.anchor.right, ui.anchor.bottom }
w.orbitPlanner.anchors = { ui.anchor.right, ui.anchor.bottom }
w.objectInfo.anchors = { ui.anchor.right, ui.anchor.bottom }
Expand Down
10 changes: 6 additions & 4 deletions data/pigui/views/map-sector-view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ function Windows.edgeButtons.Show()
ui.mainMenuButton(icons.search_lens, lui.ZOOM)
sectorView:GetMap():SetZoomMode(ui.isItemActive())
ui.text("")

if ui.mainMenuButton(icons.info, lc.OBJECT_INFO, buttonState[Windows.systemInfo.visible]) then
Windows.systemInfo.visible = not Windows.systemInfo.visible
end
-- settings buttons
if ui.mainMenuButton(icons.settings, lui.SETTINGS) then
ui.openPopup("sectorViewLabelSettings")
Expand All @@ -310,9 +314,6 @@ function Windows.edgeButtons.Show()
if ui.mainMenuButton(icons.shield_other, lui.FACTIONS, buttonState[Windows.factions.visible]) then
Windows.factions.visible = not Windows.factions.visible
end
if ui.mainMenuButton(icons.info, lc.OBJECT_INFO, buttonState[Windows.systemInfo.visible]) then
Windows.systemInfo.visible = not Windows.systemInfo.visible
end
if ui.mainMenuButton(icons.route, lui.HYPERJUMP_ROUTE, buttonState[Windows.hjPlanner.visible]) then
Windows.hjPlanner.visible = not Windows.hjPlanner.visible
end
Expand Down Expand Up @@ -424,7 +425,7 @@ Windows.hjPlanner.Dummy = hyperJumpPlanner.Dummy
function sectorViewLayout:onUpdateWindowPivots(w)
w.hjPlanner.anchors = { ui.anchor.right, ui.anchor.bottom }
w.systemInfo.anchors = { ui.anchor.right, ui.anchor.bottom }
w.edgeButtons.anchors = { ui.anchor.right, ui.anchor.center }
w.edgeButtons.anchors = { ui.anchor.right, ui.anchor.top }
w.factions.anchors = { ui.anchor.right, ui.anchor.top }
end

Expand Down Expand Up @@ -465,6 +466,7 @@ ui.registerModule("game", { id = 'map-sector-view', draw = function()

if ui.ctrlHeld() and ui.isKeyReleased(ui.keys.delete) then
systemEconView = package.reimport('pigui.modules.system-econ-view').New()
package.reimport()
end
end
end})
Expand Down

0 comments on commit c666827

Please sign in to comment.