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

Fullpage scrolling with map #9

Open
mschnetzer opened this issue Nov 11, 2020 · 3 comments
Open

Fullpage scrolling with map #9

mschnetzer opened this issue Nov 11, 2020 · 3 comments

Comments

@mschnetzer
Copy link

mschnetzer commented Nov 11, 2020

Hi,
first of all, thanks for the amazing implementation of fullPage in R!

I'd like to have a slide with a fullpage map where scrolling does not zoom but scroll to the next slide. To avoid zooming, I set the leaflet options. But scrolling to the next slide does not work. Is there any workaround?

Thanks a lot!!

Here is some example code:

library(shiny)
library(fullPage)
library(tmap)

data("World")

ui <- 
  fullPage::pagePiling(
    sections.color = c('#fff','#000', '#fff'),
    menu = c("Full Page" = "Link1",
             "Map" = "Map",
             "Another Full Page" = "Link2"),

    fullSection(menu = "Link1", center = TRUE, tags$h1("FULL PAGE 1")),

    fullSection(menu = "Map", tmapOutput("fpmap", width = "100%", height = "100%")),

    fullSection(menu = "Link2", center = TRUE, tags$h1("FULL PAGE 2"))
  )

server <- function(input, output, session) {
  
  output$fpmap <- renderTmap({
      tm_shape(World) +
      tm_view(set.view = c(11.57549, 56.13743, 4),
              control.position = c("right","bottom"),
              leaflet.options = list(minZoom=4, maxZoom=4,
                                     zoomControl = FALSE, dragging = FALSE,
                                     keyboard = FALSE)) +
      tm_polygons("HPI")
  })
}

shinyApp(ui = ui, server = server)
@JohnCoene
Copy link
Member

Yes this is a recurring issue because it's not clearly documented. You can keep scroll from switching page/slide with an option: specify the id (probably fmap in your case) of the element to said option.

An example for a drop down here

Let me know if this helped

@mschnetzer
Copy link
Author

Dear John, thanks for your fast response and your support.

I am not sure if your example meets my problem, as I understand that in this example scrolling is prevented for some elements while I would like to activate it for the map. I have a full page map (with disabled zooming) and I would like to scroll to the next page with my mouse wheel. I have edited my example code above to a full working example. I hope you will see, that sometimes scrolling in the map is working, but as soon as I "hit" a label in the map or click somewhere on the page, the mouse wheel is not scrolling anymore.

Thanks again :)

@JohnCoene
Copy link
Member

Apologies, I misunderstood your question. I'm not sure how to solve this as it seems to be on tmap's side, zoomControl = FALSE disables the scroll completely.

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