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

It seems missed argument fillColor in makePulseIcon() #231

Closed
nplatonov opened this issue Oct 15, 2024 · 1 comment
Closed

It seems missed argument fillColor in makePulseIcon() #231

nplatonov opened this issue Oct 15, 2024 · 1 comment
Labels

Comments

@nplatonov
Copy link

Based on lfx-pulse-icon-prod.js it should be added an argument fillColor to function makePulseIcon(). It may have default value fillColor = color. All central markers are red without this argument.
Intro:

require(leaflet.extras)
ID <- sample(LETTERS,5)
lon <- runif(length(ID),min=-119,max=-118)
lat <- runif(length(ID),min=33.7,max=34.7)
d <- sf::st_as_sf(data.frame(lon,lat,ID),coords=c("lon","lat"),crs=4326)
pal.tr <- colorFactor("Dark2",domain=ID)

Current behavior:

pIcon <- lapply(ID,\(id) {
   makePulseIcon(color=pal.tr(id),heartbeat=runif(1,min=0.5,max=1.5))
})
names(pIcon) <- ID
pIcon <- do.call(pulseIconList,pIcon)
d <- d[seq_along(ID) |> sample(),]
leaflet() |>
  addProviderTiles(providers$CartoDB.Positron) |>
  addPulseMarkers(data=d,label=~dQuote(ID),icon=~pIcon[ID])

Desired behavior:

pIcon2 <- leaflet.extras:::pulseIconSetToPulseIcons(pIcon)
pIcon2$fillColor <- pIcon2$color
pIcon2 <- as.data.frame(pIcon2)
rownames(pIcon2) <- ID
d <- d[seq_along(ID) |> sample(),]
leaflet() |>
  addProviderTiles(providers$CartoDB.Positron) |>
  addPulseMarkers(data=d,label=~dQuote(ID),icon = ~pIcon2[ID,])
@nplatonov nplatonov added the bug label Oct 15, 2024
@trafficonese
Copy link
Owner

2e37b2e should fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants