Skip to content

Commit

Permalink
feat(map): add moon scale and star scale settings for system maps
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMakesGames committed Oct 27, 2024
1 parent 6226fe2 commit ef0cce6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/renderer/src/intl/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ export default {
legendBackgroundColor: 'Background Color',
systemMapOrbitStroke: 'Orbit Lines',
systemMapOrbitColor: 'Orbit Lines Color',
systemMapStarScale: 'Star Scale',
systemMapPlanetScale: 'Planet Scale',
systemMapMoonScale: 'Moon Scale',
systemMapPlanetRingColor: 'Planet Ring Color',
systemMapLabelPlanetsFont: 'Planet Name Font',
systemMapLabelPlanetsFontSize: 'Planet Name Font Size',
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/src/lib/map/solarSystemMap/SolarSystemMap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@
function getPlanetRadius(planet: Planet, settings: MapSettings) {
return Math.sqrt(
planet.planet_size *
(settings.systemMapPlanetScale ?? 1) *
(isStar(planet) ? 2 : 1) *
(isMoon(planet) ? 0.5 : 1),
(!isMoon(planet) && !isStar(planet) ? settings.systemMapPlanetScale ?? 1 : 1) *
(isStar(planet) ? settings.systemMapStarScale ?? 1 : 1) *
(isMoon(planet) ? settings.systemMapMoonScale ?? 1 : 1),
);
}
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/src/lib/settings/mapSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export type NumberOptionalMapSettings =
| 'claimVoidMaxSize'
| 'frontierBubbleThreshold'
| 'starScapeStarsCount'
| 'systemMapPlanetScale';
| 'systemMapMoonScale'
| 'systemMapPlanetScale'
| 'systemMapStarScale';

export type StringMapSettings =
| 'countryNamesFont'
Expand Down Expand Up @@ -448,7 +450,9 @@ export const defaultMapSettings: MapSettings = {
smoothing: false,
width: 0.5,
},
systemMapStarScale: 2,
systemMapPlanetScale: 1,
systemMapMoonScale: 0.5,
systemMapLabelPlanetsFont: 'Orbitron',
systemMapLabelPlanetsFontSize: 10,
systemMapLabelPlanetsPosition: 'right',
Expand Down
14 changes: 14 additions & 0 deletions src/renderer/src/lib/settings/mapSettingsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,27 @@ export const mapSettingsConfig: MapSettingConfigGroup[] = [
allowedDynamicColors: [],
hideIf: (settings) => !settings.systemMapOrbitStroke.enabled,
},
{
id: 'systemMapStarScale',
type: 'number',
optional: true,
min: 0,
step: 0.1,
},
{
id: 'systemMapPlanetScale',
type: 'number',
optional: true,
min: 0,
step: 0.1,
},
{
id: 'systemMapMoonScale',
type: 'number',
optional: true,
min: 0,
step: 0.1,
},
{
id: 'systemMapPlanetRingColor',
type: 'color',
Expand Down

0 comments on commit ef0cce6

Please sign in to comment.