Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move Map style to outer div for full-screen map rendering #727

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 58 additions & 58 deletions src/components/RunMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,64 +129,64 @@ const RunMap = ({
};

return (
<Map
{...viewState}
onMove={onMove}
style={style}
mapStyle="mapbox://styles/mapbox/dark-v10"
ref={mapRefCallback}
mapboxAccessToken={MAPBOX_TOKEN}
onRender={(event) => event.target.resize()}
>
<RunMapButtons changeYear={changeYear} thisYear={thisYear} />
<Source id="data" type="geojson" data={geoData}>
<Layer
id="province"
type="fill"
paint={{
'fill-color': PROVINCE_FILL_COLOR,
}}
filter={filterProvinces}
/>
<Layer
id="countries"
type="fill"
paint={{
'fill-color': COUNTRY_FILL_COLOR,
// in China, fill a bit lighter while already filled provinces
'fill-opacity': ["case", ["==", ["get", "name"], '中国'], 0.1, 0.5],
}}
filter={filterCountries}
/>
<Layer
id="runs2"
type="line"
paint={{
'line-color': ['get', 'color'],
'line-width': isBigMap && lights ? 1 : 2,
'line-dasharray': dash,
'line-opacity': isSingleRun || isBigMap || !lights ? 1 : LINE_OPACITY,
'line-blur': 1,
}}
layout={{
'line-join': 'round',
'line-cap': 'round',
}}
/>
</Source>
{isSingleRun && (
<RunMarker
startLat={startLat}
startLon={startLon}
endLat={endLat}
endLon={endLon}
/>
)}
<span className={styles.runTitle}>{title}</span>
<FullscreenControl style={fullscreenButton}/>
{!PRIVACY_MODE && <LightsControl setLights={setLights} lights={lights}/>}
<NavigationControl showCompass={false} position={'bottom-right'} style={{opacity: 0.3}}/>
</Map>
<div style={style}>
<Map
{...viewState}
onMove={onMove}
mapStyle="mapbox://styles/mapbox/dark-v10"
ref={mapRefCallback}
mapboxAccessToken={MAPBOX_TOKEN}
>
<RunMapButtons changeYear={changeYear} thisYear={thisYear} />
<Source id="data" type="geojson" data={geoData}>
<Layer
id="province"
type="fill"
paint={{
'fill-color': PROVINCE_FILL_COLOR,
}}
filter={filterProvinces}
/>
<Layer
id="countries"
type="fill"
paint={{
'fill-color': COUNTRY_FILL_COLOR,
// in China, fill a bit lighter while already filled provinces
'fill-opacity': ["case", ["==", ["get", "name"], '中国'], 0.1, 0.5],
}}
filter={filterCountries}
/>
<Layer
id="runs2"
type="line"
paint={{
'line-color': ['get', 'color'],
'line-width': isBigMap && lights ? 1 : 2,
'line-dasharray': dash,
'line-opacity': isSingleRun || isBigMap || !lights ? 1 : LINE_OPACITY,
'line-blur': 1,
}}
layout={{
'line-join': 'round',
'line-cap': 'round',
}}
/>
</Source>
{isSingleRun && (
<RunMarker
startLat={startLat}
startLon={startLon}
endLat={endLat}
endLon={endLon}
/>
)}
<span className={styles.runTitle}>{title}</span>
<FullscreenControl style={fullscreenButton}/>
{!PRIVACY_MODE && <LightsControl setLights={setLights} lights={lights}/>}
<NavigationControl showCompass={false} position={'bottom-right'} style={{opacity: 0.3}}/>
</Map>
</div>
);
};

Expand Down