Skip to content

Commit

Permalink
feat(map,data): add union border color settings, separate from sector…
Browse files Browse the repository at this point in the history
… border color
  • Loading branch information
MichaelMakesGames committed May 10, 2024
1 parent a2e69e6 commit 3447f22
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/renderer/src/intl/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ export default {
sectorBorderStroke: 'Sector Borders',
sectorBorderColor: 'Sector Border Color',
unionBorderStroke: 'Union Borders',
unionBorderColor: 'Union Border Color',
unionMode: 'Union Mode',
unionSubjects: 'Subjects',
unionFederations: 'Federations',
Expand Down
13 changes: 11 additions & 2 deletions src/renderer/src/lib/map/CountryBorders.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
return $mapSettings.sectorBorderStroke.enabled;
}
}
function sortSectorBorders(a: { isUnionBorder: boolean }, b: { isUnionBorder: boolean }) {
return (a.isUnionBorder ? 1 : -1) - (b.isUnionBorder ? 1 : -1);
}
</script>

{#if $mapSettings.borderStroke.enabled}
Expand Down Expand Up @@ -56,7 +60,7 @@
})}
/>
{/if}
{#each border.sectorBorders.filter(filterSectorBorders) as sectorBorder}
{#each border.sectorBorders.filter(filterSectorBorders).sort(sortSectorBorders) as sectorBorder}
<Glow
enabled={sectorBorder.isUnionBorder && $mapSettings.unionBorderStroke.enabled
? $mapSettings.unionBorderStroke.glow
Expand All @@ -76,7 +80,12 @@
mapSettings: $mapSettings,
colors,
countryColors: border,
colorStack: [$mapSettings.sectorBorderColor, $mapSettings.borderFillColor],
colorStack: [
sectorBorder.isUnionBorder && $mapSettings.unionBorderStroke.enabled
? $mapSettings.unionBorderColor
: $mapSettings.sectorBorderColor,
$mapSettings.borderFillColor,
],
})}
fill="none"
/>
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/src/lib/settings/mapSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export type ColorMapSettings =
| 'hyperlaneColor'
| 'hyperRelayColor'
| 'sectorBorderColor'
| 'unionBorderColor'
| 'unownedHyperlaneColor'
| 'unownedHyperRelayColor'
| 'wormholeStrokeColor'
Expand Down Expand Up @@ -258,6 +259,10 @@ export const defaultMapSettings: MapSettings = {
dashed: false,
dashArray: '3 3',
},
unionBorderColor: {
color: 'border',
colorAdjustments: [{ type: 'MIN_CONTRAST', value: 0.25 }],
},
terraIncognita: true,
terraIncognitaPerspectiveCountry: 'player',
terraIncognitaStyle: 'striped',
Expand Down
8 changes: 8 additions & 0 deletions src/renderer/src/lib/settings/mapSettingsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ export const mapSettingsConfig: MapSettingConfigGroup[] = [
!settings.unionMode ||
(settings.unionFederations === 'off' && settings.unionSubjects === 'off'),
},
{
id: 'unionBorderColor',
type: 'color',
hideIf: (settings) =>
!settings.unionBorderStroke.enabled ||
!settings.unionMode ||
(settings.unionFederations === 'off' && settings.unionSubjects === 'off'),
},
],
},
{
Expand Down

0 comments on commit 3447f22

Please sign in to comment.