Skip to content

Commit

Permalink
actually, this is it for #238
Browse files Browse the repository at this point in the history
  • Loading branch information
SymbolixAU committed Jan 15, 2020
1 parent 4b51df3 commit df4581d
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 106 deletions.
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export(add_sf)
export(add_text)
export(add_title)
export(add_trips)
export(add_view_state)
export(clear_arc)
export(clear_bitmap)
export(clear_column)
Expand All @@ -84,7 +83,6 @@ export(clear_text)
export(clear_title)
export(clear_tokens)
export(clear_trips)
export(clear_view_state)
export(invoke_method)
export(legend_element)
export(mapdeck)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mapdeck 0.3

* `add_view_state()` overlays the current View State [issue238](https://github.com/SymbolixAU/mapdeck/issues/238)
* `show_view_state` option to overlay the current View State [issue238](https://github.com/SymbolixAU/mapdeck/issues/238)
* performance improvements for dates and factors [issue235](https://github.com/SymbolixAU/mapdeck/issues/235)
* `add_bitmap()` to add a bitmap / image to the map
* input$map_view_change now observed [issue211](https://github.com/SymbolixAU/mapdeck/issues/211) - thanks @zacdav
Expand Down
55 changes: 0 additions & 55 deletions R/map_layer_view_state.R

This file was deleted.

19 changes: 16 additions & 3 deletions R/mapdeck_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,19 @@
#' @param zoom zoom level of the map
#' @param bearing bearing of the map between 0 and 360
#' @param location unnamed vector of lon and lat coordinates (in that order)
#'
#' @param show_view_state logical, indicating whether to add the current View State to the map.
#' When \code{TRUE}, the following is added as an overlay to the map
#' \itemize{
#' \item{width}
#' \item{height}
#' \item{latitude & longitude}
#' \item{zoom}
#' \item{bearing}
#' \item{pitch}
#' \item{altitude}
#' \item{viewBounds}
#' \item{interactionState}
#' }
#' @section Access Tokens:
#'
#' If the \code{token} argument is not used, the map will search for the token, firstly by
Expand All @@ -37,7 +49,8 @@ mapdeck <- function(
pitch = 0,
zoom = 0,
bearing = 0,
location = c(0, 0)
location = c(0, 0),
show_view_state = FALSE
) {

# forward options using x
Expand All @@ -48,7 +61,7 @@ mapdeck <- function(
, zoom = force( zoom )
, location = force( as.numeric( location ) )
, bearing = force( bearing )
, show_view_state = TRUE
, show_view_state = show_view_state
)

# deps <- list(
Expand Down
6 changes: 4 additions & 2 deletions inst/htmlwidgets/lib/view_state/view_state.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
function add_view_state( map_id, viewState ) {
'use strict';

console.log( "add_view_state" );

if( !md_div_exists( 'mapViewStateContainer'+map_id) ) {
md_setup_view_state( map_id );
}
Expand Down Expand Up @@ -31,7 +33,7 @@ function md_placeViewState( map_id, object ) {
mapbox_ctrl.appendChild( object );
}

/*

function clear_view_state( map_id ) {

var element = document.getElementById( map_id + 'mapViewState' );
Expand All @@ -41,4 +43,4 @@ function clear_view_state( map_id ) {
}

}
*/

2 changes: 1 addition & 1 deletion inst/htmlwidgets/mapdeck.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ HTMLWidgets.widget({

if( x.show_view_state ) {
var vs = JSON.stringify( viewState );
console.log( vs );
//console.log( vs );
window[el.id + 'mapViewState'].innerHTML = vs;
}

Expand Down
37 changes: 0 additions & 37 deletions man/add_view_state.Rd

This file was deleted.

5 changes: 1 addition & 4 deletions man/clear.Rd

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

16 changes: 15 additions & 1 deletion man/mapdeck.Rd

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

0 comments on commit df4581d

Please sign in to comment.