SymbolixAU / mapdeck

R interface to Deck.gl and Mapbox

Home Page:https://symbolixau.github.io/mapdeck/articles/mapdeck.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dragging Javascript errors

dcooley opened this issue · comments

commented

related to #349, this seems to be happening again

e.g. - drag on the polygon

library(shinydashboard)
library(mapdeck)
library(sf)
set_token(secret::get_secret("MAPBOX"))

ui <- shinydashboard::dashboardPage(
	header = shinydashboard::dashboardHeader()
	, body = shinydashboard::dashboardBody(
		mapdeck::mapdeckOutput(
			outputId = "map"
		)
	)
	, sidebar = shinydashboard::dashboardSidebar()
)

server <- function(input, output, session) {
	
	nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"))
	
	output$map <- mapdeck::renderMapdeck({
		
		mapdeck::mapdeck() %>%
			add_polygon(
				data = nc		
			)
				
	})
}

shiny::shinyApp(ui = ui, server = server)
commented

I've disabled the drag events on the master branch while this is investigated

commented

In absence of a complete solution, I'm building a dragObject

function buildDragObject(info) {
  var dragObject = {
       coordinate: info.coordinate,
       viewport: info.viewport,
      x: info.x,
     y: info.y
   };

  return(dragObject);
}
library(shinydashboard)
library(mapdeck)
library(sf)
set_token(secret::get_secret("MAPBOX"))

ui <- shinydashboard::dashboardPage(
	header = shinydashboard::dashboardHeader()
	, body = shinydashboard::dashboardBody(
		mapdeck::mapdeckOutput(
			outputId = "map"
		)
	)
	, sidebar = shinydashboard::dashboardSidebar()
)

server <- function(input, output, session) {
	
	nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"))
	
	output$map <- mapdeck::renderMapdeck({
		
		mapdeck::mapdeck() %>%
			add_polygon(
				data = nc		
			)
	})
	
	observeEvent({input$map_drag_start}, {
		print(input$map_drag_start)
	})
	
	observeEvent({input$map_drag}, {
		print(input$map_drag)
	})
	
	observeEvent({input$map_drag_end}, {
		print(input$map_drag_end)
	})
	
}

shiny::shinyApp(ui = ui, server = server)
commented

merged in to master. Calling this a fix