Skip to content

Commit

Permalink
Fix marker color error, now clusters are colored by they subsequent m…
Browse files Browse the repository at this point in the history
…arkers by layer color
  • Loading branch information
ut committed Sep 8, 2024
1 parent 5e0fc78 commit cf6cf47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 7 additions & 9 deletions src/components/LeafletMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -334,25 +334,23 @@ export default {
if ( layer.color == '#b1f075') {
darkcolor = '#92c460';
}
const icon = LargeMarkerIcon.create({ color: darkcolor, mtype: mtype })
const marker = L.marker([place.lat, place.lon], { icon: icon, id: place.id, data: place })
marker.data = [];
marker.data.title = place.title;
marker.data.color = darkcolor;
marker.data.mtype = mtype;
marker.data.layer_id = layer.id;
if ( place.startdate && !place.enddate ) {
place.enddate = parseInt(place.startdate.substring(0, 4))+"-12-31T00:00:00.000Z";
console.log("Set enddate with startdate", place.startdate,place.enddate);
}
if ( place.startdate && place.enddate ) {
marker.data = setFromToYears(place.startdate,place.enddate);
}
}
marker.data.title = place.title;
marker.data.color = darkcolor;
marker.data.mtype = mtype;
marker.data.layer_id = layer.id;
function setFromToYears (startdate,enddate) {
var startYear = parseInt(startdate.substring(0, 4));
var endYear = parseInt(enddate.substring(0, 4));
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/filter_and_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export function filter_and_update(map,overlayLayers,selectedYear) {

layer.eachLayer((marker) => {
if (marker instanceof L.Marker) {
console.log("marker.data",marker.options.data.title);
console.log("marker.data",marker.options.data.startdate);
// console.log("marker.data",marker.options.data.title);
// console.log("marker.data",marker.options.data.startdate);
// checkForDates(layer, marker);

}
Expand Down

0 comments on commit cf6cf47

Please sign in to comment.