Skip to content

Commit a40e623

Browse files
committed
Made Graticule and Terminator unclickable by default. This is necessary for highlighting shapes properly.
1 parent 6848f97 commit a40e623

File tree

6 files changed

+32
-18
lines changed

6 files changed

+32
-18
lines changed

R/plugin-graticule.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ leafletGraticuleDependencies <- function() {
1818
#' @param style path options for the generated lines. See \url{http://leafletjs.com/reference.html#path-options}
1919
#' @param layerId the layer id
2020
#' @param group the name of the group this layer belongs to.
21+
#' @param options the path options for the graticule layer
2122
#' @examples
2223
#' library(leaflet)
2324
#'
@@ -32,7 +33,8 @@ addGraticule <- function(
3233
sphere = FALSE,
3334
style = list(color= '#333', weight= 1),
3435
layerId = NULL,
35-
group=NULL
36+
group=NULL,
37+
options = pathOptions(pointerEvents="none", clickable=FALSE) # Default unclickable
3638
) {
3739
map$dependencies <- c(map$dependencies, leafletGraticuleDependencies())
3840
invokeMethod(
@@ -43,6 +45,7 @@ addGraticule <- function(
4345
sphere,
4446
style,
4547
layerId,
46-
group
48+
group,
49+
options
4750
)
4851
}

R/plugin-terminator.R

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ leafletTerminatorDependencies <- function() {
2020
#' @param time Time
2121
#' @param layerId the layer id
2222
#' @param group the name of the group this layer belongs to.
23+
#' @param options the path options for the daynight layer
2324
#' @examples
2425
#' library(leaflet)
2526
#'
@@ -33,16 +34,18 @@ addTerminator <- function(
3334
resolution = 2,
3435
time = NULL,
3536
layerId = NULL,
36-
group=NULL
37+
group=NULL,
38+
options = pathOptions(pointerEvents="none", clickable=FALSE) # Default unclickable
3739
) {
3840
map$dependencies <- c(map$dependencies, leafletTerminatorDependencies())
3941
invokeMethod(
40-
map
41-
, getMapData(map)
42-
, 'addTerminator'
43-
, resolution
44-
, time
45-
, layerId
46-
, group
42+
map,
43+
getMapData(map),
44+
'addTerminator',
45+
resolution,
46+
time,
47+
layerId,
48+
group,
49+
options
4750
)
4851
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
LeafletWidget.methods.addGraticule = function(interval, sphere, style, layerId, group) {
1+
LeafletWidget.methods.addGraticule = function(interval, sphere, style,
2+
layerId, group, options) {
23
(function() {
34
this.layerManager.addLayer(
4-
L.graticule({
5+
L.graticule($.extend({
56
interval: interval,
67
sphere: sphere,
78
style: style
8-
}),
9+
}), options || {}),
910
'shape', layerId, group);
1011
}).call(this);
1112
};

inst/htmlwidgets/plugins/Leaflet.Terminator/Terminator-binding.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
LeafletWidget.methods.addTerminator = function(resolution, time, layerId, group) {
1+
LeafletWidget.methods.addTerminator = function(resolution, time,
2+
layerId, group, options) {
23
(function() {
34
this.layerManager.addLayer(
4-
L.terminator({
5+
L.terminator($.extend({
56
resolution: resolution,
67
time: time,
78
group: group
8-
}),
9+
}), options || {}),
910
'shape', layerId, group);
1011
}).call(this);
1112
};

man/addGraticule.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/addTerminator.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)