feat: add default size for icon and en trasnlate for secondary name when ru language is selected

This commit is contained in:
2026-04-05 14:24:29 +03:00
parent dd5aee58e6
commit a182a52111
4 changed files with 83 additions and 23 deletions

View File

@@ -44,6 +44,7 @@ const MapDataContext = createContext<{
) => void;
setSightIconSize: (sightId: number, size: number) => void;
setFontSize: (size: number) => void;
setRouteIconSize: (size: number) => void;
saveChanges: () => void;
}>({
originalRouteData: undefined,
@@ -67,6 +68,7 @@ const MapDataContext = createContext<{
setSightCoordinates: () => {},
setSightIconSize: () => {},
setFontSize: () => {},
setRouteIconSize: () => {},
saveChanges: () => {},
});
@@ -180,6 +182,16 @@ export const MapDataProvider = observer(
});
}
function setRouteIconSize(size: number) {
const clamped = Math.max(1, Math.min(300, size));
setRouteChanges((prev) => {
if (prev.icon_size === clamped) {
return prev;
}
return { ...prev, icon_size: clamped };
});
}
function setMapCenter(latitude: number, longitude: number) {
const epsilon = 1e-6;
@@ -579,6 +591,7 @@ export const MapDataProvider = observer(
setSightCoordinates,
setSightIconSize,
setFontSize,
setRouteIconSize,
}),
[
originalRouteData,
@@ -594,6 +607,7 @@ export const MapDataProvider = observer(
setStationIconSize,
setSightIconSize,
setFontSize,
setRouteIconSize,
]
);