Captures the current drag offsets for a given grouping and returns a named
list. Snapshots can be passed to inherit_layout() when switching to a
finer grouping, or stored and later recovered with
restore_layout_snapshot().
Value
A named list with elements group (character), offsets (data
frame or NULL), and timestamp (POSIXct).
Examples
poly <- sf::st_sf(
county = c("A", "B"),
geometry = sf::st_sfc(
sf::st_polygon(list(rbind(c(0,1e5),c(1e5,1e5),c(1e5,2e5),c(0,2e5),c(0,1e5)))),
sf::st_polygon(list(rbind(c(0,0),c(1e5,0),c(1e5,1e5),c(0,1e5),c(0,0)))),
crs = 3857
)
)
offsets <- data.frame(region = c("A", "B"), dx_m = c(10000, -10000), dy_m = 0)
snap <- create_layout_snapshot(poly, group = "county", offsets = offsets)
snap$group
#> [1] "county"
snap$offsets
#> region dx_m dy_m
#> 1 A 10000 0
#> 2 B -10000 0
