Skip to content

Commit

Permalink
Map: set globe projection for all styles (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbycz authored Feb 1, 2025
1 parent 9e943f3 commit e513a43
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
9 changes: 0 additions & 9 deletions src/components/Map/behaviour/useInitMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ const filterConsoleLog = () => {
// });
// };

const defaultProjection = {
type: 'globe',
};

export const useInitMap = () => {
const mapRef = React.useRef(null);
const [mapInState, setMapInState] = React.useState(null);
Expand All @@ -64,11 +60,6 @@ export const useInitMap = () => {
});
setGlobalMap(map);
setMapInState(map);

map.on('style.load', () => {
map.setProjection(defaultProjection);
});

map.scrollZoom.setWheelZoomRate(1 / 200); // 1/450 is default, bigger value = faster

return () => {
Expand Down
1 change: 1 addition & 0 deletions src/components/Map/behaviour/useUpdateStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const useUpdateStyle = createMapEffectHook(

const style = cloneDeep(getBaseStyle(key, currentTheme));
addOverlaysToStyle(map, style, overlays, currentTheme);
style.projection = { type: 'globe' };
map.setStyle(style, { diff: mapLoaded });

const languageControl = new OpenMapTilesLanguage({
Expand Down

0 comments on commit e513a43

Please sign in to comment.