@@ -2,7 +2,7 @@ leafletMiniMapDependencies <- function() {
2
2
list (
3
3
htmltools :: htmlDependency(
4
4
" leaflet-minimap" ,
5
- " 0.1.0 " ,
5
+ " 3.3.1 " ,
6
6
system.file(" htmlwidgets/plugins/Leaflet-MiniMap" , package = " leaflet" ),
7
7
script = c(' Control.MiniMap.min.js' , ' Minimap-binding.js' ),
8
8
stylesheet = c(' Control.MiniMap.min.css' )
@@ -14,25 +14,44 @@ leafletMiniMapDependencies <- function() {
14
14
# ' \url{https://github.com/Norkart/Leaflet-MiniMap}
15
15
# '
16
16
# ' @param map a map widget object
17
- # ' @param position The standard Leaflet.Control position parameter, used like all the other controls.
17
+ # ' @param tiles URL for tiles or one of the \code{\link{providers}}
18
+ # ' @param position The standard Leaflet.Control position parameter,
19
+ # ' used like all the other controls.
18
20
# ' Defaults to 'bottomright'.
19
21
# ' @param width The width of the minimap in pixels. Defaults to 150.
20
22
# ' @param height The height of the minimap in pixels. Defaults to 150.
21
- # ' @param collapsedWidth The width of the toggle marker and the minimap when collapsed, in pixels.
22
- # ' Defaults to 19.
23
- # ' @param collapsedHeight The height of the toggle marker and the minimap when collapsed, in pixels.
24
- # ' Defaults to 19.
25
- # ' @param zoomLevelOffset The offset applied to the zoom in the minimap compared to the zoom of the main map.
26
- # ' Can be positive or negative, defaults to -5.
27
- # ' @param zoomLevelFixed Overrides the offset to apply a fixed zoom level to the minimap regardless of the main map zoom.
28
- # ' Set it to any valid zoom level, if unset zoomLevelOffset is used instead.
23
+ # ' @param collapsedWidth The width of the toggle marker and the minimap
24
+ # ' when collapsed, in pixels. Defaults to 19.
25
+ # ' @param collapsedHeight The height of the toggle marker and the minimap
26
+ # ' when collapsed, in pixels. Defaults to 19.
27
+ # ' @param zoomLevelOffset The offset applied to the zoom in the minimap compared
28
+ # ' to the zoom of the main map. Can be positive or negative, defaults to -5.
29
+ # ' @param zoomLevelFixed Overrides the offset to apply a fixed zoom level to
30
+ # ' the minimap regardless of the main map zoom.
31
+ # ' Set it to any valid zoom level, if unset zoomLevelOffset is used instead.
32
+ # ' @param centerFixed: Applies a fixed position to the minimap regardless of
33
+ # ' the main map's view / position. Prevents panning the minimap, but does
34
+ # ' allow zooming (both in the minimap and the main map).
35
+ # ' If the minimap is zoomed, it will always zoom around the centerFixed point.
36
+ # ' You can pass in a LatLng-equivalent object. Defaults to false.
29
37
# ' @param zoomAnimation Sets whether the minimap should have an animated zoom.
30
- # ' (Will cause it to lag a bit after the movement of the main map.) Defaults to false.
38
+ # ' (Will cause it to lag a bit after the movement of the main map.)
39
+ # ' Defaults to false.
31
40
# ' @param toggleDisplay Sets whether the minimap should have a button to minimise it.
32
- # ' Defaults to false.
41
+ # ' Defaults to false.
33
42
# ' @param autoToggleDisplay Sets whether the minimap should hide automatically,
34
- # ' if the parent map bounds does not fit within the minimap bounds.
35
- # ' Especially useful when 'zoomLevelFixed' is set.
43
+ # ' if the parent map bounds does not fit within the minimap bounds.
44
+ # ' Especially useful when 'zoomLevelFixed' is set.
45
+ # ' @param minimized Sets whether the minimap should start in a minimized position.
46
+ # ' @param aimingRectOptions Sets the style of the aiming rectangle by passing in
47
+ # ' a Path.Options (\url{http://leafletjs.com/reference.html#path-options}) object.
48
+ # ' (Clickable will always be overridden and set to false.)
49
+ # ' @param shadowRectOptions Sets the style of the aiming shadow rectangle by passing in
50
+ # ' a Path.Options (\url{http://leafletjs.com/reference.html#path-options}) object.
51
+ # ' (Clickable will always be overridden and set to false.)
52
+ # ' @param strings Overrides the default strings allowing for translation.
53
+ # ' @param mapOptions Sets Leaflet options for the MiniMap map.
54
+ # ' It does not override the MiniMap default map options but extends them.
36
55
# ' @examples
37
56
# ' library(leaflet)
38
57
# '
@@ -43,31 +62,60 @@ leafletMiniMapDependencies <- function() {
43
62
# ' @export
44
63
addMiniMap <- function (
45
64
map ,
65
+ tiles = NULL ,
46
66
position = ' bottomright' ,
47
67
width = 150 ,
48
68
height = 150 ,
49
69
collapsedWidth = 19 ,
50
70
collapsedHeight = 19 ,
51
71
zoomLevelOffset = - 5 ,
52
- zoomLevelFixed = NULL ,
72
+ zoomLevelFixed = FALSE ,
73
+ centerFixed = FALSE ,
53
74
zoomAnimation = FALSE ,
54
75
toggleDisplay = FALSE ,
55
- autoToggleDisplay = NULL
76
+ autoToggleDisplay = FALSE ,
77
+ minimized = FALSE ,
78
+ aimingRectOptions = list (color = ' #ff7800' , weight = 1 , clickable = FALSE ),
79
+ shadowRectOptions = list (color = ' #000000' , weight = 1 , clickable = FALSE ,
80
+ opacity = 0 , fillOpacity = 0 ),
81
+ strings = list (hideText = ' Hide MiniMap' , showText = ' Show MiniMap' ),
82
+ mapOptions = list ()
56
83
) {
84
+
85
+ # determin tiles to use
86
+ tilesURL <- NULL
87
+ tilesProvider <- NULL
88
+ if (! is.null(tiles )) {
89
+ if (tiles %in% providers ) {
90
+ map $ dependencies <- c(map $ dependencies , leafletProviderDependencies())
91
+ tilesProvider <- tiles
92
+ } else {
93
+ tilesURL <- tiles
94
+ }
95
+ }
96
+
57
97
map $ dependencies <- c(map $ dependencies , leafletMiniMapDependencies())
58
98
invokeMethod(
59
99
map
60
100
, getMapData(map )
61
101
, ' addMiniMap'
102
+ , tilesURL
103
+ , tilesProvider
62
104
, position
63
105
, width
64
106
, height
65
107
, collapsedWidth
66
108
, collapsedHeight
67
109
, zoomLevelOffset
68
110
, zoomLevelFixed
111
+ , centerFixed
69
112
, zoomAnimation
70
113
, toggleDisplay
71
114
, autoToggleDisplay
115
+ , minimized
116
+ , aimingRectOptions
117
+ , shadowRectOptions
118
+ , strings
119
+ , mapOptions
72
120
)
73
121
}
0 commit comments