Skip to content

Commit

Permalink
failed attempt to get z-index ordering of animated markers correct
Browse files Browse the repository at this point in the history
  • Loading branch information
bobular committed Nov 3, 2024
1 parent 48d15cf commit c702c1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export default function geohashAnimation({
const hashDif = currentGeohash.length - prevGeoHash.length;
// Get array of new markers with old positions
const cloneArray = updateMarkers(markers, prevMarkers, hashDif);
consolidatedMarkers = [...prevMarkers, ...cloneArray];
// put them first - ideally underneath the old markers
// (though it seems impossible to get this to work)
// ((see also updateMarkers zIndexOffset failed attempt))
consolidatedMarkers = [...cloneArray, ...prevMarkers];
} else {
/** No difference in geohashes - Render markers as they are **/
zoomType = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ export default function updateMarkers(
// Clone marker element with new position
markerCloneProps = {
position: matchingMarkers[0].props.position,
// ideally we would put the modified markers on top
// but this doesn't seem to work:
// zIndexOffset: -1000, // or +1000
icon: {
...markerObj.props.icon,
className: 'bottom-marker', // doesn't seem to work :-(
},
};
}

Expand Down
4 changes: 4 additions & 0 deletions packages/libs/components/src/map/styles/map-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
z-index: 1;
}

.bottom-marker {
z-index: -1000;
}

/* Replace leaflet styles*/

/* general typography */
Expand Down

0 comments on commit c702c1c

Please sign in to comment.