Skip to content

Commit

Permalink
fix: fillColor argument for pulseIcons
Browse files Browse the repository at this point in the history
  • Loading branch information
trafficonese committed Oct 16, 2024
1 parent 0feff68 commit 2e37b2e
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 21 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
- Include the plugin [`leaflet-groupedlayercontrol`](https://github.com/ismyrnow/leaflet-groupedlayercontrol).
See the example in `/inst/examples/shiny/groupedlayercontrol_app.R` for a demo of all options and methods. Fix #202

## Bugfixes
- New argument `fillColor` for `pulseIcons`. Fix #231

# leaflet.extras 2.0.1

Expand Down
7 changes: 5 additions & 2 deletions R/pulseIcon.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ pulseIconSetToPulseIcons <- function(x) {
#' @rdname pulseMarkers
makePulseIcon <- function(
color = "#ff0000",
fillColor = color,
iconSize = 12,
animate = TRUE,
heartbeat = 1) {
icon <- leaflet::filterNULL(list(
color = color, iconSize = iconSize, animate = animate, heartbeat = heartbeat
color = color, fillColor = fillColor, iconSize = iconSize, animate = animate, heartbeat = heartbeat
))
structure(icon, class = "leaflet_pulse_icon")
}
Expand All @@ -93,18 +94,20 @@ makePulseIcon <- function(
#' icon data. Shorter argument values will be re-cycled. \code{NULL} values for
#' these arguments will be ignored.
#' @param color Color of the icon
#' @param fillColor Fill color of the icon
#' @param iconSize Size of Icon in Pixels.
#' @param animate To animate the icon or not, defaults to TRUE.
#' @param heartbeat Interval between each pulse in seconds.
#' @export
#' @rdname pulseMarkers
pulseIcons <- function(
color = "#ff0000",
fillColor = color,
iconSize = 12,
animate = TRUE,
heartbeat = 1) {
leaflet::filterNULL(list(
color = color, iconSize = iconSize, animate = animate, heartbeat = heartbeat
color = color, fillColor = fillColor, iconSize = iconSize, animate = animate, heartbeat = heartbeat
))
}

Expand Down
2 changes: 1 addition & 1 deletion inst/examples/shiny/groupedlayercontrol_app.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ server <- function(input, output, session) {
addCircleMarkers(runif(20, -75, -74), runif(20, 41, 42), color = "lightblue", group = "Markers4") %>%
addCircleMarkers(runif(20, -75, -74), runif(20, 41, 42), color = "purple", group = "Markers5") %>%
addGroupedLayersControl(
baseGroups = c("OpenStreetMap","CartoDB"),
baseGroups = c(list("Base1" = "OpenStreetMap")),
overlayGroups = list("Layergroup_2" = c("Markers5","Markers4"),
"Layergroup_1" = c("Markers2","Markers1","Markers3")),
position = "topright",
Expand Down
38 changes: 23 additions & 15 deletions man/addGroupedLayersControl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/leaflet.extras-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions man/pulseMarkers.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2e37b2e

Please sign in to comment.