-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadd_zoom.Rd
38 lines (31 loc) · 905 Bytes
/
add_zoom.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/d3_map.R
\name{add_zoom}
\alias{add_zoom}
\title{Add zoom capacity}
\usage{
add_zoom(map, enabled = TRUE, type = "click")
}
\arguments{
\item{map}{A \code{r2d3map} \code{htmlwidget} object.}
\item{enabled}{Logical, enable zooming.}
\item{type}{Type of zoom: \code{"click"} for zooming to clicked polygon,
or \code{"wheel"} for zooming with mouse wheel. Both can be supplied.}
}
\description{
Add zoom capacity
}
\note{
Zoom with mousewheel doesn't work in RStudio viewer.
Zooming can be slow for a map with lot of polygons.
}
\examples{
library( r2d3maps )
library( rnaturalearth )
turkey <- ne_states(country = "turkey", returnclass = "sf")
d3_map(shape = turkey)
# zoom with click
d3_map(shape = turkey) \%>\% add_zoom()
# zoom with mousewheel (open in browser)
d3_map(shape = turkey) \%>\% add_zoom(type = "wheel")
}