Skip to content

Commit

Permalink
fix rainbow colours when upload and display
Browse files Browse the repository at this point in the history
  • Loading branch information
aloxe committed Jul 23, 2024
1 parent c45c118 commit 221ecf5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/components/FileUpload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const FileUpload = ({ isLogged, setIsLogged, setGeojsonList }) => {
const geojson = await loadGeoJsonFromGpx(name);
const l = geojson.features.length;
geojson.features.map((feature, i) => feature.properties.color = calcColor(l,i));
geojson.gpx = true;
setCurrentGeoJson(geojson);
setGeojsonList([geojson]);
}
Expand Down Expand Up @@ -72,6 +73,7 @@ const FileUpload = ({ isLogged, setIsLogged, setGeojsonList }) => {
};

const uploadjson = async () => {
delete currentGeoJson.gpx;
currentGeoJson.date = form.date;
currentGeoJson.title = form.title;
currentGeoJson.countries = form.countries;
Expand Down
2 changes: 1 addition & 1 deletion src/components/MainMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const MainMap = ({geojsonList, tileName, handleClickPopup, currentGeoJson}) => {
// removing display for points.
return { strokeWidth: "0", stroke: "black", r: '0', };
}
if (geojson.slug && geojson.slug === currentGeoJson?.slug) { // sellected path
if (geojson.gpx || geojson.slug && geojson.slug === currentGeoJson?.slug) { // gpx or sellected path
if (geojson.features.length > 1) { // rainbow colours for multi paths geojson
return {
strokeWidth: "4",
Expand Down

0 comments on commit 221ecf5

Please sign in to comment.