Skip to content

Commit

Permalink
close #295
Browse files Browse the repository at this point in the history
  • Loading branch information
SymbolixAU committed Apr 21, 2020
1 parent 6047102 commit f39324e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mapdeck
Type: Package
Title: Interactive Maps Using 'Mapbox GL JS' and 'Deck.gl'
Version: 0.3.2001
Version: 0.3.2002
Date: 2020-04-05
Authors@R: c(
person("David", "Cooley", ,"dcooley@symbolix.com.au", role = c("aut", "cre"))
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v0.3.3

* min and max pitch and zoom options [issue 295](https://github.com/SymbolixAU/mapdeck/issues/295)


# v0.3.2

* `add_animated_arc()` layer
Expand Down
8 changes: 8 additions & 0 deletions R/mapdeck_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ mapdeck <- function(
pitch = 0,
zoom = 0,
bearing = 0,
max_zoom = 20,
min_zoom = 0,
max_pitch = 60,
min_pitch = 0,
location = c(0, 0),
show_view_state = FALSE,
repeat_view = FALSE
Expand All @@ -65,6 +69,10 @@ mapdeck <- function(
, zoom = force( zoom )
, location = force( as.numeric( location ) )
, bearing = force( bearing )
, max_zoom = force( max_zoom )
, min_zoom = force( min_zoom )
, max_pitch = force( max_pitch )
, min_pitch = force( min_pitch )
, show_view_state = force( show_view_state )
, repeat_view = force( repeat_view )
)
Expand Down
16 changes: 13 additions & 3 deletions inst/htmlwidgets/mapdeck.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ HTMLWidgets.widget({
latitude: x.location[1],
zoom: x.zoom,
pitch: x.pitch,
bearing: x.bearing
bearing: x.bearing,
maxZoom: x.max_zoom,
minZoom: x.min_zoom,
maxPitch: x.max_pitch,
minPitch: x.min_pitch
};

if( x.access_token === null ) {
const deckgl = new deck.DeckGL({
views: [ new deck.MapView({ id: el.id, repeat: x.repeat_view }) ],
views: [ new deck.MapView({
id: el.id,
repeat: x.repeat_view
}) ],
map: false,
container: el.id,
initialViewState: window[el.id + 'INITIAL_VIEW_STATE'],
Expand All @@ -42,7 +49,10 @@ HTMLWidgets.widget({
window[el.id + 'map'] = deckgl;
} else {
const deckgl = new deck.DeckGL({
views: [ new deck.MapView({ id: el.id, repeat: x.repeat_view }) ],
views: [ new deck.MapView({
id: el.id,
repeat: x.repeat_view
}) ],
mapboxApiAccessToken: x.access_token,
container: el.id,
mapStyle: x.style,
Expand Down
4 changes: 4 additions & 0 deletions man/mapdeck.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f39324e

Please sign in to comment.