diff --git a/R/addPopupImages.R b/R/addPopupImages.R index c869fbe..9ff87c6 100644 --- a/R/addPopupImages.R +++ b/R/addPopupImages.R @@ -115,7 +115,14 @@ addPopupImages = function(map, height = height } - return(list(nm = nm, width = width, height = height, src = src)) + return( + list( + nm = nm + , width = width + , height = height + , src = src + ) + ) }) @@ -160,7 +167,12 @@ addPopupImages = function(map, } map$dependencies = map$dependencies[!duplicated(map$dependencies)] - dotlist = utils::modifyList(list("maxWidth" = 2000), list(...)) + dotlist = utils::modifyList( + list( + "maxWidth" = 2000 + ) + , list(...) + ) leaflet::invokeMethod( map, diff --git a/inst/htmlwidgets/popup.js b/inst/htmlwidgets/popup.js index 6ab3f4c..47b8b63 100644 --- a/inst/htmlwidgets/popup.js +++ b/inst/htmlwidgets/popup.js @@ -40,6 +40,9 @@ LeafletWidget.methods.imagePopup = function(image, group, width, height, src, na lay.eachLayer(function (layer) { wdth = width[imgid]; hght = height[imgid]; + if (dotlist.minWidth === undefined) { + dotlist.minWidth = wdth; + } if (imgid <= image.length) { popimg = ""; poporig = layer.getPopup();