Skip to content

Commit

Permalink
if minWidth not provided via ... append to dotlist to ensure proper p…
Browse files Browse the repository at this point in the history
…opup container width. #15
  • Loading branch information
tim-salabim committed May 1, 2021
1 parent 1c68195 commit 89e74d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
16 changes: 14 additions & 2 deletions R/addPopupImages.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)

})

Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions inst/htmlwidgets/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<image src='" + img[imgid] + "'" + " height=" + hght + " width=" + wdth + ">";
poporig = layer.getPopup();
Expand Down

0 comments on commit 89e74d3

Please sign in to comment.