crazycapivara / deckgl

An R Interface to deck.gl
https://crazycapivara.github.io/deckgl/
Other
91 stars 11 forks source link

Rendering multiple maps in a Quarto doc creates issue with hovering and tooltips #217

Open j-kind opened 1 year ago

j-kind commented 1 year ago

Hello @crazycapivara,

I'm trying to render several deckgl maps in a quarto document. The maps render and the tooltips for the first map works well, however there is an issue when I hover over the next maps, which should also have tooltips of their own set up. When I hover over say map 2 or 3 the tooltips for the first map appear on the first map itself in direct relation to where I'm hovering on any subsequent map. Any help would be appreciated. Here is some example code below. Each map is created in a separate code chunk in a new environment. I also have the same issue when attempting to render in an Rmd file.

map1 <- deckgl(zoom = 0.5, latitude = -7.152469, longitude = 3.885674, element_id = "map1") %>% add_basemap() %>% add_scatterplot_layer( data = map1_data, tooltip = "Name: {{map1_tooltip}}", id = "map1", properties = list( getPosition = ~latitude + longitude, getRadius = 100, getFillColor = c(0, 0, 255, 255), radiusScale = 1000 )

map1

map2 <- deckgl(zoom = 0.5, latitude = -7.152469, longitude = 3.885674, element_id = "map2") %>% add_basemap() %>% add_scatterplot_layer( data = map2_data, tooltip = "Name: {{map2_tooltip}}", id = "map2", properties = list( getPosition = ~latitude + longitude, getRadius = 100, getFillColor = c(0, 0, 255, 255), radiusScale = 1000 ) )

map2

Could you point me towards a workaround?

Thank you

crazycapivara commented 1 year ago

Hi @j-kind, unfortunately this is a bug, because the container id for the tooltips is not unique when rendering multiple maps :-( I need to change this in the code.