Skip to content

Commit

Permalink
hotfix canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-salabim committed Apr 28, 2018
1 parent 39bc07b commit 9d4afd0
Showing 1 changed file with 10 additions and 38 deletions.
48 changes: 10 additions & 38 deletions R/sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ leaflet_sfc <- function(x,
if (!is.null(names(x))) {
names(x) = NULL
}
# x = x[!is.na(sf::st_dimension(x))]

if (inherits(x, "XY")) x = sf::st_sfc(x)

if (!native.crs) x <- checkAdjustProjection(x)
Expand All @@ -169,44 +169,18 @@ leaflet_sfc <- function(x,

m <- initMap(map, map.types, sf::st_crs(x), native.crs, canvas = canvas)

if (!is.null(pane)) {
if (pane == "auto" & !canvas) {
pane = paneName(x)
zindex = zIndex(x)
m = addMapPane(m, pane, zindex)
if (!canvas) {
if (!is.null(pane)) {
if (pane == "auto") {
pane = paneName(x)
zindex = zIndex(x)
m = addMapPane(m, pane, zindex)
}
}
} else {
pane = NULL
}

# if (featureComplexity(x) > maxpoints) {
# cat(large_warn)
# if(interactive()) {
# installChoice <- menu(c("yes", "no"))
# if(installChoice == 1){
# vwr = options("viewer")
# options(viewer = NULL)
# }
# }
# }

# if (featureComplexity(x) > maxpoints) {
# if (getGeometryType(x) == "ln") clrs <- color else clrs <- col.regions
# warning(large_warn)
# m <- addLargeFeatures(m,
# data = x,
# radius = cex,
# weight = lwd,
# opacity = alpha,
# fillOpacity = alpha.regions,
# color = clrs,
# popup = popup,
# label = label,
# group = layer.name,
# maxpoints = maxpoints,
# attributes = attributes,
# ...)
#
# } else {

m <- addFeatures(m,
data = x,
pane = pane,
Expand All @@ -222,8 +196,6 @@ leaflet_sfc <- function(x,
highlightOptions = highlight,
...)

# }

if (!is.null(map)) m = updateOverlayGroups(m, layer.name)
sclbrpos = getCallEntryFromMap(m, "addScaleBar")
if (length(sclbrpos) > 0 | native.crs) scalebar = FALSE else scalebar = TRUE
Expand Down

0 comments on commit 9d4afd0

Please sign in to comment.