Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update_style() locks the zoom & location of map. #322

Closed
rwjam opened this issue Sep 3, 2020 · 2 comments
Closed

update_style() locks the zoom & location of map. #322

rwjam opened this issue Sep 3, 2020 · 2 comments

Comments

@rwjam
Copy link

rwjam commented Sep 3, 2020

Describe the bug
I'm using update_style() along with an Rshiny selectInput() input to give the user the option to chance the background, but it seems to lock the zoom level and location of the map. I lose the ability to drag the map around with my mouse.

# ##############################################################################################
# ##############################################################################################
# # Sec 1a. Needed Libaries & Input Files

library(shiny)
library(shinydashboard)
library(mapdeck)
library(dplyr)

MapDeckStyleList <- c("dark", "light", "outdoors", "streets", "satellite", "satellite-streets")

##############################################################################################
##############################################################################################
#UI
ui <- dashboardPage(
  dashboardHeader(), 
  dashboardSidebar(
    selectInput(inputId="MapDeckBGInput",label="Background Layer", 
                choices=MapDeckStyleList, selected="dark")
    ), 
  dashboardBody(
    fluidRow(mapdeckOutput(outputId = 'mapA'))
  )
)

##############################################################################################
##############################################################################################
server <- function(input, output) {
  
  ##The MapDeck Token
  # key <- '## put your own token here ##'
  set_token(key) ## set your access token
  
  
  ### The Map
  output$mapA <- renderMapdeck({
    mapdeck()
  })
  
  
  ##Incremental Changes to the Map
  observe({
    mapdeck_update(map_id = 'mapA') %>%
      update_style(style = mapdeck_style(input$MapDeckBGInput))
  })
}

##############################################################################################
##############################################################################################
shinyApp(ui = ui, server = server)
dcooley added a commit that referenced this issue Sep 4, 2020
@dcooley
Copy link
Collaborator

dcooley commented Sep 4, 2020

Thanks - should now be fixed.

@rwjam
Copy link
Author

rwjam commented Sep 8, 2020

Works now, thanks!

@rwjam rwjam closed this as completed Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants