Skip to content

Fix #192#193

Open
danielvartan wants to merge 2 commits intowalkerke:mainfrom
danielvartan:fix/map-viewport
Open

Fix #192#193
danielvartan wants to merge 2 commits intowalkerke:mainfrom
danielvartan:fix/map-viewport

Conversation

@danielvartan
Copy link
Copy Markdown
Contributor

Closes #192.

Changes

  • In save_map(), explicitly set widget properties before saveWidget().
  • Update function documentation to clearly state that save_map(width, height) controls export dimensions.

Test

library(geobr)
library(mapgl)

brazil_shape <- read_country()

map <- 
  brazil_shape |>
  maplibre(
    width = "1000px",
    height = "1000px",
    bounds = _
  ) |>
  add_fill_layer(
    id = "fill",
    source = brazil_shape,
    fill_color = "blue"
  ) |>
  add_navigation_control()

map |>
  save_map(
    width = 1000,
    height = 500,
    hide_controls = TRUE
  )
pmtiles_map

Copilot AI review requested due to automatic review settings April 5, 2026 05:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #192 where save_map() exports could ignore the width/height arguments, leading to inconsistent output dimensions. It does so by ensuring the widget’s size properties are set before the widget is serialized for headless rendering.

Changes:

  • Update save_map() to explicitly set map$width/map$height prior to calling htmlwidgets::saveWidget().
  • Clarify width/height documentation to state that save_map(width, height) overrides widget creation dimensions.
  • Regenerate/update related Rd documentation for save_map() and print_map().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
R/screenshot.R Forces widget dimensions before saving HTML so exported PNG size matches save_map() args.
man/save_map.Rd Updates parameter docs to reflect export-dimension override behavior.
man/print_map.Rd Keeps inherited parameter docs consistent with the updated save_map() documentation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

save_map() does not set widget width/height properties correctly before saving/capture

2 participants