Skip to content

Commit

Permalink
Change location of the new 'map centering' section
Browse files Browse the repository at this point in the history
  • Loading branch information
mthh committed Sep 4, 2024
1 parent e2433ac commit 20b9d4c
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 38 deletions.
38 changes: 1 addition & 37 deletions src/components/LeftMenu/LayoutFeatures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ import {
makeDefaultGraticule,
makeDefaultSphere,
} from '../../helpers/layers';
import {
Mabs, Msqrt,
parseEnRepresentation, toPrecisionAfterDecimalPoint,
} from '../../helpers/math';
import { Mabs, Msqrt } from '../../helpers/math';
import { getTargetSvg } from '../../helpers/svg';
import {
addTemporaryPoint,
Expand Down Expand Up @@ -79,7 +76,6 @@ import {
ScaleBarBehavior, ScaleBarStyle,
ScaleBarMeasureLocation,
} from '../../global.d';
import DetailsSummary from '../DetailsSummary.tsx';

const makeDrawingInstructions = (
LL: Accessor<TranslationFunctions>,
Expand Down Expand Up @@ -1066,37 +1062,5 @@ export default function LayoutFeatures(): JSX.Element {
</button>
</div>
</div>
<DetailsSummary summaryContent={'Centrage de la carte'} initialOpen={false}>
<InputFieldNumber
label={'Centrage de la carte (x)'}
value={parseEnRepresentation(toPrecisionAfterDecimalPoint(mapStore.translate[0], 2, 'en'))}
onChange={(v) => {
setMapStore('translate', [v, mapStore.translate[1]]);
}}
min={-Infinity}
max={Infinity}
step={1}
/>
<InputFieldNumber
label={'Centrage de la carte (y)'}
value={parseEnRepresentation(toPrecisionAfterDecimalPoint(mapStore.translate[1], 2, 'en'))}
onChange={(v) => {
setMapStore('translate', [mapStore.translate[0], v]);
}}
min={-Infinity}
max={Infinity}
step={1}
/>
<InputFieldNumber
label={'Zoom de la carte'}
value={parseEnRepresentation(toPrecisionAfterDecimalPoint(mapStore.scale, 2, 'en'))}
onChange={(v) => {
setMapStore('scale', v);
}}
min={-Infinity}
max={Infinity}
step={1}
/>
</DetailsSummary>
</div>;
}
36 changes: 35 additions & 1 deletion src/components/LeftMenu/MapConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { JSX, Show } from 'solid-js';

// Helpers
import { useI18nContext } from '../../i18n/i18n-solid';
import { parseEnRepresentation, toPrecisionAfterDecimalPoint } from '../../helpers/math';

// Stores
import { globalStore } from '../../store/GlobalStore';
Expand All @@ -12,6 +13,7 @@ import { mapStore, setMapStore } from '../../store/MapStore';
import InputFieldCheckbox from '../Inputs/InputCheckbox.tsx';
import InputFieldNumber from '../Inputs/InputNumber.tsx';
import InputFieldColor from '../Inputs/InputColor.tsx';
import DetailsSummary from '../DetailsSummary.tsx';

export default function MapConfiguration(): JSX.Element {
const { LL } = useI18nContext();
Expand Down Expand Up @@ -74,7 +76,7 @@ export default function MapConfiguration(): JSX.Element {
});
}}
/>
<div>
<div class={'mb-5'}>
<label class="label">{LL().LayoutFeatures.MapMargins()}</label>
<div>
<div class="is-flex is-justify-content-space-around">
Expand Down Expand Up @@ -156,5 +158,37 @@ export default function MapConfiguration(): JSX.Element {
</Show>
</div>
</div>
<DetailsSummary summaryContent={'Centrage de la carte'} initialOpen={false}>
<InputFieldNumber
label={LL().MapConfiguration.MapCenterX()}
value={parseEnRepresentation(toPrecisionAfterDecimalPoint(mapStore.translate[0], 2, 'en'))}
onChange={(v) => {
setMapStore('translate', [v, mapStore.translate[1]]);
}}
min={-Infinity}
max={Infinity}
step={1}
/>
<InputFieldNumber
label={LL().MapConfiguration.MapCenterY()}
value={parseEnRepresentation(toPrecisionAfterDecimalPoint(mapStore.translate[1], 2, 'en'))}
onChange={(v) => {
setMapStore('translate', [mapStore.translate[0], v]);
}}
min={-Infinity}
max={Infinity}
step={1}
/>
<InputFieldNumber
label={LL().MapConfiguration.ZoomFactor()}
value={parseEnRepresentation(toPrecisionAfterDecimalPoint(mapStore.scale, 2, 'en'))}
onChange={(v) => {
setMapStore('scale', v);
}}
min={-Infinity}
max={Infinity}
step={1}
/>
</DetailsSummary>
</div>;
}
4 changes: 4 additions & 0 deletions src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,10 @@ const en = {
ProjectionCenterGamma: 'γ-axis rotation',
StandardParallel: 'Standard parallel',
StandardParallels: 'Standard parallels',
MapCentering: 'Map centering',
MapCenterX: 'Map center (x)',
MapCenterY: 'Map center (y)',
ZoomFactor: 'Zoom factor',
},
LayoutFeatures: {
BackgroundColor: 'Background color',
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/fr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,10 @@ const fr = {
ProjectionCenterGamma: 'Rotation de l\'axe γ',
StandardParallel: 'Parallèle standard',
StandardParallels: 'Parallèles standards',
MapCentering: 'Centrage de la carte',
MapCenterX: 'Centrage de la carte (x)',
MapCenterY: 'Centrage de la carte (y)',
ZoomFactor: 'Zoom de la carte',
},
LayoutFeatures: {
BackgroundColor: 'Couleur de fond',
Expand Down
32 changes: 32 additions & 0 deletions src/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,22 @@ type RootTranslation = {
* S​t​a​n​d​a​r​d​ ​p​a​r​a​l​l​e​l​s
*/
StandardParallels: string
/**
* M​a​p​ ​c​e​n​t​e​r​i​n​g
*/
MapCentering: string
/**
* M​a​p​ ​c​e​n​t​e​r​ ​(​x​)
*/
MapCenterX: string
/**
* M​a​p​ ​c​e​n​t​e​r​ ​(​y​)
*/
MapCenterY: string
/**
* Z​o​o​m​ ​f​a​c​t​o​r
*/
ZoomFactor: string
}
LayoutFeatures: {
/**
Expand Down Expand Up @@ -5709,6 +5725,22 @@ export type TranslationFunctions = {
* Standard parallels
*/
StandardParallels: () => LocalizedString
/**
* Map centering
*/
MapCentering: () => LocalizedString
/**
* Map center (x)
*/
MapCenterX: () => LocalizedString
/**
* Map center (y)
*/
MapCenterY: () => LocalizedString
/**
* Zoom factor
*/
ZoomFactor: () => LocalizedString
}
LayoutFeatures: {
/**
Expand Down

0 comments on commit 20b9d4c

Please sign in to comment.