Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 4 DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ URL: http://rstudio.github.io/leaflet/
BugReports: https://github.com/rstudio/leaflet/issues
Imports:
base64enc,
crosstalk,
htmlwidgets,
htmltools,
magrittr,
Expand All @@ -50,4 +51,7 @@ Suggests:
rgdal,
R6,
RJSONIO
Remotes:
rstudio/crosstalk,
jcheng5/plotly@joe/feature/crosstalk
RoxygenNote: 5.0.1

@cpsievert cpsievert Aug 26, 2016

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is here just for the time being since we need to access plotly's "global" crosstalk options, as I'm getting here

3 changes: 3 additions & 0 deletions 3 NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

S3method("[",leaflet_awesome_icon_set)
S3method("[",leaflet_icon_set)
S3method(pointData,SharedData)
S3method(pointData,SpatialPoints)
S3method(pointData,SpatialPointsDataFrame)
S3method(pointData,data.frame)
S3method(pointData,default)
S3method(pointData,matrix)
S3method(polygonData,SharedData)
export("%>%")
export(JS)
export(WMSTileOptions)
Expand Down Expand Up @@ -93,5 +95,6 @@ export(setMaxBounds)
export(setView)
export(showGroup)
export(tileOptions)
import(crosstalk)
importFrom(htmlwidgets,JS)
importFrom(magrittr,"%>%")
16 changes: 16 additions & 0 deletions 16 R/normalize.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ doResolveFormula.data.frame = function(data, f) {
eval(f[[2]], data, environment(f))
}

doResolveFormula.SharedData = function(data, f) {
doResolveFormula(data$data(withSelection = TRUE, withFilter = FALSE, withKey = TRUE), f)
}

doResolveFormula.map = function(data, f) {
eval(f[[2]], data, environment(f))
}
Expand Down Expand Up @@ -160,6 +164,12 @@ pointData.SpatialPointsDataFrame = function(obj) {
)
}

#' @export
pointData.SharedData = function(obj) {
pointData(obj$data(withSelection = FALSE,
withFilter = FALSE, withKey = FALSE))
}

# A simple polygon is a list(lng=numeric(), lat=numeric()). A compound polygon
# is a list of simple polygons. This function returns a list of compound
# polygons, so list(list(list(lng=..., lat=...))). There is also a bbox
Expand Down Expand Up @@ -221,6 +231,12 @@ polygonData.SpatialLinesDataFrame = function(obj) {
polygonData(sp::SpatialLines(obj@lines))
}

#' @export
polygonData.SharedData = function(obj) {
polygonData(obj$data(withSelection = FALSE,
withFilter = FALSE, withKey = FALSE))
}

dfbbox = function(df) {
suppressWarnings(rbind(
lng = range(df$lng, na.rm = TRUE),
Expand Down
15 changes: 14 additions & 1 deletion 15 R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,22 @@ filterNULL = function(x) {
#' @param method the name of the JavaScript method to invoke
#' @param ... unnamed arguments to be passed to the JavaScript method
#' @rdname dispatch
#' @import crosstalk
#' @export
invokeMethod = function(map, data, method, ...) {
args = evalFormula(list(...), data)
crosstalkOptions <- if (crosstalk::is.SharedData(data)) {
map$dependencies <- c(map$dependencies, crosstalk::crosstalkLibs())
sd <- data
data <- sd$data()
list(
ctKey = sd$key(),
ctGroup = sd$groupName()
)
} else {
NULL
}

args = c(evalFormula(list(...), data), list(crosstalkOptions))

dispatch(map,
method,
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.