From 5adcc5a9bb360960b398fa9df4abbc456acfa4d4 Mon Sep 17 00:00:00 2001 From: mtennekes Date: Wed, 10 Apr 2024 19:27:34 +0200 Subject: [PATCH] sepia components in view mode (todo compass, background) #861 --- R/tmapLeafletRun.R | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/R/tmapLeafletRun.R b/R/tmapLeafletRun.R index d9d6b47d..6e030d43 100644 --- a/R/tmapLeafletRun.R +++ b/R/tmapLeafletRun.R @@ -2,7 +2,7 @@ tmapLeafletRun = function(o, show, knit, args) { lfs = get("lfs", envir = .TMAP_LEAFLET) lfs2 = lapply(lfs, function(lfsi) { - if (o$nrows == 1 && o$ncols == 1) { + x = if (o$nrows == 1 && o$ncols == 1) { lfsi[[1]] } else { fc = o$free.coords @@ -20,6 +20,16 @@ tmapLeafletRun = function(o, show, knit, args) { #print(do.call(leafsync::latticeView, c(lfsi, list(ncol = o$ncols, sync = sync, sync.cursor = all(!fc), no.initial.sync = FALSE, between = list(x = marg, y = marg))))) do.call(leafsync::latticeView, c(lfsi, list(ncol = o$ncols, sync = sync, sync.cursor = all(!fc), no.initial.sync = FALSE))) } + if (o$pc$sepia.intensity != 0) { + col = process_color("#ffffff", sepia.intensity = o$pc$sepia.intensity) + htmlwidgets::prependContent(x, htmltools::tags$style(paste0( + ".leaflet-control-layers {background: ", col, ";} + .leaflet-control-zoom-in {background: ", col, " !important;} + .leaflet-control-zoom-out {background: ", col, " !important;}" + ))) + } else { + x + } }) if (length(lfs2) == 1) lfs2 = lfs2[[1]]