Skip to content

Commit

Permalink
Ensure labels and boundaries are applied to both maps
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfdsilva committed Sep 18, 2023
1 parent e1cbdd5 commit 8322abf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/scripts/components/common/map/map-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ProjectionOptions } from 'veda';
import 'mapbox-gl/dist/mapbox-gl.css';
import 'mapbox-gl-compare/dist/mapbox-gl-compare.css';
import { convertProjectionToMapbox } from '../mapbox/map-options/utils';
import { StylesContext } from './styles';
import { useMapStyle } from './styles';
import { MapsContext } from './maps';

export default function MapComponent({
Expand Down Expand Up @@ -36,7 +36,7 @@ export default function MapComponent({
return convertProjectionToMapbox(projection);
}, [projection]);

const { style } = useContext(StylesContext);
const { style } = useMapStyle();

if (!style) return null;

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/components/common/map/maps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type MapsProps = Pick<MapsContextWrapperProps, 'projection'> & {
};

function Maps({ children, projection }: MapsProps) {
// Instanciate MGL Compare, if compare is enabled
// Instantiate MGL Compare, if compare is enabled
useMapCompare();

// Split children into layers and controls, using all children provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ export function Basemap({
setBaseStyle(styleJson as Style);
}, [styleJson]);

// Apply labels and boundaries options, by setting visibility on related layers
// For simplicity's sake, the Mapbox layer group (as set in Mapbox Studio) is used
// to determine wehether a layer is a labels layer or boundaries or none of those.
// Apply labels and boundaries options, by setting visibility on related
// layers For simplicity's sake, the Mapbox layer group (as set in Mapbox
// Studio) is used to determine whether a layer is a labels layer or
// boundaries or none of those.
useEffect(() => {
if (!baseStyle) return;

Expand Down
6 changes: 5 additions & 1 deletion app/scripts/components/exploration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ function Exploration() {
{compare && (
// Compare map layers
<Compare>
<Basemap basemapStyleId={mapBasemapId} />
<Basemap
basemapStyleId={mapBasemapId}
labelsOption={labelsOption}
boundariesOption={boundariesOption}
/>
</Compare>
)}
</Map>
Expand Down

0 comments on commit 8322abf

Please sign in to comment.